Repository navigation
Compose bounded AI support and engineering adapters - #68
Conversation
|
OpenRouter review posted ( |
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. |
There was a problem hiding this comment.
OpenRouter pull-request review
Verdict: issues
Scope: full-pr (full-pr)
Mode: initial
Commit: dddf1fe883a7c02540bc720ad0aaa8e4e418a888
Judge: openai/gpt-5.6-luna
Cost: $0.7274 (lanes $0.7207 + judge $0.0067) + at least $0.15 (incomplete)
Lanes
openai/gpt-6.1-sol: ok (7 finding(s), 114.4s, 1300620+5097 tokens (1103054 cached), 6 tool round(s), via Azure, $0.72)z-ai/glm-5.3-flash: ok (10 finding(s), 1026.0s, 3022370+77782 tokens (2345183 cached), 13 tool round(s), 1 retried request(s), salvaged finish, via OpenInference, at least $0.15 (incomplete))
Findings
🟠 Issue 1 — AI preference survives an account change
public/feedback.js:46 · risk · identified by openai/gpt-6.1-sol
If account A checks the AI option without submitting, then account B signs in and reloads access in the same page, B inherits the checked option. B's next submission can therefore use the assistant route without B making the explicit disclosure choice.
clearPrivate() clears the capability and hides its fieldset but does not clear assistantPreference.checked. loadTickets() accepts a different current account when no create packet exists, then reveals the fieldset again. The checkbox is only explicitly cleared after an acknowledged create.
I checked readViewer() and the browser tests in src/support-answering.test.ts. The original-actor guard protects an existing packet, but does not protect an unsubmitted preference. Reset or actor-bind the preference while preserving the immutable mode already captured in a retry packet.
🔴 Issue 2 — Stage wakeups stop after multirow filtered pages
worker/src/support-assistant.ts:26 · bug · identified by openai/gpt-6.1-sol
A stage wakeup encountering a filtered page of 2–32 terminal records, messages, or receipts now acknowledges the wakeup even when the next page contains pending work. Without another independently issued wakeup, that work is not processed.
The shared runtime's scan limit changes from 1 to 32, but support-assistant-stage-queue.ts still retries an acknowledged filtered scan only when physicalRows === 1. The larger scan makes that condition inappropriate for ordinary nonempty pages. The modified stage-entry test repeats the same one-row condition rather than testing continuation past a multirow filtered page.
I followed the stage scenario's use of createSupportAssistantRuntime() and the queue's retryDelay() implementation. There is no automatic continuation for this result; the existing eight-delivery and age limits can still bound retries after broadening the nonempty-page condition.
🟠 Issue 3 — Answering regression suite has no registration
worker/src/support-assistant-fixtures.ts:922 · risk · identified by openai/gpt-6.1-sol
The normal test commands never execute the substantial regression suite defined by registerSupportAssistantCases(). Consequently, its tests for late authority changes during generation, competing reservations, invalid citations, and checkpoint concurrency provide no regression protection.
The function is exported from this fixture file, but a repository-wide search finds no call or import. The new SDK025 suites register registerStagedSupportAssistantCases() instead. Moreover, the unused suite still asserts physicalRows <= 1, which conflicts with the newly selected 32-row scan.
I checked vitest.config.ts, vitest.d1.config.ts, and both SDK025 registration files. These configurations discover test files, not an uncalled registration function in a fixture. Register the intended cases for the appropriate backends and update obsolete expectations.
🔴 Issue 4 — Bodyless GitHub issues invalidate otherwise valid reads
worker/src/support-engineering-github.ts:99 · bug · identified by openai/gpt-6.1-sol
A legitimate GitHub issue created without a description has body: null. If such an issue appears in the duplicate-search window, the entire search fails; linking that issue also remains unknown despite matching its exact ID and number.
The shared issue decoder requires prose(value.body, 12_000), which accepts strings—including an empty string—but rejects null. Both duplicate search and direct link reconciliation use this decoder. Normalize GitHub's absent description to an empty string before constructing the SDK DTO.
I checked searchDuplicates(), observeAcceptance(), and the GitHub transport tests. All current fixtures supply string bodies, and there is no null-body case or upstream normalization.
🟠 Issue 5 — Known charges are discarded for truncated or oversized output
worker/src/support-openrouter-model.ts:373 · risk · identified by openai/gpt-6.1-sol
When a paid provider response reaches its output limit and returns finish_reason: 'length', valid native usage is discarded and the durable ledger retains unknown liability instead of settling the actual charge. Empty or over-byte-limit content has the same problem. Repeated occurrences can exhaust the finite reservation slots and require accounting intervention even though the response supplied usable billing evidence.
responseResult() rejects finish reasons and validates content before parsing and validating usage. Only failures inside convertOutput() preserve known accounting. This leaves common unusable-output cases outside the accounting preservation added for malformed candidate JSON and finite token/cost overages.
I checked both purpose wrappers, their billing tests, and the durable usage ledger. Unknown outcomes are conservatively retained and never age out; the truncation test currently expects an exception. Validate independently trustworthy response identity and native usage, then return an empty output with known usage when only the output is unusable.
🟠 Issue 6 — Retained history can consume the entire answering deadline
worker/src/support-assistant.ts:426 · risk · identified by openai/gpt-6.1-sol
With enough earlier-sorting Support records ahead of newly admitted tickets, two admitted turns cannot receive their preparation and generation stages within the SDK's 300-second window. For example, more than 160 filtered physical rows ahead of the tickets already require more than five minute-spaced scans before either ticket is reached.
The scheduler performs one invocation per minute, the runtime advances at most 32 physical rows, and admission does not account for scan position or backlog. Terminal work, messages, and receipts count toward that limit. Holding the cursor for multiple candidates fixes skipping within a page, but does not bound the number of preceding pages.
I checked the admission composition and chronology tests. They establish the four-stage timeline for tickets reached near the beginning of the scan, including later candidates, but do not exercise retained history preceding the admitted tickets. The exact SDK ordering is opaque here; the failure requires the new candidates to fall behind enough physical pages. Bound admission latency or provide a bounded urgent-work discovery path before treating the current chronology proof as a general capacity guarantee.
🔵 Issue 7 — Knowledge scheduling runbook retains the old contract
docs/KNOWLEDGE_COMPOSITION.md:395 · nit · identified by openai/gpt-6.1-sol
An operator following the Knowledge composition runbook is told that RATE_LIMIT_CRON remains 0-57 * * * *, that minutes 58/59 have no invocation, and that cleanup always has 18 lanes. Those statements are no longer true after this change, and its throughput figures are incorrect when answering is enabled.
docs/KNOWLEDGE_COMPOSITION.md lines 395–416 still describe the old trigger and unconditional rotation. The updated Support composition document correctly distinguishes the OFF background window from the all-minute trigger and the enabled 20-lane rotation.
I checked the current scheduler, Wrangler configuration, and both composition documents. Update the Knowledge runbook or link it to the mode-specific scheduling contract so deployment and maintenance decisions are not based on conflicting instructions.
🟠 Issue 8 — */1 * * * * and * * * * * cron entries are semantically identical, risking Cloudflare schedule rejection or deduplication
worker/wrangler.jsonc:41 · risk · identified by z-ai/glm-5.3-flash
If Cloudflare normalizes or rejects duplicate-equivalent schedules, the fifth cron entry */1 * * * * (answering trigger) could be collapsed into the existing * * * * * (MAIL_CRON) entry or rejected at deploy time. Then only one invocation fires per minute and controller.cron matches only one string, so either the mail path or the answering/background-rate path never runs — silent loss of mail send/reconciliation or of the entire answering lane.
Evidence: worker/wrangler.jsonc now lists both "* * * * *" (MAIL_CRON) and "*/1 * * * *" (RATE_LIMIT_CRON); previously the minute-lane entries were ranges (0-57) that did not collide with * * * * *. The PR body itself flags "Actual Cloudflare schedule acceptance … remain open", so the deployment-level acceptance is unproven.
Proof gap: I could not execute a wrangler deploy dry-run from this review; the check is acknowledged as open in the PR.
🟠 Issue 9 — Answering cron branch awaits runSupportAssistantTimer with no visible error containment, unlike every other scheduled branch
worker/src/index.ts:541 · risk · identified by z-ai/glm-5.3-flash
If runSupportAssistantTimer (or the create callback, which builds an entire support handler per invocation) throws unexpectedly while answering is enabled, the scheduled handler rejects. With answering OFF, the same branch wraps its work in ctx.waitUntil((async () => { try { ... } catch (error) { logger.log('error', ...) } })()); the new answering branch has no visible try/catch in the diff, so a per-minute transient failure becomes an unhandled scheduled-handler rejection instead of a logged error lane.
Evidence: worker/src/index.ts, the if (controller.cron === RATE_LIMIT_CRON) block: await runSupportAssistantTimer({ ... }); return; sits outside any catch. Neighboring branches (knowledge maintenance, learning reviews, cleanup) all use try/catch + logger.log('error', '...unavailable', ...).
Proof gap: I did not inspect runSupportAssistantTimer internals; it may swallow errors internally, but the outer contract in this file offers no protection and the failure scenario (a throw from the answering composition built per invocation) is reachable regardless.
🟠 Issue 10 — createSupportHandler silently degrades configured engineering or answering compositions on construction failure, with no log
worker/src/index.ts:168 · risk · identified by z-ai/glm-5.3-flash
A transient or persistent throw while constructing the combined runtime is now swallowed: with both engineering and answering configured, the code retries as answering-only (construct(false, true), setting configured = false), silently dropping the entire engineering intake/staff surface for that handler instance even though it is explicitly configured. With only one configured, the whole optional surface is silently disabled. There is no logger.warn/error anywhere in the fallback chain, so an operator with a broken engineering configuration would see engineering routes quietly 404/stop working while the code appears healthy.
Evidence: worker/src/index.ts, the nested try { supportRuntime = construct(configured, withAnswering); } catch { ... } cascade around construct(withEngineering, withAnswering), followed by if (!configured) selectedEngineering = {}; and the recovery-only downgrade for answering. Previously the failure propagated (the if (!configured && !withAnswering) throw error; escape only covers the both-OFF case).
Because createSupportRequestHandler constructs a handler per request, a request-time construction failure also produces a one-request silent downgrade rather than the previous visible runtime-unavailable error path.
🔵 Issue 11 — checkedAnswering swallows every exception (including a throwing enabled() callback) and silently returns recovery-only
worker/src/index.ts:152 · nit · identified by z-ai/glm-5.3-flash
If the composition's enabled() callback, configuration getter, or any property access throws (e.g., a misconfigured PEGMA_SUPPORT_ASSISTANT_CONFIGURATION_JSON that the composition factory partially initialized, or a buggy adapter callback), checkedAnswering returns { recoveryOnly: true } (or {}), silently turning answering OFF for that request/invocation. A persistent configuration defect would present as "answering unavailable" with zero diagnostics, and the catch { return { recoveryOnly: true }; } branch also converts programming errors in the validation predicate itself into a silent OFF.
Evidence: worker/src/index.ts, function checkedAnswering(...) { try { ... } catch { return { recoveryOnly: true }; } }. Nothing logs; no logger is even in scope there.
Proof gap: I could not verify whether composeSupportAnswering re-validates and surfaces the same defect later; the silent-OFF path is reachable from the catch regardless.
🔵 Issue 12 — checkedAnswering validates customerPolicy.version but not usagePolicy.version
worker/src/index.ts:140 · nit · identified by z-ai/glm-5.3-flash
A composition whose usagePolicy is an object without a version string passes the gate and is accepted as a full answering configuration, while the equivalent defect in customerPolicy is rejected here. If downstream code keys usage accounting or route selection on usagePolicy.version (mirroring the disclosure/policy-version checks used elsewhere in this change), an omitted version would only surface later — possibly at reconcile time when a policy hash or version mismatch matters, i.e., after paid stages have run.
Evidence: worker/src/index.ts checkedAnswering: typeof value.customerPolicy.version !== 'string' is checked, but for usagePolicy only value.usagePolicy === null || typeof value.usagePolicy !== 'object' is checked. Proof gap: I did not read support-assistant-usage.ts/support-assistant-composition.ts to confirm usagePolicy.version is consumed; the asymmetry is visible in the diff itself.
🔵 Issue 13 — Browser capability-fetch errors other than 401/403 are silently swallowed, hiding assistant outages
public/feedback.js:243 · nit · identified by z-ai/glm-5.3-flash
If GET /api/support/assistant/capability fails with 500, 503, a network error, or returns a malformed body (which api() presumably turns into a non-401/403 error), the catch { if (error.status === 401 || error.status === 403) throw error; } swallows it and the assistant fieldset is simply hidden. An operator deploying answering cannot distinguish "answering off" from "capability endpoint broken"; a user who had the checkbox visible before sees it vanish with no status message and no telemetry, and server-side metrics are the only trace.
Evidence: public/feedback.js, inside loadTickets: try { capability = await api('/api/support/assistant/capability'); } catch (error) { if (error.status === 401 || error.status === 403) throw error; } followed by unconditional assistantChoice.hidden = assistantCapability === null;. The status node is not touched in this path.
🔵 Issue 14 — data-disclosure-version="pegma-support-answering-1" in the HTML is never read by feedback.js, which hardcodes the same string
src/pages/feedback.astro:74 · nit · identified by z-ai/glm-5.3-flash
The disclosure version is duplicated in two places: the data-disclosure-version attribute on the #assistant-choice fieldset and the literal 'pegma-support-answering-1' compared in loadTickets. If a future version bump edits only one of them (e.g., the server starts disclosing pegma-support-answering-2 and only the JS literal or only the attribute is updated), the client and server can silently disagree: the attribute would advertise a version the JS refuses to accept (or vice versa), and the mismatch would be invisible because the attribute is decorative. The data attribute currently provides no validation value at all.
Evidence: src/pages/feedback.astro sets data-disclosure-version="pegma-support-answering-1"; public/feedback.js compares capability.disclosureVersion === 'pegma-support-answering-1' and never reads dataset.disclosureVersion. A grep of the diff shows no other consumer of the attribute.
🔵 Issue 15 — native_finish_reason: null is rejected while every other optional response field explicitly permits null
worker/src/support-openrouter-model.ts:431 · nit · identified by z-ai/glm-5.3-flash
A provider response whose native_finish_reason is JSON null (an "absent/unknown" encoding some gateways emit) fails the whole request as invalid_response, even though finish_reason: "stop" is present and the content is perfectly usable. Sibling optional fields in the same validator explicitly allow null: system_fingerprint !== null is checked, choice.logprobs !== null allowed, message.refusal !== null allowed, message.reasoning !== null && !== '' allowed. The null-handling inconsistency is an unnecessary hard failure against real OpenRouter-style providers that vary in null encoding.
Evidence: worker/src/support-openrouter-model.ts in responseResult: choice.native_finish_reason !== undefined && (typeof choice.native_finish_reason !== 'string' || ...) — null fails the typeof check, unlike the adjacent null-tolerant checks on the same objects.
🔵 Issue 16 — integer() labels non-usage validation failures as usage_invalid, misclassifying provider errors
worker/src/support-openrouter-model.ts:180 · nit · identified by z-ai/glm-5.3-flash
integer() always fails with the usage_invalid code, but it is used for non-usage response fields: data.created, choice.index, and every value inside prompt_tokens_details/completion_tokens_details via details(). A provider that returns a malformed created timestamp or a non-integer cached_tokens is recorded as a usage_invalid failure rather than invalid_response. Downstream purpose wrappers and metrics that treat usage_invalid as "provider billed us something unusable" (e.g., for reconciliation or alerting) will misattribute these protocol-shape failures to billing, and the failure taxonomy the tests pin becomes misleading.
Evidence: worker/src/support-openrouter-model.ts: export function integer(...) { ... fail('usage_invalid'); } used for data.created, choice.index, and details() values that are not cost/usage at all.
🔵 Issue 17 — await answeringFor(env) now runs on every /api/support/* request, including plain human ticket traffic
worker/src/index.ts:540 · nit · identified by z-ai/glm-5.3-flash
Every support request — ordinary ticket create/list/read/reply, staff operations — now awaits answeringFor(env) before dispatch. When options.answering is undefined this calls createProductionSupportAnswering(env), which reads the environment each request. If that factory parses or validates PEGMA_SUPPORT_ASSISTANT_CONFIGURATION_JSON eagerly, every human support request pays the parsing/validation cost on the hot path, and any throw inside it would be caught by the surrounding support.runtime_unavailable handler and turn healthy human traffic into runtime-unavailable responses — a new coupling of plain human routes to the optional answering factory.
Evidence: worker/src/index.ts in createWorker().fetch: const answering = await answeringFor(env); is the first statement inside the /api/support/ block, before the engineering/namespace/review dispatch.
Proof gap: I did not read support-assistant-production.ts to measure whether createProductionSupportAnswering is lazy; the coupling itself (human routes now depend on the optional factory not throwing) is visible in the diff.
dddf1fe to
274954d
Compare
There was a problem hiding this comment.
OpenRouter pull-request review
Verdict: partial
Scope: rebase (full-pr)
Mode: verify
Commit: 274954df9387073d49f47ee2b88a3a71d3b3bda5
Judge: openai/gpt-5.6-luna
Cost: $0.8739 (lanes $0.8720 + judge $0.0019)
Lanes
openai/gpt-6.1-sol: ok (6 finding(s), 142.9s, 1306834+6175 tokens (1077027 cached), 5 tool round(s), via Azure, $0.82)z-ai/glm-5.3-flash: ok (0 finding(s), 175.7s, 838684+19609 tokens (427776 cached), 3 tool round(s), via Wafer, $0.0537)
Round 2 resolution
- ✅
r1-2fixed correctly — Stage wakeups stop after multirow filtered pages: The queue now retries committed filtered pages whenever physicalRows > 0. New tests exercise an actual 32-row filtered page and explicit 2/32-row boundaries under the existing delivery cap. - ✅
r1-4fixed correctly — Bodyless GitHub issues invalidate otherwise valid reads: The shared GitHub issue decoder normalizes body: null to an empty string. Tests cover actual duplicate search and exact existing-issue reconciliation; create acknowledgements still require the approved nonempty body. - ✅
r1-1fixed correctly — AI preference survives an account change: clearPrivate() resets the checkbox. Browser tests switch accounts before submission and verify human routing while preserving immutable original-actor retry packets. - ✅
r1-3fixed correctly — Answering regression suite has no registration: support-assistant.test.ts and support-assistant-sdk025.d1.test.ts register the full suite. The fixture's scan expectations now use SUPPORT_ASSISTANT_SCAN_LIMIT; both files are discovered by the normal test configurations. ⚠️ r1-5fixed incorrectly — Known charges are discarded for truncated or oversized output: Valid accounting is now preserved for length, empty/null, oversized, and conversion-invalid output with positive token counts. However, completion_tokens: 0 still fails the minimum-one validation before preservation, leaving a valid empty-completion charge unknown. Existing billing tests use 30 output tokens for all empty-content cases.- 🤝
r1-6disputed — Retained history can consume the entire answering deadline: A bounded urgent-work discovery path now exists:createSupportAnsweringIngressissues a body-free target hint after every accepted assistant-mode create (worker/src/support-assistant-ingress.ts) andsupport-api.tshints accepted replies to assistant-handling tickets;createSupportAssistantRuntime.runTickconsumesready:0/ready:1hint targets before falling back to the cursor scan, so n… - 🤝
r1-8disputed —*/1 * * * *and* * * * *cron entries are semantically identical, risking Cloudflare schedule rejection or deduplication: The supplied technical rebuttal reports isolated Cloudflare acceptance and distinct live execution of both unchanged all-minute expressions, consistent with character-for-character controller.cron dispatch. Current code retains those expressions; no new evidence invalidates that qualification. Product CPU qualification is a separate gate. - ✅
r1-9fixed correctly — Answering cron branch awaitsrunSupportAssistantTimerwith no visible error containment, unlike every other scheduled branch: runSupportAssistantTimer contains qualification, synchronous factory construction, and runtime execution in a catch that emits a finite diagnostic. The root test forces the actual Store factory to throw and verifies scheduled resolution without private exception leakage. - ✅
r1-10fixed correctly —createSupportHandlersilently degrades configured engineering or answering compositions on construction failure, with no log: Construction failures now emit support.composition_unavailable with fixed stage/surface categories before fallback. Root tests verify engineering and answering fallback diagnostics while preserving healthy human/answering surfaces. - ✅
r1-7fixed correctly — Knowledge scheduling runbook retains the old contract: The Knowledge runbook now distinguishes the all-minute trigger, OFF-mode 58 eligible background minutes and 18 lanes, enabled 20 lanes, and OFF-only throughput figures. - ✅
r1-11fixed correctly —checkedAnsweringswallows every exception (including a throwingenabled()callback) and silently returns recovery-only: checkedAnswering logs answering_validation failures, including caught throwing callbacks/getters, through an exception-safe diagnostic helper. Root tests verify the finite event and healthy fallback. - ✅
r1-12fixed correctly —checkedAnsweringvalidatescustomerPolicy.versionbut notusagePolicy.version: checkedAnswering now validates usagePolicy.version through the accounting component's usageText contract. Tests reject missing, nonstring, empty, padded, and oversized versions before optional Store or route work. ⚠️ r1-13fixed incorrectly — Browser capability-fetch errors other than 401/403 are silently swallowed, hiding assistant outages: HTTP, network, and malformed capability failures now produce an accessible outage message while preserving human support. However, the root's normal OFF response omits csrfToken and is consequently classified as malformed by the new browser validation, so the default deployment falsely reports an outage.- ✅
r1-14fixed correctly —data-disclosure-version="pegma-support-answering-1"in the HTML is never read by feedback.js, which hardcodes the same string: The browser now reads and validates assistantChoice.dataset.disclosureVersion and compares capability against that displayed version. A browser test changes the dataset and verifies mismatch withholding. - ✅
r1-15fixed correctly —native_finish_reason: nullis rejected while every other optional response field explicitly permitsnull: native_finish_reason now explicitly permits null. Both answering and engineering model tests verify successful null-native-reason responses. - ✅
r1-16fixed correctly —integer()labels non-usage validation failures asusage_invalid, misclassifying provider errors: created and detail integers now use invalid_response explicitly; choice.index is checked directly and also fails invalid_response. Regression tests distinguish those cases from malformed billing counters and cache-policy failures. - 🤝
r1-17disputed —await answeringFor(env)now runs on every/api/support/*request, including plain human ticket traffic: The current production factory checks OFF before reading configuration or importing the tokenizer, bounds enabled JSON to 65,536 characters, performs no Store/provider work, and catches configuration failures into recovery-only. Root tests verify ordinary human traffic remains healthy with throwing optional configuration. Enabled qualification does add deliberate request-local work, but the hypoth… - Open findings after this round: 8 (1 bug-severity).
This is a partial review. The embedded diff was truncated. It must not be treated as a clean review.
The diff is 801.5 KB against a 768 KB embed budget (max_diff_kb). Diff-budget triage embedded 752.0 KB; 2 file(s) kept only a stub — diff header, +/- counts, and a first-hunk reference, with no reviewable hunks: pnpm-lock.yaml, worker/src/support-assistant-fixtures.ts. Each stubbed file's content may be available through the read-only tools, but stub accounting does not establish readable content or full coverage. This review is a partial verdict and must not be treated as clean.
Findings
🟠 Issue 1 — Colliding priority hints still lose the answering deadline
worker/src/support-assistant.ts:282 · risk · identified by openai/gpt-6.1-sol
When two newly admitted tickets have message IDs ending in the same parity and substantial retained history precedes them, only the second ticket bypasses the history. The first can still expire before preparation or generation, despite both being admitted within the advertised two-turn capacity.
enqueueSupportAssistantTargetHint() overwrites one of two slots based on the last character of triggerMessageId. Completing the surviving target does not restore the overwritten target; discovery returns to the minute-spaced, 32-row global scan. The new priority path therefore only partially addresses r1-6.
I checked the retained-history tests, the collision test, checkpoint restoration, and ingress hint publication. History tests publish one target; the two-turn collision test has no preceding history. Combining those existing fixture states exposes the remaining failure. SDK expiry safely hands off to humans, but does not establish the claimed admission latency.
🟠 Issue 2 — Zero-output responses still discard known charges
worker/src/support-openrouter-model.ts:439 · risk · identified by openai/gpt-6.1-sol
A provider response with valid identity, positive prompt usage and cost, empty content, and completion_tokens: 0 still throws instead of returning its known charge. The durable reservation consequently remains unknown even though the response supplies usable accounting.
Output validation now preserves usage for empty, oversized, and truncated content, but responseResult() first requires both token counters to be at least one. An empty completion need not consume a completion token. This leaves an empty-output case from r1-5 unresolved for both answering and engineering.
I checked both model wrappers, the new billing cases, and the shared ledger validator. The ledger accepts zero token counts; all new empty/null-content billing fixtures instead report 30 completion tokens. No current test covers zero-output native usage.
🔴 Issue 3 — Normal disabled capability is displayed as an outage
public/feedback.js:258 · bug · identified by openai/gpt-6.1-sol
In the checked-in default deployment, every authenticated feedback-page load displays AI assistance is temporarily unavailable, even though answering is intentionally OFF.
The root handler's disabled-capability shortcut returns only { enabled: false }. feedback.js requires capability.csrfToken === viewer.csrfToken before considering either enabled or disabled capability valid, so this successful OFF response is classified as malformed. The outage-message fix for r1-13 therefore misclassifies the normal production contract.
I checked the root production tests and browser tests. Root tests explicitly expect the zero-Store disabled shortcut; the browser's normally-disabled test uses the fixture ingress, which supplies a CSRF token, rather than that shortcut. Align the disabled response/client validation and add a browser test through the actual root response.
🟠 Issue 4 — Priority discovery enumerates unbounded ticket history
worker/src/support-assistant.ts:711 · risk · identified by openai/gpt-6.1-sol
An accepted follow-up on a ticket with extensive retained messages, receipts, or notes makes priority discovery enumerate the entire ticket partition before selecting its turn. This can exceed the intended bounded discovery workload and consume the invocation's D1 allowance before any stage starts.
The new path calls supportRecords.list(hint.ticketId) for up to two hints, with no row/page limit or response-byte validation. Those reads are reported as physicalRows: 0; the 32-row limit, 98,304-byte validation, and four-second scan timeout apply only to the fallback scanCandidates() branch.
I checked the target-hint, retained-history, staged, and Native composition tests. Their target tickets have small partitions; retained history is placed in other tickets. The outer 25-second deadline and hard50 guard bound damage but do not bound this enumeration or ensure progress. Use bounded discovery or a suitable exact public SDK lookup. The precise partition size at which the published D1 adapter exhausts the allowance is not established by the available tests.
🔵 Issue 5 — Filtered-page retry comment retains the one-row contract
worker/src/support-assistant-stage-entry.d1.test.ts:570 · nit · identified by openai/gpt-6.1-sol
A maintainer reading the Native stage-entry assertion is told that only the one-row filtered case retries, while the assertion and queue implementation now retry every nonempty filtered page.
Update the comment to describe the multirow continuation fixed under r1-2; its current wording directly contradicts page.physicalRows > 0 immediately below it.
🔵 Issue 6 — Cleanup comment omits the enabled rotation
worker/src/maintenance-schedule.ts:8 · nit · identified by openai/gpt-6.1-sol
A maintainer consulting the scheduler constants is told that cleanup rotates through 18 lanes unconditionally, although cleanupLaneAt(..., true) selects 20 lanes.
Qualify the comment as OFF-mode behavior or describe both rotations, matching the updated runbooks.
|
Fixed in 43e7644. Document the all-minute answering-exclusive trigger, conditional20/18 cleanup rotation, OFF-only39/19 background split and OFF-only780row/hour figure. Preserve the SDK300second expiry/handoff authority and distinguish bounded throughput from a backlog guarantee. Related browser regressions pass155/155 on both Node22.18.0 and24.18.0. Combined host qualification follows the shared-source integration. |
There was a problem hiding this comment.
OpenRouter pull-request review
Verdict: partial
Scope: rebase (full-pr)
Mode: verify
Commit: 43e76440d9d235e6c432598b0e71a3830d1d0e43
Judge: skipped (one successful review lane; no merge needed)
Cost: $0.80 + at least $0.0608 (incomplete)
Lanes
openai/gpt-6.1-sol: ok (6 finding(s), 128.5s, 1298716+5510 tokens (1073010 cached), 5 tool round(s), via Azure, $0.80)z-ai/glm-5.3-flash: failed-open (at least $0.0608 spent, incomplete) — OpenRouter lane request budget exhausted before retry; lane transport history (includes recovered errors): transport_timeouts=2, elapsed_deadlines=2
Round 2 resolution
- ✅
r1-2fixed correctly — Stage wakeups stop after multirow filtered pages: The queue retries committed filtered pages whenever physicalRows > 0. Tests cover an actual filtered 32-row page and explicit 2/32-row boundaries under the existing delivery cap. The stale test comment is a separate documentation nit. - ✅
r1-4fixed correctly — Bodyless GitHub issues invalidate otherwise valid reads: The shared GitHub issue decoder normalizes body: null to an empty string. Tests exercise duplicate search and exact existing-issue reconciliation; create acknowledgements still require the approved body. - ✅
r1-1fixed correctly — AI preference survives an account change: clearPrivate() clears assistantPreference.checked. Browser tests switch accounts before submission and verify human routing while preserving the original actor and immutable mode of an existing retry packet. - ✅
r1-3fixed correctly — Answering regression suite has no registration: support-assistant.test.ts and support-assistant-sdk025.d1.test.ts call registerSupportAssistantCases(). Their normal Vitest configurations discover these files, and the fully read fixture now uses SUPPORT_ASSISTANT_SCAN_LIMIT rather than obsolete one-row assertions. ⚠️ r1-5fixed incorrectly — Known charges are discarded for truncated or oversized output: Accounting is preserved for length, empty/null, oversized, and conversion-invalid output with positive token usage. However, completion_tokens: 0 still fails the minimum-one check before preservation in the shared decoder, affecting both purpose wrappers. The ledger accepts zero counts and current empty-output billing fixtures do not cover them.⚠️ r1-6fixed incorrectly — Retained history can consume the entire answering deadline: The priority path addresses retained history only for hints that survive publication. Specific evidence invalidates the earlier disputed disposition: two accepted triggers with the same parity overwrite the same slot, leaving the first ticket behind the original minute-spaced history scan. Current history tests use one target, and the collision test omits preceding history. The new path therefore …- 🤝
r1-8disputed —*/1 * * * *and* * * * *cron entries are semantically identical, risking Cloudflare schedule rejection or deduplication: The technical rebuttal reports isolated Cloudflare acceptance and distinct live execution of both unchanged all-minute expressions, consistent with literal controller.cron dispatch. Current code retains those expressions, and no new repository evidence invalidates that qualification. - ✅
r1-9fixed correctly — Answering cron branch awaitsrunSupportAssistantTimerwith no visible error containment, unlike every other scheduled branch: runSupportAssistantTimer catches qualification, synchronous factory construction, and runtime failures and emits finite diagnostics through an exception-safe logger helper. The root test forces the actual Store factory to throw and verifies scheduled-handler resolution. - ✅
r1-10fixed correctly —createSupportHandlersilently degrades configured engineering or answering compositions on construction failure, with no log: Optional runtime construction failures emit support.composition_unavailable with fixed stage and surface categories before fallback. Root tests verify engineering and answering fallback diagnostics without exposing private exceptions. - ✅
r1-7fixed correctly — Knowledge scheduling runbook retains the old contract: The Knowledge runbook now documents the all-minute trigger, OFF-mode background work at minutes 0–57, the 18-lane OFF rotation, the 20-lane enabled rotation, and OFF-only throughput figures. - ✅
r1-11fixed correctly —checkedAnsweringswallows every exception (including a throwingenabled()callback) and silently returns recovery-only: checkedAnswering logs answering_validation failures, including caught callback/getter exceptions, through the exception-safe composition diagnostic helper. Root tests verify the finite event and healthy fallback. - ✅
r1-12fixed correctly —checkedAnsweringvalidatescustomerPolicy.versionbut notusagePolicy.version: checkedAnswering validates usagePolicy.version using usageText before optional runtime construction. Tests reject missing, nonstring, empty, padded, and oversized versions before optional Store or route work. ⚠️ r1-13fixed incorrectly — Browser capability-fetch errors other than 401/403 are silently swallowed, hiding assistant outages: HTTP, network, and malformed capability failures now produce an accessible outage message while preserving human support. However, the normal root OFF response omits csrfToken and is classified as malformed by the browser, so the default deployment falsely reports an outage.- ✅
r1-14fixed correctly —data-disclosure-version="pegma-support-answering-1"in the HTML is never read by feedback.js, which hardcodes the same string: The browser reads assistantChoice.dataset.disclosureVersion, validates it, and compares capability against that displayed version. A browser test changes the dataset and verifies mismatch withholding. - ✅
r1-15fixed correctly —native_finish_reason: nullis rejected while every other optional response field explicitly permitsnull: native_finish_reason explicitly permits null. Both answering and engineering model tests verify successful responses with a null native finish reason. - ✅
r1-16fixed correctly —integer()labels non-usage validation failures asusage_invalid, misclassifying provider errors: created and usage-detail shape integers explicitly use invalid_response; choice.index is checked directly with the same failure category. Tests distinguish these protocol failures from malformed billing counters and cache-policy violations. - 🤝
r1-17disputed —await answeringFor(env)now runs on every/api/support/*request, including plain human ticket traffic: The production factory checks OFF before reading configuration or importing the tokenizer, bounds enabled JSON, performs no Store/provider work, and catches configuration failures into recovery-only. Root tests verify healthy ordinary human traffic with throwing optional configuration. Enabled request-local qualification is deliberate; the hypothesized human-route failure is disproved. - Open findings after this round: 9 (1 bug-severity).
This is a partial review. The embedded diff was truncated. It must not be treated as a clean review.
The diff is 802.0 KB against a 768 KB embed budget (max_diff_kb). Diff-budget triage embedded 752.4 KB; 2 file(s) kept only a stub — diff header, +/- counts, and a first-hunk reference, with no reviewable hunks: pnpm-lock.yaml, worker/src/support-assistant-fixtures.ts. Each stubbed file's content may be available through the read-only tools, but stub accounting does not establish readable content or full coverage. This review is a partial verdict and must not be treated as clean.
Findings
🔴 Issue 1 — Normal disabled capability is displayed as an outage
public/feedback.js:257 · bug · identified by openai/gpt-6.1-sol
Every authenticated feedback-page load in the checked-in default deployment displays AI assistance is temporarily unavailable, although answering is intentionally OFF.
The root handler's disabled-capability shortcut returns { enabled: false } without a CSRF token. The browser requires capability.csrfToken === viewer.csrfToken before accepting either enabled or disabled capability, so it classifies this successful OFF response as malformed. The outage diagnostic added for r1-13 therefore reports a false outage in normal production operation.
I checked the production/root tests and src/support-answering.test.ts. Root tests preserve the zero-Store disabled response, whereas the browser's disabled test uses fixture ingress, which includes a CSRF token. Align the client and root contracts and test the actual root OFF response through the browser.
🟠 Issue 2 — Colliding priority hints still lose the answering deadline
worker/src/support-assistant.ts:282 · risk · identified by openai/gpt-6.1-sol
When two newly admitted tickets have trigger-message IDs with the same final-character parity and substantial retained history precedes them, only the second ticket bypasses that history. The overwritten first target can expire before preparation or generation despite being one of two simultaneously admitted turns.
enqueueSupportAssistantTargetHint() unconditionally replaces one of two parity-selected slots. After completing the surviving target, the runtime returns to the minute-spaced, 32-row fallback scan; neither preparedTarget nor retiredTargets restores the overwritten ticket. This leaves the latency problem from r1-6 incompletely addressed and contradicts the general two-turn chronology claim in docs/SUPPORT_COMPOSITION.md.
I checked ingress publication, accepted-reply publication, checkpoint continuation, and the history and staged tests. The retained-history tests publish one target, while the collision test has no preceding history. Combining those existing fixture states exposes the remaining failure. SDK expiry provides safe human handoff, not guaranteed answering latency.
🟠 Issue 3 — Priority discovery enumerates unbounded ticket history
worker/src/support-assistant.ts:711 · risk · identified by openai/gpt-6.1-sol
An accepted follow-up on a ticket with extensive retained messages, receipts, or notes makes priority discovery enumerate the entire ticket partition before selecting its turn. That discovery can consume the invocation's storage allowance or deadline before any answering stage starts.
The priority path calls supportRecords.list(hint.ticketId) for up to two hints without a row/page bound or response-byte check. These reads are reported as physicalRows: 0. The 32-row limit, 98,304-byte validation, and four-second discovery timeout apply only to the fallback scan, not this enumeration.
I checked target-hint, retained-history, staged, and Native composition tests. Their target partitions are small; retained history is placed in other tickets. The outer deadline and hard50 guard limit damage but do not bound this discovery or guarantee progress. The precise partition size that exhausts the published D1 adapter's allowance is not established by the available tests.
🟠 Issue 4 — Zero-output responses still discard known charges
worker/src/support-openrouter-model.ts:439 · risk · identified by openai/gpt-6.1-sol
A provider response with valid identity, positive prompt usage and cost, empty content, and completion_tokens: 0 still throws rather than returning its known charge. The durable reservation consequently remains unknown even though usable native accounting was supplied.
responseResult() preserves accounting for truncated and unusable output only after validating both token counters with a minimum of one. An empty completion can legitimately have zero completion tokens. This remaining r1-5 failure affects both answering and engineering wrappers.
I checked both model wrappers, the billing tests, and support-model-usage-ledger.ts. The ledger accepts zero token counts, but the empty/null-content fixtures all report positive completion usage. A search of the Worker tests found no zero-completion regression case.
🔵 Issue 5 — Cleanup comment omits the enabled rotation
worker/src/maintenance-schedule.ts:8 · nit · identified by openai/gpt-6.1-sol
A maintainer consulting the scheduler constants is told that cleanup rotates through 18 lanes unconditionally, although cleanupLaneAt(..., true) selects 20 lanes.
Qualify the comment as OFF-mode behavior or describe both rotations, matching the current implementation and updated runbooks.
🔵 Issue 6 — Filtered-page comment retains the one-row contract
worker/src/support-assistant-stage-entry.d1.test.ts:570 · nit · identified by openai/gpt-6.1-sol
A maintainer reading the Native stage-entry assertion is told that only the one-row filtered case retries, while the assertion and queue implementation retry every nonempty filtered page.
The comment immediately precedes page.physicalRows > 0, directly contradicting the multirow continuation fixed under r1-2. Update its wording to describe nonempty filtered pages and the unchanged delivery cap.
|
Addressed the six body-only findings from review 5870805005 in
Both local Node versions pass 192 focused Memory tests, 100 Native tests and Worker types on the combined source. The actual HTTP admission profile remains within 50 D1 calls. Full configured validation, fresh CI and the normal OpenRouter follow-up are running. The three earlier rebuttal threads remain pending Nathan's disposition. |
There was a problem hiding this comment.
OpenRouter pull-request review
Verdict: partial
Scope: rebase (full-pr)
Mode: verify
Commit: 4c90f75ae0070cec5bb2ec1258e43b990c288e8f
Judge: openai/gpt-5.6-luna
Cost: $1.2418 (lanes $1.2398 + judge $0.0021)
Lanes
openai/gpt-6.1-sol: ok (3 finding(s), 186.2s, 1622401+7358 tokens (1371481 cached), 6 tool round(s), via Azure, $0.92)z-ai/glm-5.3-flash: ok (1 finding(s), 568.5s, 4768228+56709 tokens (3547136 cached), 18 tool round(s), via Crusoe, $0.32)
Round 2 resolution
- ✅
r1-2fixed correctly — Stage wakeups stop after multirow filtered pages: Filtered-page continuation now uses physicalRows > 0. Tests cover a real 32-row filtered page and explicit 2/32-row boundaries under the unchanged delivery cap; the Native assertion comment also matches. - ✅
r1-4fixed correctly — Bodyless GitHub issues invalidate otherwise valid reads: The issue decoder normalizes body: null to empty prose. The fully read GitHub transport suite covers duplicate search and exact existing-issue reconciliation, while null create acknowledgements still fail approved-body matching. - ✅
r1-1fixed correctly — AI preference survives an account change: clearPrivate() resets the unsubmitted checkbox. Browser regressions verify account-switch human routing and preserve the exact original-actor assistant retry packet. - ✅
r1-3fixed correctly — Answering regression suite has no registration: The Memory and Native registration files call registerSupportAssistantCases(), and normal Vitest configurations discover both. The fully read fixture uses SUPPORT_ASSISTANT_SCAN_LIMIT instead of obsolete one-row expectations. - ✅
r1-5fixed correctly — Known charges are discarded for truncated or oversized output: Validated native accounting survives length-limited, empty/null, oversized, and conversion-invalid output. completion_tokens now permits zero; answering ledger tests and engineering transport tests explicitly cover zero-completion responses. - ✅
r1-6fixed correctly — Retained history can consume the entire answering deadline: Accepted targets now share one atomic latest-two head rather than parity-overwriting slots. Registered Memory/Native staged cases combine same-parity targets with retained history and prove four cold ticks without fallback scans. Discovery uses bounded exact turn point lookups under its timeout, addressing the earlier unbounded enumeration. Overflow remains explicitly bounded-throughput work, not … - 🤝
r1-8disputed —*/1 * * * *and* * * * *cron entries are semantically identical, risking Cloudflare schedule rejection or deduplication: The technical rebuttal reports Cloudflare acceptance and distinct live execution of both unchanged all-minute expressions, consistent with literal controller.cron dispatch. No current repository evidence invalidates that qualification; deployed CPU qualification remains separate. - ✅
r1-9fixed correctly — Answering cron branch awaitsrunSupportAssistantTimerwith no visible error containment, unlike every other scheduled branch: runSupportAssistantTimer catches qualification, synchronous factory construction, and runtime failures and emits exception-safe finite diagnostics. The root regression forces a Store factory throw and verifies scheduled-handler resolution. - ✅
r1-10fixed correctly —createSupportHandlersilently degrades configured engineering or answering compositions on construction failure, with no log: Optional runtime construction failures emit support.composition_unavailable with fixed stage/surface categories before fallback. Root tests exercise engineering and answering fallback while preserving healthy surfaces and excluding private exception context. - ✅
r1-7fixed correctly — Knowledge scheduling runbook retains the old contract: The Knowledge runbook now distinguishes the all-minute trigger, OFF-only minutes 0–57 background work, 18/20-lane rotations, and OFF-only throughput figures. - ✅
r1-11fixed correctly —checkedAnsweringswallows every exception (including a throwingenabled()callback) and silently returns recovery-only: checkedAnswering logs malformed bundles and caught callback/getter failures through the exception-safe composition diagnostic helper. Root tests verify the finite validation event and healthy fallback. - ✅
r1-12fixed correctly —checkedAnsweringvalidatescustomerPolicy.versionbut notusagePolicy.version: checkedAnswering validates usagePolicy.version using usageText before optional construction. Tests reject absent, numeric, empty, padded, and oversized versions before Store or route work. - ✅
r1-13fixed correctly — Browser capability-fetch errors other than 401/403 are silently swallowed, hiding assistant outages: Capability HTTP/network/malformed failures receive accessible finite outage guidance while human intake remains usable. Disabled capability no longer requires csrfToken, and a browser regression consumes the actual root { enabled: false } response without displaying an outage. - ✅
r1-14fixed correctly —data-disclosure-version="pegma-support-answering-1"in the HTML is never read by feedback.js, which hardcodes the same string: The browser reads and validates the rendered dataset disclosure version, compares it with capability, and captures that same value in the immutable packet. A dataset-mismatch regression verifies withholding. - ✅
r1-15fixed correctly —native_finish_reason: nullis rejected while every other optional response field explicitly permitsnull: native_finish_reason explicitly permits null. Both answering and engineering model suites include successful null-native-reason cases. - ✅
r1-16fixed correctly —integer()labels non-usage validation failures asusage_invalid, misclassifying provider errors: created and detail-count validation explicitly use invalid_response, and choice.index has a direct invalid_response guard. Tests distinguish these response-shape failures from primary usage-counter and cache-policy failures. - 🤝
r1-17disputed —await answeringFor(env)now runs on every/api/support/*request, including plain human ticket traffic: The production factory checks OFF before configuration/tokenizer reads, bounds enabled JSON, performs no Store/provider work, and catches qualification failures into recovery-only. Actual root tests prove healthy human creation with throwing optional configuration. Enabled request-local qualification is deliberate; the hypothesized human-route outage is disproved. - Open findings after this round: 4 (0 bug-severity).
This is a partial review. The embedded diff was truncated. It must not be treated as a clean review.
The diff is 834.2 KB against a 768 KB embed budget (max_diff_kb). Diff-budget triage embedded 742.9 KB; 3 file(s) kept only a stub — diff header, +/- counts, and a first-hunk reference, with no reviewable hunks: pnpm-lock.yaml, worker/src/support-assistant-fixtures.ts, worker/src/support-engineering-github.test.ts. Each stubbed file's content may be available through the read-only tools, but stub accounting does not establish readable content or full coverage. This review is a partial verdict and must not be treated as clean.
Findings
🟠 Issue 1 — Issue reads remain vulnerable to repository name reuse
worker/src/support-engineering-repository.ts:503 · risk · identified by openai/gpt-6.1-sol
If repository 101 is renamed and another repository accessible to the installation token takes its former name between metadata discovery and issue retrieval, duplicate search can return the replacement repository's issues labeled as belonging to 101. This can expose out-of-scope issue content to subsequent engineering processing.
issueRequest() uses the issuer's installation token directly for reads, whereas writes mint and validate an exact numeric-repository-scoped token. The issue decoder checks name-based URLs and then assigns session.repository.repositoryId; it receives no numeric repository identity from the issue response. Final authority validation checks the installation binding/version, not the name-to-ID mapping. Existing-issue reconciliation can likewise misattribute an issue transferred to the replacement repository.
I checked searchDuplicates(), observeAcceptance(), the repository metadata checks, and the GitHub transport tests. The existing name-reuse regression establishes the broad-token threat but protects only issue POSTs. Scope read credentials to the immutable repository ID as well, or obtain equivalent provider-enforced identity evidence before accepting issue content.
🟠 Issue 2 — Contact changes during the closing authority lookup escape validation
worker/src/support-assistant-ingress.ts:223 · risk · identified by openai/gpt-6.1-sol
A fresh ticket can retain the old requester email if the account completes a verified email change after the precommit getUser() check but while the subsequent closing role lookup is pending. This affects both human and assistant preferences on the answering ingress.
verifyBeforeCommit() compares the earlier user snapshot with expectedRequesterEmail, then awaits current(). That closing call rereads roles, active Identity claims, and the session, but does not compare the current contact. Its returned synchronous guard checks credentials, admission, and audience—not email. Consequently, a contact change already visible to the closing Identity lookup does not prevent committing the stale contact.
I checked supportHumanBrowser(), createAgentPrincipalResolver(), and the ingress/Native contact-change tests. Authentication runs only once per browser fence; later current() calls do not refresh the captured email. Existing tests change contact during the held body, before this final check, rather than during the closing role lookup. Carry the contact from the closing Identity observation into the precommit comparison and add that interleaving regression.
🔵 Issue 3 — Unreachable negative-case setup branches
worker/src/support-engineering-model.test.ts:579 · nit · identified by openai/gpt-6.1-sol
The unsafe-native-result parameterized test contains setup branches for confidence and duplicate-json, but neither value appears in its it.each() table. Those branches can never execute and misleadingly suggest that this test exercises those cases.
The later accounting regression suite does cover both cases with the appropriate known-usage expectations. Remove the orphaned branches from this earlier rejection test rather than adding them back with its incompatible exception expectation.
🟠 Issue 4 — Unacknowledged assistant packet retries into a permanent 409 loop once answering admission becomes unavailable
worker/src/support-assistant-ingress.ts:161 · risk · identified by z-ai/glm-5.3-flash
A customer who checked the AI box submits, and the POST to /api/support/assistant/tickets fails before the SDK commits anything (transient 5xx, the 10-second body-read timeout, or a pre-commit failure racing the 25-second acknowledgement_unknown window). feedback.js retains createPacket with the frozen assistant path and body. Before the user retries, answering admission becomes unavailable — the assistantStart role is revoked, the route/usage pool stops qualifying, the PEGMA_SUPPORT_ASSISTANT_* configuration is redeployed, or the cap is reduced to 1. Every subsequent retry then deterministically fails: fresh = answering.admissionEnabled() && expectedRequesterEmail === email (worker/src/support-assistant-ingress.ts:160-161) omits the admission bundle, and the public SDK refuses a fresh createAdmittedCustomerTicket without it. That 409-for-fresh behavior is pinned by this PR's own tests: worker/src/support-assistant-production.test.ts 'refuses a fresh %s packet with processing ON and admission OFF' (409 for both human and assistant_if_available) and the D1 test 'fresh-config-removed' (409).
The browser never recovers: the submit handler replays packet.path/packet.body verbatim, loadTickets() only clears a packet after an acknowledged create, and nothing re-routes a retained assistant packet to the human endpoint. So the UI loops on "Could not confirm ticket creation. Reload current access, then retry the same ticket. Your current draft is kept." — misleading, because a 409 is a definitive server refusal, not an unconfirmed outcome — even though human intake on /api/support/tickets stays healthy and the rendered disclosure promises "If AI assistance is unavailable, your ticket goes to human support." The only escape is abandoning the page entirely (a fresh load discards the packet and its retry IDs).
I read all of public/feedback.js (no re-route or 409-specific handling exists), the ingress fresh/admission gating, and the pinned 409 production tests. Browser tests in src/support-answering.test.ts cover lost-ACK recovery (already-committed receipts replay without admission) and pre-submit capability outages, but not a fresh create whose admission lapsed between the capability check and the submit. Proof gap: I could not execute the SDK myself; the 409-for-fresh-without-admission contract is established by the PR's pinned tests rather than direct execution.
There was a problem hiding this comment.
OpenRouter pull-request review
Verdict: issues
Scope: rebase (full-pr)
Mode: verify
Commit: fcdc4bc8a09a60647495e3931fcaeb1f566ffe75
Judge: openai/gpt-5.6-luna
Cost: $0.8475 (lanes $0.8471 + judge $0.0004) + at least $0.12 (incomplete)
Lanes
openai/gpt-6.1-sol: ok (1 finding(s), 104.9s, 1209587+4555 tokens (958089 cached), 4 tool round(s), via Azure, $0.85)z-ai/glm-5.3-flash: ok (0 finding(s), 878.1s, 2254993+66188 tokens (1706281 cached), 7 tool round(s), 1 retried request(s), salvaged finish, via OpenInference, at least $0.12 (incomplete))
Round 2 resolution
- ✅
r1-2fixed correctly — Stage wakeups stop after multirow filtered pages: Filtered-page continuation uses physicalRows > 0. Tests cover an actual 32-row filtered page and explicit 2/32-row boundaries under the unchanged eight-delivery cap; the Native test comment also matches. - ✅
r1-4fixed correctly — Bodyless GitHub issues invalidate otherwise valid reads: The shared issue decoder normalizes body: null to an empty string. Transport tests cover duplicate search and exact existing-issue reconciliation, while create acknowledgements still require the approved body. - ✅
r1-1fixed correctly — AI preference survives an account change: clearPrivate() resets assistantPreference.checked. Browser tests verify account-switch human routing and preserve the original actor's immutable assistant retry packet. - ✅
r1-3fixed correctly — Answering regression suite has no registration: support-assistant.test.ts and support-assistant-sdk025.d1.test.ts register registerSupportAssistantCases(). Both normal Vitest configurations discover these files, and fixture scan assertions use SUPPORT_ASSISTANT_SCAN_LIMIT. - ✅
r1-5fixed correctly — Known charges are discarded for truncated or oversized output: Validated accounting survives length-limited, empty/null, oversized, and conversion-invalid output. completion_tokens permits zero, with answering ledger and engineering transport regressions covering zero-completion responses. - ✅
r1-6fixed correctly — Retained history can consume the entire answering deadline: Accepted targets share an atomic two-target head rather than parity-overwriting slots. Registered Memory/Native cases combine same-parity targets with retained history and prove four cold ticks without fallback scanning. Priority discovery uses bounded exact turn lookups; overflow retains the documented bounded fallback and original SDK deadline. - 🤝
r1-8disputed —*/1 * * * *and* * * * *cron entries are semantically identical, risking Cloudflare schedule rejection or deduplication: The technical rebuttal reports Cloudflare acceptance and distinct live execution of the two unchanged all-minute expressions, consistent with literal controller.cron dispatch. Current repository evidence does not invalidate that qualification; deployed CPU qualification is a separate outstanding check. - ✅
r1-9fixed correctly — Answering cron branch awaitsrunSupportAssistantTimerwith no visible error containment, unlike every other scheduled branch: runSupportAssistantTimer catches qualification, synchronous runtime construction, and runtime failures with exception-safe finite diagnostics. The root regression forces the actual Store factory to throw and verifies scheduled-handler resolution. - ✅
r1-10fixed correctly —createSupportHandlersilently degrades configured engineering or answering compositions on construction failure, with no log: Optional construction failures emit support.composition_unavailable with fixed stage and surface categories before fallback. Root tests cover engineering and answering fallback while preserving healthy surfaces and excluding private exception context. - ✅
r1-7fixed correctly — Knowledge scheduling runbook retains the old contract: The Knowledge runbook documents the all-minute trigger, OFF-mode background work at minutes 0–57, the 18/20-lane rotations, and OFF-only throughput figures. - ✅
r1-11fixed correctly —checkedAnsweringswallows every exception (including a throwingenabled()callback) and silently returns recovery-only: checkedAnswering logs caught callbacks/getters and malformed enabled bundles through the exception-safe composition diagnostic helper. Root tests verify the finite answering_validation event and healthy fallback. - ✅
r1-12fixed correctly —checkedAnsweringvalidatescustomerPolicy.versionbut notusagePolicy.version: checkedAnswering validates usagePolicy.version with usageText before optional construction. Tests reject absent, numeric, empty, padded, and oversized versions before Store or route work. - ✅
r1-13fixed correctly — Browser capability-fetch errors other than 401/403 are silently swallowed, hiding assistant outages: HTTP, network, and malformed capability failures receive accessible finite outage guidance while human intake remains usable. Disabled capability no longer requires csrfToken; a browser regression consumes the actual root disabled response without reporting an outage. - ✅
r1-14fixed correctly —data-disclosure-version="pegma-support-answering-1"in the HTML is never read by feedback.js, which hardcodes the same string: The browser reads and validates assistantChoice.dataset.disclosureVersion, compares capability against it, and captures that same value in the immutable create packet. A dataset-mismatch regression verifies withholding. - ✅
r1-15fixed correctly —native_finish_reason: nullis rejected while every other optional response field explicitly permitsnull: native_finish_reason explicitly permits null. Both answering and engineering model suites cover successful responses with a null native finish reason. - ✅
r1-16fixed correctly —integer()labels non-usage validation failures asusage_invalid, misclassifying provider errors: created and detail-count integers explicitly use invalid_response, and choice.index has a direct invalid_response guard. Tests distinguish these protocol-shape failures from primary billing-counter and cache-policy failures. - 🤝
r1-17disputed —await answeringFor(env)now runs on every/api/support/*request, including plain human ticket traffic: The production factory checks OFF before configuration/tokenizer reads, bounds enabled JSON, performs no Store/provider operation, and catches qualification failures into recovery-only. Actual root tests demonstrate healthy human creation with throwing optional configuration. Enabled request-local qualification is deliberate, and the hypothesized human-route outage is disproved. - Open findings after this round: 1 (0 bug-severity).
Findings
🔵 Issue 1 — Understated GitHub reconciliation request ceiling
docs/SUPPORT_COMPOSITION.md:498 · nit · identified by openai/gpt-6.1-sol
An operator budgeting GitHub reconciliation from this runbook is told that each operation makes at most four requests, but successful create-issue reconciliation and its independent Application verification now make six.
withinRepository() performs two metadata GETs, and issueRequest() mints a separate scoped token for each issue request. observeAcceptance() performs both a search and a direct issue read, yielding two metadata requests, two token-mint requests, and two issue requests. Update the documented ceiling to distinguish metadata-only operations, single issue operations, and reconciliation.
I checked the repository transport, both reconciliation entry points, and support-engineering-github.test.ts; the independent verification test explicitly expects six transport calls. The shared ten-second deadline remains enforced, but it does not make the four-request statement accurate.
|
The four body-only findings in review 5871403323 were addressed in
Both local Node versions passed 2,160 normal tests, checks and builds. The required action fully embedded all 64 changed paths with the supported 1024 KiB repository setting. Its remaining documentation ceiling finding is corrected in |
There was a problem hiding this comment.
OpenRouter pull-request review
Verdict: clean
Scope: latest-commit (commit-range)
Mode: verify
Commit: 870f92f0c9838dd5dfb5190fcd9d7e0b8a508b0a
Judge: openai/gpt-5.6-luna
Cost: $0.0731 (lanes $0.0729 + judge $0.0001)
Lanes
openai/gpt-6.1-sol: ok (0 finding(s), 20.4s, 55024+520 tokens (36534 cached), 3 tool round(s), via Azure, $0.0606)z-ai/glm-5.3-flash: ok (0 finding(s), 77.9s, 176006+7115 tokens (140672 cached), 11 tool round(s), via Crusoe, $0.0124)
Round 3 resolution
- 2 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).
Change
Compose Pegma's bounded assistant processing, qualified-purpose OpenRouter adapters and durable usage ledger. Add engineering model configuration, processing composition and numeric-repository-scoped GitHub metadata/issue adapters for the approved support enhancement.
The answering composition uses existing ticket work, explicit staged invocations, current authority/configuration checks, durable budgets, exact request identities and unknown-outcome reconciliation. Browser intake includes the existing request-a-person path. Production consumes public Support Desk 0.2.7, Knowledge Base 0.1.6, Sessions 0.2.1 and D1 0.4.7.
With answering enabled, one existing cron lane runs staged answering every minute. Background cleanup rotates through twenty lanes, yielding an approximately twenty-minute interval. The five configured cron expressions are retained. The bounded scan counts every physical row and page with a 32-row maximum per invocation.
Engineering adapters require the host's explicit trusted routing, reproduction/privacy checks and current repository policy. Further driver/root wiring and live GitHub installation qualification remain in progress. Customer AI is disabled in this deployment configuration.
Validation
Both Node 22.18 and 24.18 passed the normal check, test and build commands on this exact tree. Each ran 1,788 ordinary tests, 192 real Workers/D1 tests and two bench tests, with zero failures or skips. Native guards remain fifty D1 calls and one hundred SQL parameters.
Tests cover bounded phased answering, provider/usage reconciliation, late authority/config changes, cancellation, malformed/oversized output and purpose-bound endpoints. Existing empty-body agent revocation fixes are included through the current main base. The matching engineering boundary corrections came from the configured OpenRouter findings on the corresponding Azure integration.
Current-head GitHub CI and configured OpenRouter review are required before merge. Actual Cloudflare schedule acceptance, CPU qualification, provider privacy/quality acceptance, full hosted workflows and supervised pilots remain open.