Skip to content

fix: preserve goals across compression sessions#38231

Open
denisqq wants to merge 1 commit into
NousResearch:mainfrom
denisqq:fix/goal-session-migration
Open

fix: preserve goals across compression sessions#38231
denisqq wants to merge 1 commit into
NousResearch:mainfrom
denisqq:fix/goal-session-migration

Conversation

@denisqq

@denisqq denisqq commented Jun 3, 2026

Copy link
Copy Markdown

Summary

  • preserve persistent /goal state when compression rotates agent.session_id into a continuation session
  • add fail-soft goal migration helper that copies only unfinished goals and archives the source as non-active
  • add lineage recovery for already-created compression children plus regression coverage for direct migration and the real compression boundary

Why

GoalManager stores state in SessionDB.state_meta under goal:<session_id>. Compression creates a new child session id, so the next GoalManager(new_session_id) used to miss the active goal and the judging/continuation loop stopped silently.

Safety

  • no-op for missing, done, cleared, blank, or same-session goals
  • does not overwrite destination active, paused, or done goals
  • migration errors are logged at debug level and never break the main conversation turn
  • source goal is archived as cleared instead of deleting metadata

Tests

  • python3 -m pytest tests/hermes_cli/test_goals.py tests/run_agent/test_compression_boundary_hook.py -q -o 'addopts=' — 60 passed, 1 warning
  • python3 -m pytest tests/run_agent/test_compression_boundary_hook.py tests/run_agent/test_compression_persistence.py tests/run_agent/test_compression_boundary.py tests/gateway/test_compression_session_id_persistence.py tests/agent/test_compression_concurrent_fork.py tests/hermes_cli/test_goals.py -q -o 'addopts=' — 76 passed, 1 warning

Fixes #33618.

@alt-glitch alt-glitch added type/bug Something isn't working comp/agent Core agent loop, run_agent.py, prompt builder comp/cli CLI entry point, hermes_cli/, setup wizard P2 Medium — degraded but workaround exists labels Jun 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/agent Core agent loop, run_agent.py, prompt builder comp/cli CLI entry point, hermes_cli/, setup wizard P2 Medium — degraded but workaround exists type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Persistent /goal is lost after context compression rotates session_id

2 participants