Repository navigation
test: cover unsupported guidance handoff paths - #75
Conversation
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
OpenRouter review posted ( |
There was a problem hiding this comment.
OpenRouter pull-request review
Verdict: issues
Scope: full-pr (full-pr)
Mode: initial
Commit: 0ef90d68c27520120b59245f474fea339143265d
Judge: openai/gpt-5.6-luna
Cost: $0.1853 (lanes $0.1827 + judge $0.0026)
Lanes
openai/gpt-6.1-sol: ok (0 finding(s), 25.4s, 79284+938 tokens (53210 cached), 4 tool round(s), via Azure, $0.0879)z-ai/glm-5.3-flash: ok (6 finding(s), 342.7s, 1768101+46524 tokens (1612800 cached), 47 tool round(s), via Cohere, $0.0948)
Findings
🔵 Issue 1 — expectPendingHumanHandoff hardcodes 'fictional-answer-ticket' instead of a parameter
worker/src/support-assistant-fixtures.ts:949 · nit · identified by z-ai/glm-5.3-flash
A future escalation case running on a second ticket — sibling cases already create fictional-next-ticket via f.createTicket — that calls expectPendingHumanHandoff(f) would silently read and assert the first ticket's handoff while the author believes it asserts the new ticket's. With two escalated tickets the helper compares the wrong ticket against itself, so the test can pass on the wrong data.
Evidence: expectPendingHumanHandoff (lines 944–981) hardcodes 'fictional-answer-ticket' for readStaffTicket while neighboring accessors parameterize or default explicitly (f.messages(ticketId), f.staffMessages(ticketId), f.rows(ticketId)), so the omission is inconsistent with the file's own conventions.
Checked: both current callers use the default ticket, so there is no present-day failure; this is a latent wrong-ticket footgun for the next escalation case.
🔵 Issue 2 — Empty-retrieval case never observes that retrieval was actually attempted
worker/src/support-assistant-fixtures.ts:1114 · nit · identified by z-ai/glm-5.3-flash
A coordinator/SDK regression that escalates with reason: 'no_guidance' and attemptedGuideIds: [] without ever calling knowledge.retrieveAnswerSources (e.g., the no-guidance boundary decided before permitted retrieval) would produce identical results in this case — f.modelCalls [], f.usageReservations [], and a no_guidance/empty handoff — so the test passes while no longer exercising the empty-permitted-retrieval path its title and the PR body ('proves zero connector calls for empty retrieval') claim to pin.
Evidence: the case asserts only model/reservation absence plus handoff fields; nothing observes the retrieval call itself. The fixture exposes no retrieval counter (its observables are modelCalls, usageReservations, usageObservations, serviceContexts, scanned, storeCalls), and both backends supply a stage hook that already wraps knowledge.retrieveAnswerSources, which could carry this assertion but is unused for it.
Checked: no other case in registerSupportAssistantCases or the staged suite pins the retrieval-ran-before-no-guidance ordering either — this PR introduces the only coverage of that path, so the gap is not compensated elsewhere.
🔵 Issue 3 — Escalate cases discard untilTurn's outcome and never re-tick, leaving post-handoff settlement unpinned
worker/src/support-assistant-fixtures.ts:1086 · nit · identified by z-ai/glm-5.3-flash
A regression that leaves the escalated assistant_turn retryable — or keeps the escalated ticket pinned at the retained scan cursor — would let a later scheduled tick re-claim it and make another paid connector call or commit an answer after the human handoff, while both new cases still pass: neither asserts a terminal SDK outcome nor runs any tick after the handoff assertions.
Evidence: both cases discard await f.untilTurn()'s result (lines 1086 and 1112), so turn: 'finished' is never pinned, and each ends immediately after expectPendingHumanHandoff. Sibling cases in the same suites pin exactly this after a handoff outcome: worker/src/support-assistant-history.test.ts advances 60s and re-ticks to expect turn: 'none' with unchanged f.modelCalls after both the source-denial and disabled-route handoffs, and the ACK-loss case re-ticks 24 times to prove one paid chance.
Checked: the staged suite's expiry-escalation case likewise does not re-tick after escalation, so there is no existing follow-up-tick coverage for any escalate outcome — the gap is genuine for this newly covered path.
🔵 Issue 4 — Scripted escalate cases omit paid-accounting pins for the escalated attempt
worker/src/support-assistant-fixtures.ts:1088 · nit · identified by z-ai/glm-5.3-flash
A regression that skips usage.reserve/usage.reconcile for escalate-decision attempts (or double-charges them) passes both scripted cases: they make a real paid model call (via f.answer(context), usage.costMicros 10) but never assert anything about f.usageReservations or f.usageObservations, so escalated turns could consume provider spend with no durable reservation or observation.
Evidence: the established convention pins accounting on paid attempts — the answer case asserts usageObservations.some(o => o.state === 'known') and the disabled-route history case asserts usageObservations.at(-1)?.state === 'known' for a handoff outcome; the two new escalate cases assert only modelCalls, handoff fields, and customer/identity invariance.
Checked: the empty-retrieval case does pin f.usageReservations [] for the no-call path, so the omission is specific to the paid escalate cases.
🔵 Issue 5 — Handoff helper pins handling state only on the staff view, not the customer view
worker/src/support-assistant-fixtures.ts:950 · nit · identified by z-ai/glm-5.3-flash
A regression that shows the customer a stale or wrong handling projection for an escalated ticket (e.g., the customer view still saying the assistant is handling it) would pass all three new cases, because the helper reads customer but asserts only its messages, while handling is checked solely on the staff view (staff.ticket.handling?.state).
Evidence: the customer ticket view does expose handling — worker/src/support-assistant-history.test.ts asserts readCustomerTicket(...).ticket.handling is 'human-pending' for handoff outcomes — so asserting customer.ticket.handling in the helper would be one line and matches the suite's existing pins.
Checked: no other case pins the customer-visible handling state for model-selected escalation or empty retrieval; these cases are the first coverage of those outcomes.
🔵 Issue 6 — New test titles call the model port 'the connector', diverging from this fixture's vocabulary
worker/src/support-assistant-fixtures.ts:1069 · nit · identified by z-ai/glm-5.3-flash
A maintainer grepping 'connector' to find the assistant's model plumbing lands on the GitHub issue connector instead (support-paid-bootstrap.ts 'immutable connector identity', support-engineering-production.ts 'existing connector'), because the assistant fixture names the port model everywhere else (setModel, modelCalls, model.generate) while the new titles at lines 1069 and 1103, the comment at line 1075, and the PR body say 'the connector'.
Evidence: every other case in this file and the coordinator in support-assistant.ts use model/provider terminology for this port.
Checked: 'connector' is established vocabulary for other ports in this repo (the learning fixtures say 'model connectors'), so this is a wording nit, not a behavior issue.
There was a problem hiding this comment.
OpenRouter pull-request review
Verdict: clean
Scope: latest-commit (commit-range)
Mode: verify
Commit: b7c4fa82eba06ce4ff0c221e141363ca2ca30ce9
Judge: openai/gpt-5.6-luna
Cost: $0.1144 (lanes $0.1142 + judge $0.0001)
Lanes
openai/gpt-6.1-sol: ok (0 finding(s), 17.6s, 64752+648 tokens (45981 cached), 4 tool round(s), via Azure, $0.0638)z-ai/glm-5.3-flash: ok (0 finding(s), 117.9s, 977310+17279 tokens (871552 cached), 30 tool round(s), via Together, $0.0504)
Round 2 resolution
- 6 nit finding(s) from earlier rounds retired (severity floor for follow-up rounds is
risk). - Open findings after this round: 0 (0 bug-severity).
No structured findings from the successful lane(s).
The answering fixture now covers connector-selected unsupported/conflicting-guidance escalation and the real empty-permitted-retrieval path. Each case checks one durable human handoff with transcript context, unchanged customer messages/account data, and no committed assistant answer.
The scripted cases test handling of a chosen escalation. Retiring the actual permitted KB guide separately proves zero model calls for empty retrieval; semantic model-quality evaluation stays separate.
Validation on Node 22.18.0 and 24.18.0: frozen public dependency install, scoped formatting, worker types, all 33 Memory cases and all 68 Native D1 cases passed with zero skips. The existing 50-call/100-bind guards remain in effect.