fix: reconcile RALPLAN HUD final state#772
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 0f7af1d32f
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| const filePath = normalizedSessionId | ||
| ? path.join(stateDir, "sessions", encodePathSegment(normalizedSessionId), `${skill}-state.json`) | ||
| : path.join(stateDir, `${skill}-state.json`); |
There was a problem hiding this comment.
Use root RALPLAN phase for global HUD rows
When readVisibleSkillActiveState(cwd, sessionId) is used, session-less root active rows are still intentionally visible to that session, but this lookup switches to only .gjc/state/sessions/<id>/ralplan-state.json whenever a session id is present. For a RALPLAN run seeded without --session-id, the canonical final/handoff phase is stored in root .gjc/state/ralplan-state.json, so a session-scoped HUD read gets no canonical phase and keeps showing the stale revision active entry this change is meant to override; please fall back to the root mode-state when the visible row is global or no session mode-state exists.
Useful? React with 👍 / 👎.
|
REQUEST_CHANGES CI is green and the — |
|
Fixed the REQUEST_CHANGES blocker in Evidence:
Verification run:
— |
|
REVIEW_PENDING_CI Current head — |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 74247b849b
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| const canonicalRalplanPhase = await readModeStatePhase(cwd, sessionId, "ralplan"); | ||
| return dedupeVisibleBySkill([...merged.values()], sessionId) | ||
| .filter(entry => entry.active !== false) | ||
| .map(entry => withCanonicalRalplanPhase(entry, canonicalRalplanPhase)); |
There was a problem hiding this comment.
Avoid applying root RALPLAN terminals to session rows
When this is called without a session id, readModeStatePhase reads the session-less .gjc/state/ralplan-state.json and then applies that terminal phase to every visible ralplan entry, including root active entries that were copied there for a session-scoped run and still carry session_id. If an older global run left the root mode-state at final or handoff, a newer gjc ralplan --session-id ... run in planner gets displayed by the root-scope HUD as terminal and has its stage chip rewritten; only apply the canonical phase to entries from the same scope/run, or skip root canonical overrides for entries with session_id.
Useful? React with 👍 / 👎.
| entryPhase: phaseFromActiveValue(entry.value), | ||
| statePhase: modeStatePhase(state.value), | ||
| }); |
There was a problem hiding this comment.
Match doctor drift checks to the entry session
During an all-scope gjc ralplan doctor, the root active directory can contain a session-owned ralplan row because session-scoped activations are also copied to .gjc/state/active/ralplan.json. This new drift comparison still uses the root mode-state while inspecting that root entry, so an old global final/handoff state causes a false stale_active_state finding for a session run whose own session mode-state is correctly still planner; resolve the canonical state from the entry's session_id before comparing phases.
Useful? React with 👍 / 👎.
Summary
final/handoffwin over stale raw or derived active entries.skill-active-state.jsoncache, then apply canonical RALPLAN terminal phase to the visible entry and HUD stage chip.gjc ralplan doctor --jsonthrough the native RALPLAN command.Tests
bun test packages/coding-agent/test/gjc-runtime/ralplan-runtime.test.ts packages/coding-agent/test/gjc-runtime/state-doctor.test.tsbun --cwd=packages/coding-agent run check:typesFixes #770