Preserve planner guard on null turn-start notifications#305
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
📝 WalkthroughWalkthroughThe ChangesDeferred turn/started handling in approval guard mode
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes Possibly related PRs
Suggested labels
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 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 |
|
@copilot review but do not make fixes |
|
Capy auto-review is paused for this organization because the monthly auto-review limit has been reached. Increase the limit or turn it off in billing settings to resume automatic reviews. |
Reviewed commit 9e4fac3 only (no fixes made). I don’t see additional issues in this patch: the new guard correctly preserves pending planner approval when |
|
@copilot review but do not make fixes |
b871ea3 to
bcbde09
Compare
|
@copilot review but do not make fixes |
bcbde09 to
ef4ce5d
Compare
Summary
Fixes the remaining Greptile review issue from #301: a malformed Codex
turn/startednotification without a turn id no longer consumes the pending planner approval guard before the real turn id arrives.Validation
Summary by CodeRabbit
Greptile Summary
Fixes a bug where a malformed Codex
turn/startednotification (missingturn.id) would consume the pending planner approval guard before the real notification arrived, causing the guard to be silently bound to anullturn id. A focused early-return is added when the null-id case arrives while a guard is pending, and the fix is covered by a new regression test.agentChatService.ts: Adds a guard that discards aturn/startedwith no turn id whenpendingTurnPlanningApprovalGuardedis non-null, logging a warning and returning without modifying runtime state.agentChatService.test.ts: Injects the malformed notification before the real one and asserts the planner contract violation still fires correctly on the subsequent command approval.packagedRuntimeSmoke.ts: Extends the PTY probe timeout to 15 s on Windows (4 s elsewhere) and includes the timeout value in the error message.Confidence Score: 5/5
Safe to merge — the change is a narrow, well-tested guard that only fires when both conditions are true simultaneously.
The fix is minimal and targeted: one early-return behind a two-condition check, backed by a regression test that exercises the exact sequence. The packagedRuntimeSmoke.ts change is an unrelated timeout widening for Windows and carries no correctness risk.
No files require special attention.
Important Files Changed
Sequence Diagram
sequenceDiagram participant Codex participant Handler as turn/started handler participant Runtime Note over Codex,Runtime: Malformed notification (no turn id) Codex->>Handler: "turn/started { turn: {} }" Handler->>Runtime: "pendingTurnPlanningApprovalGuarded !== null?" Runtime-->>Handler: yes Handler->>Handler: warn + return (guard preserved) Note over Codex,Runtime: Real notification (with turn id) Codex->>Handler: "turn/started { turn: { id: "turn-1" } }" Handler->>Runtime: rememberCodexPlanningApprovalGuard(runtime, "turn-1", guard) Runtime-->>Runtime: "pendingTurnPlanningApprovalGuarded = null" Handler->>Runtime: "activeTurnId = "turn-1"" Note over Codex,Runtime: Planner guard is active for "turn-1"Reviews (4): Last reviewed commit: "Harden Windows packaged PTY smoke timeou..." | Re-trigger Greptile