fix(codex): expose advisor consult tool on session reuse - #559
Merged
Merged
Conversation
Reusing a Codex native thread across turns kept the previous MCP tool catalog, so enabling Advisor added the activation notice but never surfaced stave_consult_advisor, leaving the tool uncallable. Track the collaboration grant profile alongside the resumed thread and force a fresh Codex thread only when that profile changes, so the tool catalog and headers are reinstalled on first Advisor activation while later off/on toggles keep reusing the session and its prompt cache. Validate the current turn ID on consult so a stale prior-turn or foreign-task key can no longer spend a new turn's Advisor grant, and refuse a stable channel for turns that carry no task ID.
astyfx
requested review from
JongSikLim and
heath-s
and removed request for
a team
September 18, 2026 04:44
|
| Commit | Scanned at | New | Resolved | Net |
|---|---|---|---|---|
b73d8c1 < |
2026-09-18 04:44 UTC | 0 | 0 | 0 |
Last scanned: b73d8c1 · 2026-09-18 04:44 UTC
|
| Commit | Scanned at | New | Resolved | Net |
|---|---|---|---|---|
b73d8c1 < |
2026-09-18 04:44 UTC | 0 | 0 | 0 |
Last scanned: b73d8c1 · 2026-09-18 04:44 UTC
astyfx
enabled auto-merge (squash)
September 18, 2026 04:44
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes the Advisor review step where enabling Advisor showed the activation notice but
stave_consult_advisornever appeared in the Codex tool list, so it could not be called. Restores the tool on session reuse while keeping the prompt-cache benefit of reusing the native Codex thread.Changes
Fixes
stave_consult_advisorwhen a Codex native thread is reused. A resumed thread kept its previous MCP tool catalog, so first-time Advisor activation only added the notice. The collaboration grant profile is now tracked with the resumed thread, and a fresh thread is forced only when that profile changes.Refactors / Chores
electron/providers/codex-thread-session.ts(profile-aware resume decision, remember/forget helpers).Test Evidence
bun run typecheck— passbun run check:licenses— pass (420 production packages)bun run check:max-lines-ratchet— pass (22 files)bun test tests/codex-app-server-runtime.test.ts tests/provider-runtime-advisor.test.ts tests/advisor-stable-channel.test.ts tests/codex-thread-session.test.ts— 95 pass, 0 failbun test: 62 pre-existing failures unrelated to this change (executable resolution, Lens CDP, Kiro ACP, host-service timeouts). Verified against a cleanorigin/mainbaseline, which shows 63 equivalent failures with these changes stashed.Behavioral cases now covered by tests: Advisor off → on reuses the session and reinstalls the tool catalog; turn-scoped consult requires the turn ID from the briefing; stale/foreign/no-task-ID keys are rejected; the consult channel is retained while the per-turn grant is revoked.
Notes
Not yet verified: real Desktop reproduction in a packaged build and prompt-cache hit-rate measurement. The pre-existing full-suite failures above are environment/timing sensitive and independent of this change.