Skip to content

Persistent /goal is lost after context compression rotates session_id #33618

@denisqq

Description

@denisqq

Bug description

Persistent /goal state can disappear from the user's point of view after context compression rotates the SQLite session_id.

Goal state is stored in state_meta under goal:<session_id>. During context compression Hermes ends the old session, creates a continuation session with a new id, and continues the same logical conversation. The goal state was not migrated as part of that session split, so a GoalManager created for the continuation session sees no active goal.

Steps to reproduce

  1. Start a session and set a standing goal with /goal.
  2. Let the conversation hit manual or automatic context compression.
  3. Compression creates a continuation session with a new session_id.
  4. Ask for /goal status or let the goal loop resume in the new session.

Expected behavior

The active or paused goal follows the logical conversation across compression-created continuation sessions.

Actual behavior

The goal remains under goal:<old_session_id>, while the continuation session reads goal:<new_session_id> and appears to have no active goal.

Proposed fix

  • Add an explicit goal migration helper that copies unfinished goal state to the continuation session.
  • Mark the old goal row as cleared/audit-only after migration to avoid two active rows.
  • Invoke migration from the context compression session-rotation path.
  • Add a regression test that sets a goal, migrates it across a compression boundary, and verifies the continuation session still sees the active goal.

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