fix(collaboration): stop reporting unknown catalog state as a catalog change - #1407
Conversation
|
✅ Deterministic PR hygiene checks passed. |
📝 WalkthroughWalkthroughThe v2 multi-agent guidance now handles ChangesCatalog Guidance
Estimated code review effort: 2 (Simple) | ~10 minutes Possibly related issues
Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
✅ READY
Review readiness checklist
✅ 4/4 boxes ticked. This pull request has been marked Ready for Review. Hygiene✅ Deterministic PR hygiene checks passed. |
6b496df to
96132bc
Compare
Ingwannu
left a comment
There was a problem hiding this comment.
The wording split is directionally useful, but the current head still preserves the underlying request-scoping bug confirmed in #1395, so I am requesting changes.
collectCodexAppServerCatalogState() folds every current-user app-server into one global state, and the inbound request carries no sender PID or catalog fingerprint. A known-stale process A can therefore make a fresh process B receive this PR's do not set model or reasoning_effort instruction. Rewording only unknown does not fix that case, and the same identity limitation applies to both stale and unknown.
For either state, suppress OpenCodex's disk-derived preferred-model, roster, fallback, and custom guidance, but do not prohibit options advertised by the active spawn_agent tool. The minimal safe behavior is to return no OCX-authored v2 guidance for stale or unknown; keep fresh and not_running unchanged.
Please update the regression so a mixed stale/fresh process set can still produce the global stale observation without producing a blanket no-override instruction for an unidentified request. Also update the catalog/subagent behavior documentation, because this changes the user-visible guidance contract. Once that is done on current dev and exact-head CI is green, this can cover both #1354 and #1395 without a duplicate PR.
… change
v2 guidance mapped `unknown` to the same text as `stale`:
The model catalog changed after Codex started; do not set model or
reasoning_effort overrides until Codex restarts.
`unknown` does not mean the catalog changed. It means the comparison could not
be made at all — `collectCodexAppServerCatalogState` returns `unknown` when the
catalog mtime is unreadable, when process enumeration fails, or when any
app-server's start time is unreadable. A transient code-mode-host process that
exits between enumeration and the start-time read lands here, which is why the
message appears intermittently and alternates with normal guidance turn to turn.
So the text asserts a cause that was never established, and prescribes a remedy
that cannot work: restarting Codex does not clear `unknown`, because the state
is a failed measurement rather than a stale process.
Suppressing overrides while the state is unknown is still correct and is
unchanged. Only the claim changes: `unknown` now gets its own message mirroring
the honest phrasing `ocx doctor` already uses for the same state
(src/cli/doctor.ts), so an operator can tell "the catalog changed" from
"we could not check".
Verified:
bun test tests/multi-agent-compat.test.ts -> 42 pass, 0 fail
bun x tsc --noEmit -> clean
coverage src/server/responses/collaboration.ts -> 84.00% lines
Fixes lidge-jun#1354
96132bc to
2e5f4f4
Compare
|
|
Wibias
left a comment
There was a problem hiding this comment.
Requesting changes. The wording split is useful, but the current head is not merge-ready.
Merge blockers
1. Global stale/unknown state still blocks valid overrides for unrelated fresh sessions
collectCodexAppServerCatalogState() folds every detected current-user app-server into one global state. A stale process A therefore makes the global result stale, even if the current request came from a fresh process B. multiAgentGuidanceText() has no sender PID/catalog identity, yet this PR still injects do not set model or reasoning_effort overrides for that global state.
That preserves the confirmed #1395 request-scoping bug. For stale and unknown, suppress OpenCodex-authored disk/catalog guidance, but do not prohibit model/reasoning options exposed by the active spawn_agent tool. The minimal safe behavior is to emit no OCX-authored v2 model guidance for those states, or otherwise make the active tool schema authoritative.
2. The new regression test locks in that incorrect contract
The added test explicitly requires both stale and unknown to contain do not set, so it codifies the #1395 bug instead of protecting the intended boundary.
Please add a mixed stale/fresh regression: one process starts before the catalog, another after it, collector resolves globally to stale, and an unidentified current v2 request must not receive a blanket no-override instruction.
Additional correctness gap
The new unknown message says (app-server start time or catalog timestamp unreadable), but unknown can also result from process-enumeration failure. That still asserts a cause which is not established. If any unknown guidance remains, keep it cause-neutral, e.g. Could not verify whether Codex's model catalog is current.
Docs / readiness
Because #1407 is now the selected overlapping fix path for #1354 and #1395, update the catalog/subagent guidance documentation to describe the actual stale/unknown contract.
The reviewed head is also behind current dev, and exact-head React Doctor / Cross-platform CI have not executed jobs yet (action_required, zero jobs). Rebase or merge current dev and get exact-head CI green before merge.
Security
I found no new exploitable security vulnerability in this diff. The blocking issues are correctness, request scoping, and regression coverage.
|
|
Fixes #1354.
Summary
v2 collaboration guidance mapped
unknownto the same text asstale:unknowndoes not mean the catalog changed. It means the comparison could not be made at all.collectCodexAppServerCatalogStatereturnsunknownwhen the catalog mtime is unreadable, when process enumeration fails, or when any app-server's start time is unreadable:A transient
code-mode-hostprocess that exits between enumeration and the start-time read lands exactly there, which is why the message appears intermittently and alternates with normal guidance from turn to turn, as the reporter describes.So the text asserted a cause that was never established, and prescribed a remedy that cannot work — restarting Codex does not clear
unknown, because the state is a failed measurement rather than a stale process.Suppressing overrides while the state is unknown is still correct and is unchanged. Only the claim changes.
unknownnow gets its own message, mirroring the honest phrasingocx doctoralready uses for the same state (src/cli/doctor.ts):An operator reading a turn can now tell "the catalog changed" apart from "we could not check", and is no longer told to perform a restart that would not help.
Verification
Reproduced with a failing test before the fix —
unknownreturned the stale text verbatim:Commands run against the
devbase (branch is on3976d34):The new test pins four things:
stalekeeps its exact wording;unknownasserts neither the cause nor the restart remedy; both still suppress the override instruction and positive model claims (so the #857 behaviour cannot regress); and the two messages stay distinguishable from each other.The existing #857 test — which asserts both states suppress positive claims — passes unchanged.
Checklist
unknownwording is deliberately aligned with the existingocx doctortext so the two surfaces agree. Happy to add a note if you'd like one.Notes for review
not_runningandfreshare untouched.unknowntext so the instruction itself is unchanged; only the justification and the remedy differ.doctor.tson purpose — if you'd rather the two surfaces diverge, or prefer different phrasing, happy to adjust.Review readiness checklist
This PR stays in draft until every box below is ticked. Tick all four boxes once the requirements are met:
All CI tests are green on my local testing.
I pushed my PR to the latest dev commit.
I resolved all correct Codex and CodeRabbit findings.
My PR is ready for review.
Summary by CodeRabbit
Bug Fixes
Tests