Skip to content

aggregator(batch): Access JWT verified once per batch entry — JWKS failures multiply to ~500s per request (from PR #8624) #8907

Closed

Description

@dezren39

Finding (unaddressed PR review comment)

Codex P2 on open PR #8624 — comment #8624 (comment) by chatgpt-codex-connector[bot], 2026-11-11T09:30:07Z, at pm-stack/aggregator/src/server.ts:1487:

Verify the Access JWT once per batch request — When Access is configured and the JWKS endpoint times out, a 100-entry /api/actions/batch request performs 100 sequential verification attempts against the same JWT. fetchJwks caches only successful responses and gives each fetch a five-second timeout, so rejecting this single request can take roughly 500 seconds. A token with an unknown kid also forces a fresh JWKS request for every entry, even with a warm cache. Verify the request-level token once before the loop and retain only the asserted-author contradiction check per entry.

No-response evidence

Still live on the PR head (verified 2026-11-12, two gh api reads)

pm-stack/aggregator/src/server.ts at head 2809e82: the /api/actions/batch handler (route at line ~1455) loops over up to 100 entries and calls await enforceAccessAuthor(req, parsed.value.author) per entry at line ~1487. pm-stack/aggregator/src/access-identity.ts at the same head: fetchJwks (lines ~77–95) caches only successful responses and fetches with AbortSignal.timeout(5_000); verifyAccessJwt (lines ~116–123) forces a fresh JWKS fetch on an unknown kid on every verification. So a JWKS outage makes one batch request run up to 100 sequential 5-second verification attempts (~500s), and an unknown-kid token forces a fresh JWKS request per entry even with a warm cache.

Acceptance criteria

  • The batch handler verifies the request-level Access token once before the entry loop and retains only the asserted-author contradiction check per entry — or the finding is resolved by a documented decision on this issue.
  • Regression coverage exists showing a 100-entry batch performs a single JWT verification (and does not re-fetch JWKS per entry on failure or unknown kid).

Activity

  1. added
    kind/bugSomething isn't working (prefixed form of the classic bug label)
    task/triageQueue packet kind: verify, reproduce, and route this item
    on Nov 12, 2026
  2. developing-today commented on Nov 12, 2026

    @developing-today
    Contributor
  3. dezren39 commented on Nov 12, 2026

    @dezren39
    MemberAuthor

    🤖 Agent note · filed

  4. dezren39 commented on Nov 12, 2026

    @dezren39
    MemberAuthor

    Conductor dispatch binding (2026-11-12 04:10 CST): queue task 15107 is claimed by repo-worker-code and assigned to OpenChamber session ses_e5e30c32bd4ffe3vzdgy90GpGc on opencode-route/workhorse. Worktree: /home/user/git/fleet/queue-15107-8907-jwks-per-entry; branch: queue/15107-8907-jwks-per-entry. Verified the session assistant engaged the task and acknowledged the verification-first scope; it will not touch the source PR review thread. Task progress records the binding.

  5. dezren39 commented on Nov 12, 2026

    @dezren39
    MemberAuthor

    Triage verified the finding against current code. server.ts already constructs createAccessAuthorEnforcer(req) once before the /api/actions/batch entry loop; access-identity.ts memoizes the request's successful identity or 401 failure, while applying deriveAuthorFromAccess (including the asserted-drew contradiction check) on each entry. The remaining coverage gap was 100-entry failure/unknown-kid behavior. Added regression tests for 100 entries on a JWKS outage (one fetch attempt), 100 entries with unknown kid (initial fetch plus one forced refresh total), and per-entry contradiction checks. Targeted test passes (10 tests). Typecheck was attempted but this worktree lacks @types/bun (TS2688). See follow-up PR #8909: #8909. The source PR review thread was not replied to or resolved.

  6. dezren39 commented on Nov 12, 2026

    @dezren39
    MemberAuthor

    Queue task 15107 is parked awaiting PR checks/baseline disposition. PR #8909 remains OPEN/MERGEABLE at head 07bd761bc6ff7f2889a43c636b15531c4479b044; targeted bun test test/access-identity.test.ts passed (10 tests). Typecheck remains unavailable in this worktree because Bun types are missing (TS2688). Current CI includes unrelated fleet-search parity and mcpx-test lint failures; mcpx unit/E2E are still in progress/queued, so do not merge. Resume consideration: local branch was verified ahead 1 / behind 2 from origin/main; sync consideration is deferred until checks/baseline disposition, and no update/push was made. No source changes in this follow-up; PR #8624 review thread remains untouched.

  7. added
    queue/parkedQueue task is parked (waiting on CI, time, or an event)
    status/parkedDeliberately paused with a recorded resume condition
    on Nov 12, 2026
  8. 32 remaining items

  9. added
    queue/claimedQueue worker lifecycle state
    and removed
    status/parkedDeliberately paused with a recorded resume condition
    queue/parkedQueue task is parked (waiting on CI, time, or an event)
    on Nov 12, 2026
  10. dezren39 commented on Nov 12, 2026

    @dezren39
    MemberAuthor

    Agent note — lane code-b, task 15113 (resumes task 15107)

  11. dezren39 commented on Nov 12, 2026

    @dezren39
    MemberAuthor

    Agent note — lane code-b, task 15113: done

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    app/aggregatorPackage/app: aggregator (pm-stack in this repo)kind/bugSomething isn't working (prefixed form of the classic bug label)priority/normalOrdinary priority (the default)source/pr-comment-reviewFiled by the pr-comment-review jobstatus:donetask/triageQueue packet kind: verify, reproduce, and route this item

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions