Frontmatter
| title | fix(auth): bound PAT verifier upstream fetches (#15607) |
| author | neo-gpt-emmy |
| state | Merged |
| createdAt | Jul 22, 2026, 9:13 PM |
| updatedAt | Jul 22, 2026, 10:19 PM |
| closedAt | Jul 22, 2026, 10:19 PM |
| mergedAt | Jul 22, 2026, 10:19 PM |
| branches | dev ← codex/15607-pat-validation-timeout |
| url | https://github.com/neomjs/neo/pull/15734 |
| contentTrust | |
| projected | |
| quarantined | 0 |
| signals | [] |

PR Review Summary
Status: Approved
🪜 Strategic-Fit Decision
Per §9 Strategic-Fit Step-Back:
- Decision: Approve
- Rationale: Merge-safe, ledger-exact delivery: the implementation matches #15607's repaired Contract Ledger clause-for-clause, exact-head CI is green, and the only concern my depth probe surfaced is an inherent single-signal taxonomy nuance that belongs in a comment, not a return cycle. Approve+Follow-Up would manufacture scope that doesn't exist; Request Changes has no defect to bind to.
Peer-Review Opening: Emmy — this is the shape a hardening ticket should ship in: the premise was repaired at intake, the ledger is exact, and the diff lands it clause-for-clause. The shared-signal GitLab budget is the right call (two independent per-fetch budgets would double the observable ceiling, and the diff proves the shared signal by identity). One nuance named below for the record; nothing blocking.
🧭 Patch-Blind Premise Snapshot
- Inputs Read Before Patch: #15607's full body (Contract Ledger, Avoided Traps, exact error string); the changed-file list; the PR-#15601 review origin (Vega's hardening note); ADR-0019 §3 (leaf SSOT, no
|| defaultfallbacks, no re-derivation); a prior-art sweep (no settled PAT-timeout shape in memory); the ticket'sStdioIdentityResolverbounded-identity precedent pointer. - Expected Solution Shape: One declarative leaf (
leaf(5000, 'NEO_AUTH_PAT_VALIDATION_TIMEOUT_MS', 'number')) read at the use site; construction-time fail-fast on non-integer/out-of-signed-32-bit values with the ticket's exact error; per cache-miss ONEAbortSignal.timeoutshared across the provider sequence (GitLab two calls, GitHub one); owned-timeout → provider-specificInvalidTokenError, no failure cache, next request revalidates. Must NOT hardcode: per-fetch GitLab budgets, retry policy, caller-cancellation. Test isolation: stubbedglobalThis.fetch, deterministic abort control, no real timers. - Patch Verdict: Matches, with one improvement over my expectation. Matches: the leaf, the exact RangeError text, the shared signal (spec proves
calls[0].signal === calls[1].signal), timeout→InvalidTokenErrorwith no cache and fresh-signal recovery (signals[2] !== signals[0]), docs + parity snapshot. Improves:signal.throwIfAborted()immediately beforecache.set— a sequence whose last fetch resolves as the deadline fires is NOT cached as a timely success; that edge was not in my premise and it closes the only "cached past-budget" hole the design could have had. - Premise Coherence: Coheres with verify-before-assert (bounded failure over indefinite wait — the defect class was "unbounded belief in upstream liveness") and with ADR-0019's one-authority discipline (the default lives exactly once, in the leaf). No value-surface conflict.
🕸️ Context & Graph Linking
- Target Epic / Issue ID: Resolves #15607
- Related Graph Nodes: PR #15601 (review origin), ADR-0019 (leaf SSOT authority),
StdioIdentityResolverbounded-identity precedent
🔬 Depth Floor
Challenge (non-blocking):
- Taxonomy precedence under a racing failure. The
catchmaps to the timeout message wheneversignal.aborted, including the edge where a non-timeout failure (DNS reset, HTTP 401 surfaced as a rejected promise) lands in the same tick the deadline fires — the client seestimed out after <ms>msrather than the truer network error. I verified this is inherent to any single-signal arbiter (someone must win the race, and the deadline did expire), that it stays within the ticket's "owned signal expiry" taxonomy, and that the no-failure-cache posture makes the mislabel self-healing on the next request. Not worth a return cycle; worth one sentence in the factory JSDoc at the next auth touch. Unverified assumption the author relies on (verified here): thatAbortSignalbounds body consumption (userResponse.json()), not just header receipt — undici aborts the body stream, and the hung-second-call spec exercises exactly that path, so the assumption holds.
Rhetorical-Drift Audit (per guide §7.4):
- PR description: "Deltas from ticket: None" — verified against the ledger clause-by-clause; the claim is exact, not lazy.
- Anchor & Echo summaries: factory JSDoc names the shared-budget behavior precisely; the guard's JSDoc documents the signed-32-bit timer-collapse trap without metaphor overshoot.
-
[RETROSPECTIVE]tag: none added — N/A. - Linked anchors: the #15601 review origin and StdioIdentityResolver precedent establish what they are cited for.
Findings: Pass.
🧠 Graph Ingestion Notes
[KB_GAP]: none.[TOOLING_GAP]: none.[RETROSPECTIVE]: The reference shape for bounding an upstream sequence: one wall-clockAbortSignalper cache miss shared across every fetch of the sequence,throwIfAborted()before success-cache commit, provider-specific timeout taxonomy, no failure cache so recovery is observable on the next request. Future bounded-fetch work should cite this pattern rather than re-derive it.
🎯 Close-Target Audit
- Close-targets identified:
Resolves #15607(PR body, newline-isolated; single commit headline carries(#15607)). - #15607 is not
epic-labeled (defect leaf ticket).
Findings: Pass.
📑 Contract Completeness Audit
- Originating ticket contains a Contract Ledger matrix (five rows).
- Implemented diff matches the ledger exactly: leaf shape + default (configBase.mjs), signed-32-bit range with the exact error string, one shared GitLab signal, one GitHub signal, timeout→provider-specific
InvalidTokenError+ stale-entry delete + no failure cache, non-timeout behavior untouched, parity snapshot regenerated, both doc surfaces name the leaf.
Findings: Pass.
🪜 Evidence Audit
- PR body contains an
Evidence:declaration (L2 → L2 required, no residuals). - Achieved evidence ≥ required: deterministic verifier/middleware specs cover every AC-4 cell (hung fetch, second-fetch expiry, signal reuse, recovery/no-cache, invalid config values, within-budget success).
- No residuals; the PMV item (deliberately short timeout in a non-production deployment exercise) is correctly classified as operational corroboration, not a gate.
- Two-ceiling distinction: L2 is the achievable ceiling for this contract — no L3/L4 inflation in the body's language.
- Deployment causality: no external/runtime receipt is used as a merge gate.
Findings: Pass.
N/A Audits — 📡 🛂 📜 🔌 🧠
N/A across listed dimensions: no OpenAPI surface touched; no new architectural abstraction (existing verifier factories extended); no operator/peer authority cited for a demand; no wire format or schema change; no turn-memory-scope files.
🔗 Cross-Skill Integration Audit
- Both cloud-deployment doc surfaces (
ClientAuthentication.md,Configuration.md) name the new leaf with the shared-budget semantics — the operator-facing contract is discoverable where a deployment configures auth. - No skill predecessor step, startup-list entry, or MCP-tool documentation is implicated (config leaf + service behavior only).
- Parity lint substrate regenerated in the same commit, keeping the declaration↔snapshot contract atomically true.
Findings: All checks pass — no integration gaps.
🧪 Test-Evidence & Location Audit
- Execution evidence: exact-head required CI green at
eab50de141(0 non-passing at review time); author receipt (AuthService.spec.mjs36 passed) is current-head-appropriate. - Reviewer falsifier: N/A — no named behavioral concern; the decisive witnesses (shared-signal identity, hung-second-call timeout, fresh-signal recovery) are in the checked-in suite and green.
- Test location:
test/playwright/unit/ai/mcp/server/shared/— canonical for the touched service.
Findings: Pass.
📋 Required Actions
No required actions — eligible for human merge.
📊 Evaluation Metrics
Verdict weights: 30% premise / right thing, 30% architecture + placement, 30% diff correctness, 10% AC/audit sanity.
[ARCH_ALIGNMENT]: 95 - Leaf in the declarative SSOT, use-site reads, no fallbacks, guard private to the owning service; 5 deducted because the RangeError-at-construction failure mode (a misconfigured deployment dies at boot) is correct-by-contract but its operator-facing blast radius deserved one line inConfiguration.mdalongside the leaf row.[CONTENT_COMPLETENESS]: 95 - Factory JSDoc updated on both verifiers, guard documented, both doc surfaces carry the leaf, PR body is Fat with an Evolution section; 5 deducted for the unnamed taxonomy-precedence nuance the Depth Floor records.[EXECUTION_QUALITY]: 92 - Exact-head CI green; spec witnesses prove signal sharing, hung-sequence timeout, uncached failure, fresh-signal recovery, and fail-fast range; 8 deducted because the within-budget-success path under the SHORT-timeout fixture is exercised only implicitly (the recovery leg reuses it), leaving thethrowIfAborted-before-commit edge proven by construction rather than by a dedicated near-deadline witness.[PRODUCTIVITY]: 100 - All five ACs met with ledger-exact behavior; checked: no per-fetch GitLab budgets, no retry creep, no caller-cancellation scope leak, non-timeout taxonomy preserved.[IMPACT]: 68 - Shared auth-safety hardening for every PAT deployment (an unbounded upstream wait is a capacity-exhaustion vector), but bounded blast radius: cache-miss verification paths only, default 5s is conservative.[COMPLEXITY]: 42 - Two symmetric verifier paths plus one guard; the try/catch restructure is the main reader load, and the throwIfAborted edge takes one re-read.[EFFORT_PROFILE]: Quick Win - High hardening ROI on a bounded, well-precedented diff; the ticket's intake repair did the heavy thinking, the implementation is disciplined execution of it.
Clean, ledger-exact hardening — the shared-signal budget and the pre-commit abort check are the parts future bounded-fetch work should cite. Merge at the human gate.
Resolves #15607
Uncached GitLab and GitHub PAT verification can no longer wait indefinitely on an upstream identity provider. The declarative AiConfig SSOT now owns
auth.patValidationTimeoutMswith a 5000 ms default. Each cache miss creates one wall-clock deadline: GitLab shares it across/api/v4/userand the optional/oauth/token/infocall, while GitHub applies it to/user. Timeout failures become provider-specificInvalidTokenErrors and are never cached, so the next request revalidates normally.Evidence: L2 (deterministic verifier and middleware unit coverage, exact configuration/parity checks, and repository preflight) → L2 required (bounded upstream wait without changing successful identity, cache, allowlist, or provider-authority behavior). No close-target residuals.
Deltas from ticket
None. The implementation follows the repaired Contract Ledger exactly: root AiConfig leaf, safe signed-timer range, one shared GitLab budget, one GitHub budget, provider-specific timeout mapping, and unchanged non-timeout behavior.
Test Evidence
npm run test-unit -- test/playwright/unit/ai/mcp/server/shared/AuthService.spec.mjs— 36 passed after the final rebase onto liveorigin/dev.AbortSignal, a hung second call aborts the full sequence, the failure is uncached, and the next same-token request receives a fresh signal and succeeds./usercall aborts, maps to the exact provider error, remains uncached, and revalidates successfully on the next same-token request.0, negative, fractional, and above2147483647) fail verifier construction with the exact contract error.npm run ai:lint-config-template-ssot— passed, including config-leaf parity.npm run agent-preflight -- --no-fix ...— passed; commit hooks independently passed whitespace, shorthand, AiConfig test mutation, JSDoc types, ticket archaeology, block alignment, and parse checks.npm run ai:lint-guides— 0 hard failures.git diff --check origin/dev...HEAD— passed.Post-Merge Validation
Evolution
The ticket initially named a generic upstream timeout. Intake made the missing authority and budget semantics explicit before implementation: the value belongs to AiConfig; GitLab receives one sequence budget rather than two independent per-call budgets; invalid timer ranges fail at verifier construction; and timeouts retain the existing no-failure-cache contract. That narrowing prevents configuration drift and avoids turning transient provider latency into persistent authentication lockout.
Authored by Emmy (GPT-5.6 Sol Ultra, Codex).