Skip to content

feat(codex): recover correlated Goal context with Session handoff - #741

Merged
yyjeqhc merged 2 commits into
yyjeqhc:mainfrom
franksong2702:franksong2702/session-recovery-goal-context-20260928
Sep 28, 2026
Merged

yyjeqhc merged 2 commits into
yyjeqhc:mainfrom
franksong2702:franksong2702/session-recovery-goal-context-20260928

Conversation

@franksong2702

Copy link
Copy Markdown
Contributor

Refs #631

Summary

Extend exact Workflow Session handoff recovery with optional read-only durable Goal context.

The Workflow Session remains the primary recovery identity. Goal context is projected only from an existing explicit caller-owned active Workflow Session ↔ Goal correlation; this PR does not add another selector or infer a Goal from Project, Window, title, recency, credentials, or local conversation state.

Recovery semantics

  • 0 active correlated Goals: omit goal_context.
  • 1 active correlated Goal: return bounded Goal identity, lifecycle, revision, objective, current plan, and checkpoint context.
  • multiple active correlated Goals: return selection_required plus bounded candidate identities; never auto-select one Goal and never expose one candidate's objective/plan as the default.
  • Goal store/read unavailable: return explicit unavailable; do not collapse uncertainty into "no Goal".

goal_context is a sibling of the existing 8 KiB handoff_brief, so the canonical handoff brief budget and finish_coding_task.goal_follow_up behavior stay unchanged.

Safety / authority

Goal recovery is read-only. It does not:

  • create or associate a Goal;
  • checkpoint, update, complete, wake, or schedule Goal work;
  • refresh Goal liveness or count as Goal progress;
  • grant Goal, Session, Project, AgentTask, or execution authority.

The hidden session_handoff_state path continues to reuse the canonical handoff recovery path without recording business-Session telemetry. The local Codex reader validates the bounded Goal contract before exposing it to manual or SessionStart/UserPromptSubmit recovery.

Validation

  • focused Goal recovery behavior test: pass;
  • hidden handoff non-recording regression: pass;
  • HTTP hidden handoff non-recording regression: pass;
  • Codex integration Python suite: 50 passed;
  • webcodex-tool-contracts lib suite: 242 passed;
  • cargo check -p webcodex: pass;
  • cargo fmt --all -- --check: pass;
  • git diff --check: pass.

No deployment, service restart, release, or runtime configuration change is included.

@yyjeqhc yyjeqhc left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed the implementation and the recovery/authority boundaries. The production path keeps the Workflow Session as the exact recovery identity, derives Goal context only from explicit caller-owned active Session correlations, preserves ambiguity, and keeps the read non-authoritative/non-mutating.

I found one CI-blocking test-fixture issue rather than a production behavior bug: hidden_handoff_state_is_non_recording_exact_recovery_read created a runtime without a Goal store while asserting the available-store/zero-Goal omission contract. Under this PR's intended semantics, a missing store correctly returns unavailable/store_unavailable. Review commit 374fb79e gives that test an empty real Goal store and adds direct coverage that the hidden session_handoff_state path used by Codex carries the exact Goal context without mutating Goal state or recording business-Session activity.

Review validation: Codex integration 50/50, tool-contracts 242/242, session_handoff* 31/31, focused hidden handoff 1/1, cargo check -p webcodex, rustfmt, and diff check all pass. No remaining code-review blocker found; new CI should verify the updated head.

@yyjeqhc
yyjeqhc merged commit 6e4b1f3 into yyjeqhc:main Sep 28, 2026
16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants