Skip to content

fix: preserve goals across compression session splits - #18427

Closed
fadelguy wants to merge 1 commit into
NousResearch:mainfrom
fadelguy:fix/goal-compression-lineage
Closed

fadelguy wants to merge 1 commit into
NousResearch:mainfrom
fadelguy:fix/goal-compression-lineage

Conversation

@fadelguy

@fadelguy fadelguy commented May 1, 2026

Copy link
Copy Markdown

Summary

  • make /goal resolve goal state through compression-linked session lineage
  • keep writes attached to the resolved goal owner instead of blindly using the current physical session id
  • add regression tests for child sessions, post-turn evaluation, and multi-hop compression chains

Problem

PR #18262 stores standing goals under goal:<session_id>. That works while a conversation stays on one physical session row, but Hermes can split a session during context compression and continue work on a child session.

After that split, the logical conversation continues, but /goal looked only at the child session id. If the goal lived on the compression parent, GoalManager saw no active goal and continuation silently stopped.

Root cause

GoalManager assumed a stable single session_id, while Hermes session state already supports compression lineage via parent_session_id and resume resolution.

Fix

This change teaches goal loading to walk backward through a true compression chain and adopt the nearest visible ancestor goal for the active conversation. It does not borrow goals from arbitrary parent-linked sessions; adoption only happens when the ancestor session ended with end_reason='compression'.

Test plan

  • pytest tests/hermes_cli/test_goals.py -q
  • regression: goal visible from compression child session
  • regression: evaluate_after_turn() updates the resolved goal owner across a compression split
  • regression: goal resolves across multiple compression hops

@MarisKay

Copy link
Copy Markdown

why only manual /compress - any compress. If my llama.cpp decides that its time to compress, the result is the same - goal is lost as never existed. Pls fix this, otherwise every serious task we try to solve, ends up losing the goal settings.

@teknium1

Copy link
Copy Markdown
Collaborator

Thanks for this — the diagnosis and fix are correct for the rotation path.

Context on why we're closing it: as of #52658 (#38763), compression.in_place now defaults to True. Compaction keeps ONE durable session id for the conversation's whole life — it no longer ends the session and forks a continuation id. Because the id no longer rotates, the active /goal stays attached to the same session automatically — there is no rotation boundary to migrate the goal across.

Rotation now only runs as an explicit opt-out (compression.in_place: false), and the direction is to treat that path as legacy. So this fix hardens a code path that no longer executes by default and that we're not investing further in. Closing as superseded by the in-place default — not a reflection on the code, which was a correct fix for the behavior at the time. Credit preserved in the issue/PR history. Appreciate the contribution.

@teknium1 teknium1 closed this Jun 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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.

4 participants