Skip to content

[Bug]: /goal silently lost after manual /compress (session_id rebind doesn't migrate goal state) #18467

@SimbaKingjoe

Description

@SimbaKingjoe

Bug Description

Running /compress while a /goal is active silently terminates the goal loop. The judge never fires again, no message is shown, and the goal state is orphaned in SessionDB under the old session id.

Steps to Reproduce

1 Start a CLI session, set a goal: /goal build X and report back.
2 Have a few turns so context grows.
3 Run /compress.
4 Send any follow-up message.

Expected Behavior

Goal loop continues judging after each turn until done / budget exhausted.

Actual Behavior

Goal loop is dead. /goal status shows "No active goal." No warning printed.

Affected Component

CLI (interactive chat)

Messaging Platform (if gateway-related)

No response

Debug Report

Report       https://paste.rs/ci9Yv
  agent.log    https://paste.rs/NpF3y
  gateway.log  https://paste.rs/KyyTr

Operating System

macOS

Python Version

No response

Hermes Version

No response

Additional Logs / Traceback (optional)

Root Cause Analysis (optional)

Goal state is persisted in SessionDB.state_meta under key goal:<session_id> (hermes_cli/goals.py:127-128).

_compress_context in run_agent.py:9053-9057 ends the current session and mints a new session_id on the agent (child session).

The manual /compress handler in cli.py:7567-7572 correctly syncs self.session_id = self.agent.session_id so /status, /resume, title generation, and end_session() target the live child session — but it does not migrate the goal row:

if (
    getattr(self.agent, "session_id", None)
    and self.agent.session_id != self.session_id
):
    self.session_id = self.agent.session_id
    self._pending_title = None

Proposed Fix (optional)

migrate_goal Method may needed

Are you willing to submit a PR for this?

  • I'd like to fix this myself and submit a PR

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Medium — degraded but workaround existscomp/agentCore agent loop, run_agent.py, prompt buildercomp/cliCLI entry point, hermes_cli/, setup wizardtype/bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions