Skip to content

Add environment runbooks for the Bench Ticket demo - #56

Merged
FlyOverCoderKY merged 8 commits into
mainfrom
cursor/environment-runbooks-0d5d
Sep 11, 2026
Merged

FlyOverCoderKY merged 8 commits into
mainfrom
cursor/environment-runbooks-0d5d

Conversation

@FlyOverCoderKY

Copy link
Copy Markdown
Contributor

One-shot environment runbooks for a synthetic Bench Ticket makerspace helpdesk (not pegma.dev production): email-code login, file a ticket, list the queue, reply.

Public paths

In: first-party Identity email-code, Sessions, Support Desk create/list/reply, mail catcher (Mailpit locally / console on cloud), Storage Core, Health. Rate-limit for email codes is the durable limiter over the injected Store.

Out: Stripe, Auth0/Entra/Cognito, production email vendors, passkeys as required login.

Stores

Environment Record store
Local Docker createMemoryStore()
Cloudflare @pegma/storage-cloudflare-d1
Azure @pegma/storage-azure-tables
AWS @pegma/storage-dynamodb / createDynamoDbStore (storage-core#7, not merged yet)

The AWS runbook uses the same one-shot shape as Azure/D1. It notes that pnpm add @pegma/storage-dynamodb requires that adapter PR to be merged. Docker, Cloudflare, and Azure do not wait on it. This PR does not edit storage-core.

Fixture: recipes/bench-ticket (catalog recipe support-queue-slice).

Open in Web Open in Cursor 

Publish Local Docker, Cloudflare, Azure, and AWS runbooks on the site,
backed by a CI-tested support-queue-slice fixture. AWS uses the forthcoming
@pegma/storage-dynamodb adapter (storage-core#7) as the Store; Docker,
Cloudflare, and Azure do not wait on that PR.

Co-authored-by: Fly Over Coder <FlyOverCoder@gmail.com>
@github-actions

github-actions Bot commented Sep 11, 2026 •

Copy link
Copy Markdown

OpenRouter review posted (clean). #56 (review)

Drop DOM-only HeadersInit from the Node recipe host, and align the
offline eval npm map with the recipe backlog pins so support-queue-slice
can be selected as the primary recipe.

Co-authored-by: Fly Over Coder <FlyOverCoder@gmail.com>

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OpenRouter pull-request review

Verdict: partial
Scope: full-pr (full-pr)
Mode: initial
Commit: 3e3ca21897add776d31ae90bfbb606fb6c886849
Judge: openai/gpt-5.6-luna (schema fallback: deterministic union)
Cost: $0.4366 (lanes $0.4316 + judge $0.0050) + at least $0.22 (incomplete)

Lanes

  • meta/muse-spark-1.2: ok (13 finding(s), 58.2s, 453373+8949 tokens (157395 cached), 6 tool round(s), via Meta, $0.43)
  • z-ai/glm-5.3-flash: ok (16 finding(s), 839.2s, 4451159+68689 tokens (4028288 cached), 42 tool round(s), 1 retried request(s), salvaged finish, via Together, at least $0.22 (incomplete))

Warning

The PR head advanced after this review's diff was collected. This review is pinned to commit 3e3ca21 and does not cover the newest push.

Findings

🔴 Issue 1 — Stored XSS via unescaped ticket subject

recipes/bench-ticket/handler.ts:116 · bug · identified by meta/muse-spark-1.2

An attacker who files a ticket with a subject like <img src=x onerror=alert(1)> will have that HTML executed for every viewer who later lists tickets.

recipes/bench-ticket/handler.ts builds the queue with el.innerHTML = '<strong>#' + row.number + '</strong> ' + row.subject + ... and row.subject / row.status are taken directly from Support Desk records without HTML escaping. support-desk stores opaque strings; no sanitization is documented.

Checked current callers: handler.ts is the only browser entry point (Node host.ts and cloudflare/worker.ts both delegate to handleBenchTicketRequest). No textContent escaping or sanitization layer exists; handler.test.ts only exercises benign subjects.

No counterevidence disproves injection; the code path is reachable by any authenticated user via POST /api/tickets.

🔴 Issue 2 — Malformed cookie crashes request with 500

recipes/bench-ticket/handler.ts:170 · bug · identified by meta/muse-spark-1.2

A request with a malformed cookie value like bench_ticket_session=%ZZ throws inside parseCookies and returns 500 instead of 401.

parseCookies in handler.ts calls decodeURIComponent(value) without try/catch. Any URIError propagates to the outer try in handleBenchTicketRequest and is mapped by mapError to 500 internal_error. Attacker can force this on any authenticated endpoint (/api/me, /api/tickets).

Checked blast radius: currentPrincipal, signout, and all ticket routes call parseCookies. No validation guard exists upstream; handler.test.ts only uses well-formed cookies.

No counterevidence shows a framework catches URIError earlier.

🔴 Issue 3 — Cloudflare Worker composition cache ignores secret rotation

recipes/bench-ticket/cloudflare/worker.ts:31 · bug · identified by meta/muse-spark-1.2

Rotating BENCH_TICKET_EMAIL_CODE_SECRET_BASE64 without changing BENCH_TICKET_ORIGIN leaves the Worker verifying codes with the stale secret until the isolate recycles.

recipes/bench-ticket/cloudflare/worker.ts:compositionFor caches by cachedOrigin === env.BENCH_TICKET_ORIGIN only. emailCodeSecretBase64 and even BENCH_TICKET_DB binding are not part of the cache key, so a secret rotation (via wrangler secret put) is invisible to the cached createBenchTicketComposition instance.

Checked sibling workers: the pattern is bespoke here; no other invalidation exists. The runbook instructs secret rotation via wrangler secret put without a deploy.

No counterevidence that Workers always recycle on secret put; Cloudflare reuses isolates.

🔴 Issue 4 — Header forwarding joins cookies with comma

recipes/bench-ticket/host.ts:63 · bug · identified by meta/muse-spark-1.2

Requests that carry multiple Cookie header values (Node http splits them) will be forwarded with commas instead of ; , breaking session lookup on some clients.

recipes/bench-ticket/host.ts:requestFromNode does Array.isArray(value) ? headers.set(name, value.join(', ')) for all headers. For cookie, RFC requires ; separation; comma-joining produces an unparsable parseCookies input and forces 401 unauthenticated.

Checked Node docs: IncomingMessage.headers.cookie can be string or string[] when duplicate headers arrive. No special-casing exists. Cloudflare path is unaffected.

No test covers host.ts HTTP layer; only handler.test.ts calls handleBenchTicketRequest directly.

🔴 Issue 5 — New eval case breaks the hardcoded eval prompt-set assertion

evals/assembly-eval.test.ts:87 · bug · identified by z-ai/glm-5.3-flash

pnpm test (CI) fails on the evals/assembly-eval.test.ts test defines the plan prompt set: it asserts ASSEMBLY_EVAL_CASES.map(c => c.id).sort() equals a hardcoded four-id array (health-endpoint-only, no-passwords, passkey-accounts-workers, static-brochure). The PR adds a fifth case, support-desk-email-code, to evals/assembly-cases.ts without updating the expected list, so the assertion compares a 5-element array against a 4-element one and throws.

Mechanism: the test file was not touched by the PR (it is not in the changed paths), while evals/assembly-cases.ts now has five cases. vitest.config.ts includes evals/**/*.test.ts and .github/workflows/ci.yml runs pnpm test, so this fails on every CI run.

Fix: add 'support-desk-email-code' to the expected id array in the defines the plan prompt set assertion.

🔴 Issue 6 — EVAL_NPM versions do not match the new recipe's pins, so the support-desk eval case cannot pass

evals/assembly-eval.test.ts:30 · bug · identified by z-ai/glm-5.3-flash

In catalog mode the new eval case support-desk-email-code can never pass: planComposition(..., { productionOnly: true }) gates recipes through recipePackagesReady, which requires every name@​version pin to equal the npm-compiled version. support-queue-slice pins @​pegma/identity@​0.1.2, @​pegma/sessions@​0.2.0, @​pegma/mail@​0.1.1, @​pegma/rate-limit@​0.2.0, @​pegma/health@​0.2.0, @​pegma/support-desk-{application,contracts,core}@​0.1.1, and @​pegma/authorization-core@​0.4.0, but the eval harness's EVAL_NPM map (whose comment says it matches "recipe backlog pins") resolves those packages to 0.1.0/0.1.0/0.1.0/0.1.0/0.1.1/0.1.0/0.1.2. The recipe is therefore skipped with reason recipe packages not published with pins, plan.recipes is empty, primaryRecipeId is null, and the case's must_primary_recipe:support-queue-slice check fails — which breaks expect(withCatalog.passRate).toBe(1) and the per-case expect(c.pass).toBe(true) loop in CI.

This is the first eval case whose primary recipe is pinned to versions, so it is the first to expose the stale fixture: the four pre-existing cases still pass because none asserts a primary recipe whose pins must match EVAL_NPM (only static-brochure-minimal does, and its @​pegma/spine@​0.1.1 pin matches).

What I checked: EVAL_NPM values confirmed by grep at lines 30, 40, 43, 44, 61, 62, 67 of evals/assembly-eval.test.ts; the readiness comparison in recipePackagesReady (src/data/catalog-schema.ts); the skip branch in planComposition (src/data/mcp-tools.ts); and package.json (which pins identity 0.1.2, sessions 0.2.0, etc., matching the recipe). Fix: update EVAL_NPM to the new recipe's pin set.

🔴 Issue 7 — Local Docker runbook round-trip requires node but prerequisites claim "Docker and nothing else"

src/pages/runbooks/local-docker.md:22 · bug · identified by z-ai/glm-5.3-flash

Step 4 of src/pages/runbooks/local-docker.md pipes three commands through node -e (codeHandle extraction, Mailpit code extraction, ticket-id extraction), but the page's prerequisites list only "Docker Engine with Compose v2", Git, and free ports — no Node — and the intro promises a one-shot on "a laptop that has Docker and nothing else". On that machine the first node -e fails with command not found: node, $HANDLE is empty, and the documented ticket round-trip cannot be completed, contradicting the runbook's own framing (the Cloudflare/Azure/AWS runbooks all list "Node 22/24 with Corepack" in prerequisites; this one omits it).

Fix: add Node (any recent version, for the node -e JSON parsing) to the local-docker prerequisites, or rewrite the extraction in POSIX shell/jq.

What I checked: the node -e occurrences at lines ~80–115 of the runbook, and the sibling runbooks' prerequisite lists.

🟠 Issue 8 — Global rate-limit bucket on Node hosts

recipes/bench-ticket/handler.ts:250 · risk · identified by meta/muse-spark-1.2

On Local Docker / Azure / AWS (Node host.ts) every caller shares the single rate-limit key "local", so one abusive IP can block all legitimate email-code requests.

handler.ts:handleBenchTicketRequest derives rateLimitKey as request.headers.get('cf-connecting-ip') ?? 'local'. cf-connecting-ip only exists on Cloudflare. Node hosts never set it, so local is used for all clients. The two durable limiters (bench-ticket-email-code-request 10/10m, verification 20/10m) will quickly trip for the whole host.

Checked host.ts:requestFromNode – it forwards req.headers verbatim and never synthesizes cf-connecting-ip from x-forwarded-for or socket IP. Tests use a fixed key 203.0.113.20 directly against composition.identity, not via HTTP.

No proof that a reverse proxy injects cf-connecting-ip in non-Cloudflare runbooks.

🟠 Issue 9 — Synchronous mail drain turns transient SMTP failure into hard begin failure

recipes/bench-ticket/handler.ts:255 · risk · identified by meta/muse-spark-1.2

If Mailpit is not yet ready, every POST /api/auth/begin returns 500 even though the email-code was enqueued successfully.

handler.ts calls await drainMail(composition) (which runs mailWorker.runSendPage → createMailpitSmtpProvider.send → smtpDialog). smtpDialog rejects on timeout or 4xx, bubbling to handleBenchTicketRequest → mapError → 500. The identity record was already written; the outbox job could be retried on next request, but the API hides success.

Checked docker-compose.yml: depends_on: condition: service_started does not wait for Mailpit to listen, so race on cold start is likely. mail-smtp.ts has an 8s timeout. No retry or swallow logic; composition.test.ts uses an in-memory stub that never fails.

No counterevidence that runSendPage is best-effort.

🟠 Issue 10 — Compose healthcheck race — Mailpit not yet listening

recipes/bench-ticket/docker-compose.yml:13 · risk · identified by meta/muse-spark-1.2

Cold-start docker compose up --build can return 500 on first login attempts despite containers being "started".

recipes/bench-ticket/docker-compose.yml uses depends_on: condition: service_started for mailpit. That only waits for the container to start, not for port 1025 to accept SMTP. host.ts will then hit Mailpit SMTP timed out on the first begin calls until Mailpit is ready.

Checked expected fix: service_healthy with a healthcheck on Mailpit, or a retry in createMailpitSmtpProvider. No healthcheck is defined for mailpit service. The runbook's failure table even lists this symptom.

No counterevidence that Docker Compose v2 waits for TCP readiness on service_started.

🟠 Issue 11 — Demo page injects user-controlled ticket subject into innerHTML (stored XSS pattern in a recipe agents copy)

recipes/bench-ticket/handler.ts:96 · risk · identified by z-ai/glm-5.3-flash

The Bench Ticket demo page builds the queue with el.innerHTML = '<strong>#' + row.number + '</strong> ' + row.subject + ..., interpolating row.subject — raw user input from POST /api/tickets — into HTML without escaping. A user who files a ticket with subject <img src=x onerror=...> gets script execution in their own queue on every refresh. Today that is only self-XSS (listCustomerTickets is read-own), but this file is a CI-tested fixture that the site explicitly holds up as the code agents should copy (recipes/README.md, /examples, the runbooks), so the unescaped-innerHTML pattern ships as the taught pattern for ticket rendering.

Mechanism: handler.ts refresh() builds the ticket element from row.subject/row.status without an escape helper, unlike the production worker which maps views through publicTicketSummary/publicTicketView DTOs.

Fix: escape the interpolated values (or build the row with textContent) before innerHTML. I checked worker/src/support-api.ts for the DTO-mapping precedent the demo skips.

🟠 Issue 12 — Recipe API calls against published packages have no in-repo precedent and diverge from the only callers

recipes/bench-ticket/composition.ts:212 · risk · identified by z-ai/glm-5.3-flash

If any of the shapes below differ in the installed @​pegma/* typings, pnpm run check (tsc -p recipes/tsconfig.json --noEmit) or pnpm test fails and CI goes red. The new recipe is the first consumer of several exports; the production worker (worker/src) — the only in-repo precedent for these packages — uses different call shapes for the overlapping ones:

  • createProcessCheck('process') — worker calls createProcessCheck() with no argument (worker/src/index.ts:186).
  • runHealthChecks({ service, clock, checks }) — worker passes no clock (worker/src/index.ts:183).
  • createStorePingCheck and healthProbeCollection — zero in-repo callers outside the new recipe.
  • createMemoryLimiter(policy, { clock }) and createDurableLimiter(policy, store, { clock }) (third options arg) — no in-repo callers; worker/src/identity-runtime.ts:88 calls createDurableLimiter(policy, store) with two args.
  • new IdentityError('invalid_input', '…') and the error.code values rate_limited/verification_failed/invalid_input/not_found/conflict in mapError — no in-repo construction of IdentityError exists; the worker maps errors by duck-typed code instead (worker/src/support-desk.ts:137).
  • createSupportDeskApplication({ store, clock, logger, allowedCategories }) without queueTerminalRetentionMilliseconds, and createCustomerTicket without requesterEmail — the only in-repo caller passes both (worker/src/support-desk.ts:275, worker/src/support-api.ts:664).
  • Hand-built AccessContext literal { principalId, policyVersion, roles, entitlements, permissions } — the repo always builds it via resolveAccess (worker/src/support-access.ts:96), so the literal's exactness against @​pegma/authorization-core's type is unverified.
  • CloudflareD1Database type import from @​pegma/storage-cloudflare-d1 (cloudflare/worker.ts:10) — the worker types the binding as the Workers D1Database instead.

I could not falsify or confirm these: the checkout has no node_modules, so the published .d.ts files are not readable, and the recipe tests (recipes/**/*.test.ts) do run in CI and would catch missing exports at runtime — but a wrong-but-typable signature would only surface as tsc failures. Verify each against the installed packages' .d.ts before merge.

🟠 Issue 13 — Recipe Cloudflare Worker omits nodejs_compat and is never executed by any test

recipes/bench-ticket/cloudflare/wrangler.jsonc:3 · risk · identified by z-ai/glm-5.3-flash

recipes/bench-ticket/cloudflare/wrangler.jsonc sets no compatibility_flags, while the only in-repo Workers consumer of the same package set (the production worker for @​pegma/identity, @​pegma/sessions, @​pegma/storage-cloudflare-d1) enables nodejs_compat (worker/wrangler.jsonc). If any composed package imports a node: builtin, wrangler dev/deploy of the recipe Worker fails at runtime with an unresolvable module, and nothing in CI would have caught it: no vitest config executes cloudflare/worker.ts (vitest.d1.config.ts includes only worker/src/**/*.d1.test.ts; the main config only runs *.test.ts), and type-checking alone does not exercise the Workers runtime path the runbooks tell agents to deploy.

Concrete failure: an agent follows the Cloudflare runbook, npx wrangler deploy succeeds (bundling succeeds either way), and the first /health request 500s because a composed package imported a Node builtin the recipe's runtime does not enable.

What I checked: cloudflare/worker.ts imports only composition.ts, handler.ts, and mail-catcher.ts (no Node imports in those), so the risk is confined to the published @​pegma/* packages' own internals, which I cannot read here. Either add compatibility_flags: ["nodejs_compat"] or add a workers-pool test that boots the worker entry.

🔵 Issue 14 — Mailpit port NaN not validated

recipes/bench-ticket/host.ts:27 · nit · identified by meta/muse-spark-1.2

BENCH_TICKET_MAIL_CATCHER=mailpit with a non-numeric MAILPIT_SMTP_PORT (e.g. typo 10x5) passes NaN to node:net.connect, producing a cryptic TypeError instead of a clear config error.

recipes/bench-ticket/host.ts:mailDelivery does Number.parseInt(process.env.MAILPIT_SMTP_PORT ?? '1025', 10) without isNaN check. smtpDialog then calls connect({host, port: NaN}).

Checked Blast radius: only Local Docker path; cloud runbooks use console catcher and avoid this. No validation helper like requiredEnv is used for the port.

Material proof gap: no unit test exercises env-var parsing.

🔵 Issue 15 — Base64 secret decoding uses global atob/btoa

recipes/bench-ticket/composition.ts:103 · nit · identified by meta/muse-spark-1.2

Using atob/btoa ties the composition to environments where those globals exist, while Buffer.from(..., 'base64') is the canonical Node API.

recipes/bench-ticket/composition.ts:decodeEmailCodeSecret calls atob(value) and handler.ts:mintSessionId calls btoa. In older Node toolchains or custom Workers builds without the global, this throws ReferenceError at runtime despite Buffer being available.

Checked: Node 22 does expose atob/btoa, so it works today, but host.ts already imports from node:* and could use Buffer. No polyfill is imported. Tests run under Vitest (jsdom/workerd) where atob exists, masking the portability risk.

This is low severity but worth normalizing to Buffer for Node hosts.

🔵 Issue 16 — origin validation rejects valid explicit default ports

recipes/bench-ticket/composition.ts:126 · nit · identified by meta/muse-spark-1.2

An operator who sets BENCH_TICKET_ORIGIN=https://bench-ticket.example.com:443 will get "origin is invalid" even though the origin is functionally identical.

composition.ts:originParts checks url.origin !== origin. new URL('https://example.com:443').origin normalizes to https://example.com, so the equality fails and createBenchTicketComposition throws. Runbooks say "no path, no slash" but never mention omitting default ports; users copying a browser URL with :443 will hit this.

Checked: Azure Container Apps and App Runner often emit FQDNs without port, so live impact is low, but the error is surprising. No test covers port-normalized origins.

Not falsified by any normalization step before comparison.

🔵 Issue 17 — Set-Cookie lost when forwarding multiple cookies in Node bridge

recipes/bench-ticket/host.ts:91 · nit · identified by meta/muse-spark-1.2

If a future response ever sets more than one cookie, the Node HTTP bridge will drop all but the last.

recipes/bench-ticket/host.ts:writeNodeResponse builds headers: Record<string,string> via response.headers.forEach((v,k)=>headers[k]=v). Fetch Headers combines duplicate set-cookie values only via forEach iteration that overwrites the key, and writeHead with a plain record cannot send duplicate Set-Cookie headers – Node requires headers['set-cookie'] as string[].

Currently only one set-cookie is ever sent (SESSION_COOKIE), so no live bug, but the bridge is fragile for evolution. Checked: no usage of response.headers.getSetCookie().

Risk is future regression when adding CSRF or additional cookies.

🔵 Issue 18 — Dockerfile ships entire repo context to image

recipes/bench-ticket/Dockerfile:5 · nit · identified by meta/muse-spark-1.2

The image build context is ../.. (repo root) and COPY . . copies everything not ignored, making builds slow and caching ineffective.

recipes/bench-ticket/Dockerfile with recipes/bench-ticket/docker-compose.yml context: ../.. sends the whole repository (including worker/, dist/, docs, runbooks) to the Docker daemon. .dockerignore mitigates some (node_modules, .git, dist, .wrangler), but not recipes/ siblings or src/.

Checked siblings: other fixtures don't provide Dockerfiles. No .dockerignore entry for recipes/* besides bench-ticket, so iterations on unrelated recipes invalidate the cache.

Cost is build time / image size, not correctness; narrow context or explicit COPY recipes/bench-ticket would be tighter.

🔵 Issue 19 — SMTP header injection hardening is partial for multiline values

recipes/bench-ticket/mail-smtp.ts:13 · nit · identified by meta/muse-spark-1.2

The SMTP path strips control characters but does not truncate or reject excessively long subject/from values that could overflow Mailpit lines.

recipes/bench-ticket/mail-smtp.ts:headerSafe replaces [\u0000-\u001F\u007F] with spaces, which does neutralize CRLF injection (\r/\n are in the range). However a 10KB subject (e.g. attacker-controlled email) will be emitted as a single SMTP header line without folding, which some MTAs reject.

Checked: composition.ts mail renderer puts the 8-digit code in the subject, so length is bounded for this demo, but headerSafe is generic for any request.mail.subject. No length guard or folding.

Severity is low for the demo; Mailpit tolerates long lines.

🔵 Issue 20 — Backlog doc still says "D1–D2 wait on publication" after D2 moved to P7

docs/catalog/RECIPE_BACKLOG.md:115 · nit · identified by z-ai/glm-5.3-flash

The closing line of docs/catalog/RECIPE_BACKLOG.md — "Ship P1 and P2 fixtures before declaring Phase 2 done. P3–P6 improve coverage; D1–D2 wait on publication." — is now wrong twice: D2 (support-queue-slice) no longer exists as a deferred entry (the PR moves it to green P7), and the P1–P6 enumeration omits the new P7. A reader (or agent) following the backlog doc is told the support-queue recipe is still deferred and unpublished, contradicting the new P7 section directly above and the compiled catalog's fixture.status: 'green'.

Fix: update the sentence to reference P7 (e.g. "P3–P7 improve coverage; D1 waits on a fixture").

What I checked: grep for D2 across the repo — this trailing sentence is the only remaining reference.

🔵 Issue 21 — Runbook heading says P7 but backlogPriority is 8

src/data/recipe-backlog.ts · nit · identified by z-ai/glm-5.3-flash

The new backlog section is headed "P7 — support-queue-slice" in docs/catalog/RECIPE_BACKLOG.md, but src/data/recipe-backlog.ts sets backlogPriority: 8, breaking the otherwise exact heading-to-priority mapping (P1→1, P2→2, P3→3, P4→4, P5→5, P6→6). An agent or maintainer cross-checking the doc against catalog.json sees P7 backed by backlogPriority: 8 and cannot tell which is authoritative; docs/catalog/RECIPE_BACKLOG.md's own "Priority order (ship fixtures in this order)" framing makes the number load-bearing.

Fix: either renumber the heading to P8 or set backlogPriority: 7 (one of the two).

What I checked: compile-catalog.test.ts only pins cf-passkey-accounts at 1, so tests do not enforce either value.

🔵 Issue 22 — GAP_INVENTORY.md still claims only P1–P2 quote recipe fixtures

docs/catalog/GAP_INVENTORY.md:48 · nit · identified by z-ai/glm-5.3-flash

docs/catalog/GAP_INVENTORY.md line 48 says /examples = "Recipe index + README snippets | P1–P2 quote recipes/ fixtures; P3+ still pending". This PR makes P7 (support-queue-slice) a third green, fixture-quoting recipe, so the gap inventory now understates coverage in a doc whose purpose is to be the accurate gap ledger; a reader planning the next fixture would wrongly conclude nothing between P3 and P7 is quotable.

Fix: update the row to reflect that P1, P2, P6 (scaffold), and P7 quote fixtures.

What I checked: docs/catalog/GAP_INVENTORY.md was not edited in the PR; the row predates this change and is now stale.

🔵 Issue 23 — AWS runbook's table guidance is self-contradictory ("one table for every collection, not one table per collection")

src/pages/runbooks/aws.md:57 · nit · identified by z-ai/glm-5.3-flash

src/pages/runbooks/aws.md (under "## 2. Default names") says: "Mirror Azure: one table for every collection, not one table per collection." Read literally, "one table for every collection" and "one table per collection" are the same statement, so the sentence instructs and forbids the same thing. An agent that parses the first clause (as the failure-signs row later invites: ResourceNotFoundException → "Recreate using pk HASH + sk RANGE") can end up creating per-collection tables — exactly the anti-pattern the runbook warns against and the single-table bench-ticket layout depends on.

Fix: reword to "one shared table for every collection" (mirroring the correct phrasing used in the table row and in azure.md).

What I checked: the same claim is phrased correctly in the resource-name table row directly above and in the Azure runbook's "every Storage Core collection shares one table".

🔵 Issue 24 — Demo error mapping collapses all SupportDeskLimitError cases into 413, diverging from the production mapping it mirrors

recipes/bench-ticket/handler.ts:242 · nit · identified by z-ai/glm-5.3-flash

handler.ts's mapError returns 413 { error: 'limit_exceeded' } for every SupportDeskLimitError, but the production mapping it is modeled on distinguishes payload limits from other limits: worker/src/support-desk.ts:126-131 returns 413 only when error.field === 'subject' | 'body' and 409 limit_exceeded otherwise. A demo user hitting a non-payload limit (e.g. an open-ticket or message-count limit) sees "413 payload too large" semantics for a request whose body is small — and the recipe is the artifact agents are told to copy for "host error mapping".

Fix: branch on error.field like worker/src/support-desk.ts does.

What I checked: the production mapSupportError mapping and the demo's handler; both map SupportDeskAuthorizationError/NotFound/Conflict identically, so only the limit branch diverges.

🔵 Issue 25 — Malformed percent-encoding in cookies or ticket ids surfaces as 500 internal_error instead of 4xx

recipes/bench-ticket/handler.ts · nit · identified by z-ai/glm-5.3-flash

parseCookies runs decodeURIComponent(value) on every cookie value, and GET /api/tickets/:id runs decodeURIComponent(ticketMatch[1]) on the raw path segment. Both throw URIError on input like % or %zz, which the outer try/catch in handleBenchTicketRequest funnels to mapError → 500 { error: 'internal_error' }. A request with Cookie: bench_ticket_session=% or GET /api/tickets/% returns 500 (and logs nothing useful), where the correct answers are a clean 401/404; a health/probe or fuzzer hitting the demo shows phantom 500s.

Fix: wrap the decodeURIComponent calls in try/catch and treat decode failure as absent session / unmatched ticket.

What I checked: the outer catch in handleBenchTicketRequest only special-cases SyntaxError; every other non-mapped error becomes 500.

🔵 Issue 26 — SMTP provider does not dot-stuff the DATA payload, so a leading-dot line truncates the message

recipes/bench-ticket/mail-smtp.ts:98 · nit · identified by z-ai/glm-5.3-flash

mail-smtp.ts builds the DATA payload as ${body}\r\n. without escaping lines that begin with . (RFC 5321 dot-stuffing). If any line of the rendered mail starts with a ., Mailpit ends the message at that point — the code/expiry text after it is dropped and the raw \r\n. sequence can leak into the body. The demo's renderer text ("Your Bench Ticket code is …\n\nIt expires at …") does not start lines with . today, so the fixture tests cannot catch this, but the provider is presented as the reusable Mailpit adapter and any future renderer content (e.g. a footer or a quoted line starting with .) silently truncates mail that the runbook's round-trip depends on.

Fix: dot-stuff each body line (line.replace(/^\./gm, '..')) before joining, matching standard SMTP client behavior.

What I checked: mail-smtp.ts send() body construction and smtpDialog; no dot-stuffing exists anywhere in the file.

🔵 Issue 27 — pnpm demo:bench-ticket fails immediately with no documentation of what it needs

recipes/bench-ticket/host.ts · nit · identified by z-ai/glm-5.3-flash

package.json adds "demo:bench-ticket": "tsx recipes/bench-ticket/host.ts", but host.ts calls requiredEnv('BENCH_TICKET_EMAIL_CODE_SECRET_BASE64'), so running the script bare exits immediately with BENCH_TICKET_EMAIL_CODE_SECRET_BASE64 is required — and even with a secret set, the mail path defaults to Mailpit SMTP at 127.0.0.1:1025, so every POST /api/auth/begin fails with Mailpit SMTP timed out unless the developer also starts Mailpit and sets BENCH_TICKET_MAIL_CATCHER=console (or SMTP env). No runbook or README mentions the script; the documented path is docker compose. A developer who tries the obvious one-liner gets a hard error with no pointer to docker compose -f recipes/bench-ticket/docker-compose.yml up --build.

Fix: either document the required env in the script's recipe README, or make the script fail with a message that names the compose command.

What I checked: host.ts's requiredEnv and mailDelivery() defaults; the runbooks and recipes/bench-ticket/README.md never mention demo:bench-ticket.

🔵 Issue 28 — Recipe capabilityTags claim rate_limit_memory but the email-code limiters are the durable tier

src/data/recipe-backlog.ts:228 · nit · identified by z-ai/glm-5.3-flash

support-queue-slice tags rate_limit_memory but not rate_limit_durable, yet the composition wires the email-code request/verification limiters with createDurableLimiter over the injected Store (composition.ts, bench-ticket-email-code-request/-verification), which the PR body itself headlines ("Rate-limit for email codes is the durable limiter over the injected Store"). The tags drive plan_composition, so an agent asking for ['email_codes', 'rate_limit_durable'] — the honest tag pair for "email-code login with durable limits on the code paths" — gets no match on this recipe (and the EXCLUSIVE_TAGS gate skips it as incidental), while the tag that is present describes the passkey limiters the demo explicitly does not use.

Fix: add rate_limit_durable to the recipe's capabilityTags (or, if memory-only was intended, remove rate_limit_memory — but the durable limiters are the ones on the login path).

What I checked: src/data/recipe-backlog.ts capabilityTags for the recipe; recipes/bench-ticket/composition.ts limiter wiring; the EXCLUSIVE_TAGS logic in src/data/mcp-tools.ts.

🔵 Issue 29 — Runbooks assert factory/option names for packages nothing in the repo executes or verifies

src/pages/runbooks/aws.md:88 · nit · identified by z-ai/glm-5.3-flash

The runbooks quote TypeScript snippets as ready-to-paste wiring for packages with no in-repo caller and (for one) no published existence: createDynamoDbStore({ client, tableName, createTableIfMissing: false }) and "createTableIfMissing defaults to true" (AWS, adapter not on npm — storage-core#7 unmerged), createAzureTablesStore({ client, createTableIfMissing: false }) (Azure), and createS3BlobStore({ client, bucket, endpoint, maxObjectBytes }) (AWS). If the real factory names or option names differ, an agent one-shotting these runbooks gets a compile/type error at exactly the step the runbook claims is mechanical, and the invented snippet contradicts AGENTS.md's examples rule ("an example that was never executed is documentation that lies") — a rule the site's own pages repeat verbatim.

Concrete cost: the Azure/AWS store-swap steps fail with a module/type error that the runbooks present as copy-paste, and the AWS case additionally cannot be true yet (@​pegma/storage-dynamodb is explicitly not on npm).

What I checked: grep for createAzureTablesStore, createS3BlobStore, createDynamoDbStore, createTableIfMissing — no hits outside the new runbook prose; @​pegma/storage-azure-tables is not even a dependency in package.json, so nothing type-checks these snippets. The AWS runbook partially self-corrects ("If the published factory options differ, copy them from that package's README"), but the snippets are still presented as the default shape.

Workflow run

Render ticket subjects with DOM text nodes, treat undecodable cookies and
ticket ids as 4xx, cache the Cloudflare composition on origin plus secret, and
join Cookie headers with semicolons.

Co-authored-by: Fly Over Coder <FlyOverCoder@gmail.com>
@cursor

cursor Bot commented Sep 11, 2026

Copy link
Copy Markdown

Triage of the OpenRouter review (pinned to 3e3ca21; head is now 306cb1a). There were no inline review threads to resolve — findings lived in the review body.

Fixed

  1. Stored XSS: ticket queue now uses textContent / createTextNode / dataset instead of concatenating row.subject into innerHTML.
  2. Malformed cookie (%ZZ) → 401, not 500. Same for undecodable ticket ids (400).
  3. Cloudflare composition cache key is origin + email-code secret, so wrangler secret put is picked up without an origin change.
  4. Node Cookie arrays join with ; , not , .
    5–6. Eval prompt-set + EVAL_NPM pins were already on d868547 (still present).

Dismissed (noisy / not must-fix)

  1. Local Docker “Docker and nothing else” vs node -e (runbook wording).
  2. Shared 'local' rate-limit key on Node hosts.
    9–10. Sync mail drain / Mailpit service_started race.
  3. Duplicate of issue 1.
  4. Recipe vs production worker API shapes (tsc already passes).
  5. Missing nodejs_compat (recipe Worker does not import node:*).
    14–29. Nits (port NaN, atob, default-port origin, Set-Cookie overwrite, Docker context, SMTP length, backlog P7 vs 8, GAP_INVENTORY, AWS table wording, 413 vs 409, SMTP dot-stuffing, demo:bench-ticket env, capability tags, unverified Azure/AWS factory snippets).

Not merged. Still draft.

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OpenRouter pull-request review

Verdict: partial
Scope: full-pr (full-pr)
Mode: initial
Commit: d868547f8e9162c964c7702693650937a06a9ea5
Judge: skipped (one successful review lane; no merge needed)
Cost: $0.66 + at least $0.0596 (incomplete)

Lanes

  • meta/muse-spark-1.2: ok (15 finding(s), 78.9s, 527179+13215 tokens (48881 cached), 6 tool round(s), via Meta, $0.66)
  • z-ai/glm-5.3-flash: failed-open (at least $0.0596 spent, incomplete) — OpenRouter lane request budget exhausted before retry; lane transport history (includes recovered errors): transport_timeouts=2, elapsed_deadlines=2

Warning

The PR head advanced after this review's diff was collected. This review is pinned to commit d868547 and does not cover the newest push.

Warning

meta/muse-spark-1.2: coverage claims 4 finding(s) in 'recipes/bench-ticket/handler.ts' but 5 were reported

Findings

🔴 Issue 1 — Cloudflare Worker caches composition by origin only, ignores secret and D1 binding rotation

recipes/bench-ticket/cloudflare/worker.ts:20 · bug · identified by meta/muse-spark-1.2

After deploying a new BENCH_TICKET_EMAIL_CODE_SECRET_BASE64 or rebuilding the D1 database with the same BENCH_TICKET_ORIGIN, compositionFor(env) returns the stale cached composition with the old HMAC key and old createCloudflareD1Store({database: oldDb}). Email-code verification then fails with verification_failed or reads stale storage, with no restart required to trigger the bug.

Evidence: recipes/bench-ticket/cloudflare/worker.ts caches cached and cachedOrigin and only checks cachedOrigin === env.BENCH_TICKET_ORIGIN. It never compares BENCH_TICKET_EMAIL_CODE_SECRET_BASE64 or BENCH_TICKET_DB identity.

Checked that isMainModule guard does not apply to Workers; global persists across isolate reuse per Cloudflare docs. No test covers secret rotation.

🔴 Issue 2 — Mail begin drains outbox synchronously and turns mail failure into spurious 500 after account creation

recipes/bench-ticket/handler.ts:235 · bug · identified by meta/muse-spark-1.2

If Mailpit is down, smtpDialog times out after 8s or returns 4xx, drainMail() throws, and POST /api/auth/begin returns 500 even though composition.identity.beginAccountCreation already wrote the code record and consumed the rate-limit bucket. The client sees internal_error but a retry is rate-limited, and the code is orphaned; the UI shows no handle.

Evidence: handler.ts handleBenchTicketRequest for POST /api/auth/begin does await composition.identity.beginAccountCreation(...); await drainMail(composition); return json(200, ...). mail-smtp.ts smtpDialog rejects on code>=400 or timeout. No try/catch around drainMail separates identity success from mail delivery.

Checked composition.test.ts which drains via mailWorker.runSendPage explicitly in test, and handler.test.ts which expects mail.sent.length>0 on success — no test for mail failure path. No fallback to async outbox drain.

🔴 Issue 3 — Stored XSS via unsanitized ticket fields in handler page

recipes/bench-ticket/handler.ts:60 · bug · identified by meta/muse-spark-1.2

A signed-in user can file a ticket with subject: "<img src=x onerror=alert(1)>" or subject: "</strong><script>alert(document.cookie)</script>". The browser page in handler.ts renders the queue with el.innerHTML = '<strong>#'+row.number+'</strong> '+row.subject + … and root.innerHTML = '' loop. No escaping is applied, so the attacker-supplied HTML executes in every other viewer's session that lists tickets.

Evidence: recipes/bench-ticket/handler.ts PAGE_HTML script refresh() builds tickets via el.innerHTML concatenating row.subject, row.status, row.id directly. row.subject and row.body originate from createCustomerTicket input (String(body.subject ?? '')) with no sanitization, and Support Desk stores them verbatim.

Checked: no sanitization helper in handler.ts, no textContent usage, and the Cypress-style handler.test.ts only asserts subject equality, not escaping. Falsification gap: none — innerHTML concatenation is present in current checkout.

🟠 Issue 4 — Production Docker image transpiles at runtime with tsx and runs as root

recipes/bench-ticket/Dockerfile:1 · risk · identified by meta/muse-spark-1.2

The image built from recipes/bench-ticket/Dockerfile runs pnpm exec tsx recipes/bench-ticket/host.ts with NODE_ENV=production. tsx is a devDependency, so a --prod install or future prune would break startup, and runtime transpilation hides type errors, increases cold start, and leaves node_modules with dev tooling in a root-owned container. An attacker exploiting the XSS/RCE path above inherits root in the container.

Evidence: Dockerfile RUN pnpm install --frozen-lockfile then ENV NODE_ENV=production then CMD ["pnpm", "exec", "tsx", ...]. package.json lists tsx under devDependencies. No USER directive, no multi-stage build, no pnpm run build compile step.

Checked .dockerignore does not exclude recipes/, so full repo is copied; COPY package.json pnpm-lock.yaml ./ then COPY . . also duplicates layers. No CI check enforces non-root.

🟠 Issue 5 — R2 bucket provisioned in wrangler.jsonc and runbooks but never wired to composition

recipes/bench-ticket/cloudflare/wrangler.jsonc:8 · risk · identified by meta/muse-spark-1.2

The wrangler.jsonc declares an r2_buckets binding BENCH_TICKET_BLOBS and all three cloud runbooks instruct wrangler r2 bucket create bench-ticket-blobs / az storage container create / aws s3api create-bucket, yet composition.ts and cloudflare/worker.ts never import @​pegma/storage-blobs or call createS3BlobStore/createR2Store. Users incur a bucket/ container cost and the Worker holds an unused binding, while the claim that the demo exercises Storage Core blobs is false — the health check only pings the record store.

Evidence: composition.ts imports only Store, health, identity, sessions, support-desk; no blob store. worker.ts only creates createCloudflareD1Store. wrangler.jsonc line 9-16 defines R2. runbooks/cloudflare.md step 3 says provision R2 even though demo does not store attachments.

Checked package.json does not depend on @​pegma/storage-s3 etc for bench-ticket; aws.md even shows optional blob snippet as future code, not wired. Docs and infra drift from code.

🟠 Issue 6 — Base64 secret validation rejects valid unpadded secrets and relies on atob

recipes/bench-ticket/composition.ts:108 · risk · identified by meta/muse-spark-1.2

A secret generated with Buffer.from(bytes).toString('base64') stripped of = padding (43 chars for 32 bytes) or with URL-safe -_ will be rejected by decodeEmailCodeSecret because it requires 44–172 chars and /^[A-Za-z0-9+/]+={0,2}$/. Operators following Node docs that trim padding will see missing or invalid on startup despite a 32-byte secret. Also atob is used in both Node and Workers; atob is not guaranteed in all Node versions and throws differently per runtime.

Evidence: composition.ts decodeEmailCodeSecret length check value.length <44 and regex ^[A-Za-z0-9+/]+={0,2}$, then atob(value). host.ts requiredEnv generates secret via crypto.randomBytes(32).toString('base64') which includes padding, but runbooks tell users to generate via node -e "...toString('base64')" without noting padding requirement.

Checked tests use btoa(String.fromCharCode(...fill(11))) which produces padded output; no test for unpadded input. Safer is Buffer.from(value,'base64') with explicit byte-length check.

🟠 Issue 7 — Hard-coded local demo HMAC secret committed to repository

recipes/bench-ticket/docker-compose.yml:14 · risk · identified by meta/muse-spark-1.2

The repository ships a real 32-byte HMAC secret CwsLCwsLCwsLCwsLCwsLCwsLCwsLCwsLCwsLCwsLCws= in docker-compose.yml and documents it as 32 bytes of 0x0b, base64. Local demo only. Because it is in git history, any deployment that accidentally reuses the compose file verbatim (e.g., copying to Azure/AWS runbook) will share the same email-code HMAC key across environments, allowing code forgery if the secret leaks to logs or runbooks/aws.md generation script echoes it.

Evidence: recipes/bench-ticket/docker-compose.yml BENCH_TICKET_EMAIL_CODE_SECRET_BASE64: CwsLCws... and composition.test.ts TEST_SECRET = btoa(String.fromCharCode(...fill(11))) identical. .dockerignore excludes .env but not docker-compose.yml.

Checked README.md and runbooks explicitly say never reuse in cloud deploy, but nothing prevents docker build with that value pushed to a registry; git history retains it. Prefer generating at compose-up time or via .env not in VCS.

🟠 Issue 8 — All local clients share one rate-limit bucket and no CSRF protection

recipes/bench-ticket/handler.ts:199 · risk · identified by meta/muse-spark-1.2

On Docker and local dev, POST /api/auth/begin and POST /api/auth/finish use rateLimitKey = request.headers.get('cf-connecting-ip') ?? 'local'. Without Cloudflare, every localhost client collides on 'local', so one user's 10 beginAccountCreation attempts in 10 minutes blocks every other laptop user with 429. Combined with SameSite=Lax cookies and no CSRF token, a cross-site POST can also trigger authenticated POST /api/tickets from a malicious page if the victim is already signed in and navigates top-level.

Evidence: handler.ts rateLimitKey fallback to 'local' in both begin and finish. No X-Forwarded-For or X-Real-IP handling, no per-session or per-email rate-limit key. Code comment says CSRF not copied intentionally, but runbooks don't warn that copy-paste to production is unsafe.

Checked composition.ts defines durable limiters over store with limit 10/10m for request and 20/10m for verification — durable, but keyed by caller-supplied string. No test simulates two IPs behind same fallback.

🟠 Issue 9 — Cookie parsing with decodeURIComponent can throw and become 500

recipes/bench-ticket/handler.ts:155 · risk · identified by meta/muse-spark-1.2

A request with Cookie: bench_ticket_session=%zz or any malformed percent-encoding makes decodeURIComponent(value) in parseCookies throw URIError. That error propagates to handleBenchTicketRequest and is mapped via mapError to 500 internal_error rather than a clean 401, leaking internal error semantics and potentially crashing currentPrincipal before session lookup. Same applies to decodeURIComponent(ticketMatch[1]) for ticket IDs with bad encoding.

Evidence: handler.ts parseCookies does decodeURIComponent(value) without try/catch, called from currentPrincipal and signout. handleBenchTicketRequest catches SyntaxError only, then mapError defaults to 500.

Checked no existing test sends malformed cookies; handler.test.ts only uses well-formed cookies from cookieFrom. No guard in list_dir sibling code.

🟠 Issue 10 — Missing input size limits and attribute injection in ticket reply selector

recipes/bench-ticket/handler.ts:268 · risk · identified by meta/muse-spark-1.2

A client can POST {"subject":"a".repeat(100000),"body":"b".repeat(1000000)} to /api/tickets. handler.ts casts to String(body.subject ?? '') with no length check and passes to createCustomerTicket; the underlying Storage Core write will persist arbitrarily large ticket bodies, allowing a single user to fill the local Docker memory store or D1 quota. Separately, the client script does root.querySelector('[data-reply="'+send+'"]') where send is data-send from row.id. If row.id contains " or ] it breaks the selector and can cause querySelector to throw, aborting refresh() for all tickets.

Evidence: handler.ts POST /api/tickets and POST /api/tickets/:id/replies use String(body.subject ?? '') / String(body.body ?? '') without trim or maxLength. PAGE_HTML el.innerHTML line also builds data-reply and data-send via string concatenation.

Checked composition.ts BENCH_TICKET_CATEGORIES limits categories but not subject/body lengths; SupportDeskLimitError is mapped to 413 but only for package-internal limits, not handler pre-validation. No test sends oversized payload.

🟠 Issue 11 — Node HTTP adapter forwards Hop-by-Hop headers and drops duplicate Set-Cookie

recipes/bench-ticket/host.ts:63 · risk · identified by meta/muse-spark-1.2

In production, a response that ever needs two Set-Cookie headers (e.g., future refresh + session) will lose one because host.ts writeNodeResponse does response.headers.forEach((value,key)=>headers[key]=value) which collapses duplicates into a single string, and res.writeHead(status, headers) only sends the last value. Also requestFromNode blindly copies host, content-length, transfer-encoding into a new Request, which can cause fetch to send conflicting length headers or preserve forwarded connection: close that changes keep-alive behavior.

Evidence: host.ts writeNodeResponse header collection loop, and requestFromNode for (const [name,value] of Object.entries(req.headers)) headers.set(name, ...). No filtering of connection, content-length.

Checked handler.ts currently only sets one set-cookie, so not triggered today, but adding a second cookie would silently break logout. Same bug in Cloudflare path would be masked. Port parsing Number.parseInt(process.env.PORT ?? '8787',10) is unchecked for NaN.

🟠 Issue 12 — SMTP catcher does not handle send() after close and uses unsanitized port NaN

recipes/bench-ticket/mail-smtp.ts:29 · risk · identified by meta/muse-spark-1.2

If MAILPIT_SMTP_PORT is missing or non-numeric, Number.parseInt(...,10) yields NaN, connect({host, port:NaN}) throws synchronously but smtpDialog wraps only async errors, so the promise may hang until the 8s timeout instead of failing fast with a clear 500. Also createMailpitSmtpProvider builds Message-ID from idempotencyKey.replace(/[^A-Za-z0-9._-]/g,'') which could become empty if the key is all symbols, producing <@​bench-ticket.local> and a 501 from Mailpit that surfaces as generic Mailpit SMTP error with no retry guidance.

Evidence: host.ts mailDelivery() port: Number.parseInt(process.env.MAILPIT_SMTP_PORT ?? '1025',10) and mail-smtp.ts smtpDialog connect({host,port}) with timer 8s, socket.setEncoding('utf8'), pending = [...lines].

Checked no validation for isNaN(port) or from emptiness; handler.ts drainMail would then return 500 on every begin when Mailpit is down, as noted in separate finding.

🟠 Issue 13 — Component enrichment adds @​pegma/storage-dynamodb before it is published

src/data/catalog-enrichment.ts:54 · risk · identified by meta/muse-spark-1.2

Marking the dynamodb adapter as present in catalog-enrichment.ts while the AWS runbook admits Not yet on npm means catalog.json will advertise component.adapters[].packageName = @​pegma/storage-dynamodb with no version, and compile-catalog.test.ts expects expect.arrayContaining(['dynamodb']) to pass. An agent fetching catalog.json before storage-core#7 merges will see the adapter, try pnpm add @​pegma/storage-dynamodb, and get 404. The eval's EVAL_NPM map does not include the dynamodb package either, so the AWS path is not covered by test:d1.

Evidence: catalog-enrichment.ts adds id:'dynamodb', packageName:'@​pegma/storage-dynamodb', when:'Requires pegma-dev/storage-core#7 to be merged; ... Not yet on npm.' and compile-catalog.test.ts asserts adapters contain dynamodb. runbooks/aws.md says pnpm add @​pegma/storage-dynamodb will 404 until PR merged.

Checked package.json does not depend on @​pegma/storage-dynamodb, so pnpm install succeeds but catalog advertises unpublished adapter — violates the unpublished-packages-are-unusable rule for production assembly.

🔵 Issue 14 — Recipe backlog docs out of sync with code pins

docs/catalog/RECIPE_BACKLOG.md:92 · nit · identified by meta/muse-spark-1.2

The table for P7 support-queue-slice in docs/catalog/RECIPE_BACKLOG.md lists Packages (published) without authorization-core and requiresPublished without authorization-core in the prior diff context, while src/data/recipe-backlog.ts now requires authorization-core and pins @​pegma/authorization-core@​0.4.0. An agent reading the markdown table will miss the required package and install an incomplete set, and the site's /examples excerpt will still compile but the markdown citation will be incomplete.

Evidence: RECIPE_BACKLOG.md P7 row shows Packages (published) @​pegma/identity, @​pegma/sessions, @​pegma/mail, @​pegma/rate-limit, @​pegma/health, @​pegma/support-desk-*, @​pegma/storage-core, @​pegma/spine — no authorization-core. recipe-backlog.ts packages: ['@​pegma/identity@​0.1.2', ..., '@​pegma/authorization-core@​0.4.0', ...] includes it.

Checked catalog-enrichment.ts for support-desk dependencies does list authorization-core: requires, so catalog build will expect it. Docs drift is nit but breaks the content rule that markdown is source of truth.

🔵 Issue 15 — Dockerfile layer cache invalidation and pnpm-lock churn

recipes/bench-ticket/Dockerfile:4 · nit · identified by meta/muse-spark-1.2

The Dockerfile does COPY package.json pnpm-lock.yaml ./ then COPY . . without a .dockerignore exclusion for pnpm-lock.yaml diff noise. Any pnpm-lock.yaml change from adding tsx invalidates the cached pnpm install layer for all builds, increasing CI time. More importantly, the image copies the entire repo (COPY . .) including evals/, worker/, and .git history (though .git is dockerignored, coverage etc may still leak), bloating the bench-ticket image from ~200MB to ~600MB and slowing docker push in Azure/AWS runbooks.

Evidence: Dockerfile lines 4-7, .dockerignore lists node_modules .git .astro dist coverage .wrangler but not evals or worker. pnpm-lock.yaml diff shows snapshot churn for vite with new tsx peer.

Checked runbooks show docker build -f recipes/bench-ticket/Dockerfile -t ... from repo root with context ../.., so bloat affects every cloud deploy even though runtime only needs recipes/bench-ticket/* and package.json.

Workflow run

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OpenRouter pull-request review

Verdict: issues
Scope: full-pr (full-pr)
Mode: initial
Commit: 306cb1a4178d551ffbdef3113b846a593d8b1612
Judge: openai/gpt-5.6-luna (schema fallback: deterministic union)
Cost: $0.5996 (lanes $0.5940 + judge $0.0055) + at least $0.0977 (incomplete)

Lanes

  • meta/muse-spark-1.2: ok (13 finding(s), 70.8s, 520401+12516 tokens (99682 cached), 7 tool round(s), via Meta, $0.59)
  • z-ai/glm-5.3-flash: ok (20 finding(s), 1062.0s, 1287061+59304 tokens (1023040 cached), 15 tool round(s), 1 retried request(s), salvaged finish, via Together, at least $0.0977 (incomplete))

Findings

🔴 Issue 1 — Shared rate-limit key local on non-Cloudflare hosts

recipes/bench-ticket/handler.ts:294 · bug · identified by meta/muse-spark-1.2

Every Local Docker / Azure / AWS request shares one global Identity rate-limit bucket, so one user or attacker exhausts the 10 req/10 min email-code limit for everyone.

handler.ts does request.headers.get('cf-connecting-ip') ?? 'local' for both begin and finish. Outside Cloudflare the header is absent, so rateLimitKey is the literal local. composition.ts wires createDurableLimiter(..., store) over the injected Store, so the counter is durable and global. In a real deployment all users collide; an attacker can pre-fill the bucket and deny service, or a burst of legitimate signups self-DoS.

Checked recipes/bench-ticket/handler.ts:289/302 and composition.ts:230/239 durable limiters. No fallback to x-forwarded-for/x-real-ip or request.socket.remoteAddress via host.ts. Falsified alternative: Cloudflare path works (workers set cf-connecting-ip), but Node path host.ts:requestFromNode forwards headers unchanged and never synthesizes a per-client key.

🔴 Issue 2 — Successful begin masked as 500 when mail catcher fails

recipes/bench-ticket/handler.ts:297 · bug · identified by meta/muse-spark-1.2

If the mail provider/SMTP is down, POST /api/auth/begin returns 500 even though Identity has already enqueued the code in the Storage Core outbox. The user sees failure and retries, enqueuing duplicate jobs while the first code is still valid.

handler.ts:295 calls await drainMail(composition) immediately after beginAccountCreation/beginEmailSignIn. drainMail is runSendPage({limit:20}) which calls the MailProvider.send. mail-smtp.ts:smtpDialog rejects on SMTP 4xx/5xx or 8s timeout, which bubbles to handleBenchTicketRequest's catch → mapError → 500. The outbox row remains; a retry or background worker would deliver it.

Checked handler.ts:304 and mail-smtp.ts:30/58. No try/catch around drainMail to degrade to 200 + log. Existing handler.test.ts stubs provider to always succeed, so failure path is uncovered.

🔴 Issue 3 — SMTP port NaN not validated before net.connect

recipes/bench-ticket/host.ts:39 · bug · identified by meta/muse-spark-1.2

Setting MAILPIT_SMTP_PORT=notanumber makes begin fail with an opaque SMTP timeout instead of a clear startup/config error.

host.ts:39 does Number.parseInt(process.env.MAILPIT_SMTP_PORT ?? '1025', 10) without isNaN check, passing NaN to createMailpitSmtpProvider → mail-smtp.ts:19 → connect({host, port: NaN}). Node treats NaN as 0 or throws depending on version, leading to ECONNREFUSED or 8s Mailpit SMTP timed out. Same for empty MAILPIT_SMTP_HOST.

Checked host.ts:38 and mail-smtp.ts:23. No early throw from requiredEnv-style validation. composition.test.ts never exercises SMTP config.

🔴 Issue 4 — Bench Ticket HTTP host does not map SupportDeskQueueCapacityError — a queue-capacity throw surfaces as HTTP 500 internal_error

recipes/bench-ticket/handler.ts:236 · bug · identified by z-ai/glm-5.3-flash

A customer (or an agent following the runbook curl sequence) that trips the Support Desk queue capacity limit gets { error: 'internal_error' } with status 500 instead of a client-facing 4xx, and the runbooks' failure-sign tables have no row for it.

@​pegma/support-desk-application@​0.1.1 exports SupportDeskQueueCapacityError — the production consumer maps it explicitly in worker/src/support-desk.ts:22,123 alongside the other four classes. recipes/bench-ticket/handler.ts mapError imports and maps only SupportDeskAuthorizationError, SupportDeskNotFoundError, SupportDeskConflictError, and SupportDeskLimitError; a QueueCapacityError falls through the instanceof chain to the final json(500, { error: 'internal_error' }).

Reachability depends on the application's internal capacity defaults (the fixture sets no queueTerminalRetentionMilliseconds and no capacity options), which I cannot verify from this checkout — but the same-version worker maps the class, so the demo's 500-instead-of-4xx path is one exhausted queue away, and the demo host is the code agents are told to copy.

🟠 Issue 5 — Node adapter loses multi-Set-Cookie via Headers.forEach

recipes/bench-ticket/host.ts:63 · risk · identified by meta/muse-spark-1.2

Future responses that set more than one Set-Cookie will be corrupted in Local Docker/Azure/AWS because the Node bridge joins them with ", " which browsers treat as a single invalid cookie.

host.ts:writeNodeResponse does response.headers.forEach((value,key)=>headers[key]=value) then res.writeHead(status, headers). The Fetch Headers spec requires getSetCookie() for multiple Set-Cookie values; forEach concatenates with , . Currently the handler sets at most one set-cookie (session or clear), so it works today, but the pattern is a latent bug and diverges from Cloudflare Workers which preserve multiple values.

Checked host.ts:63 and handler.ts:195/199 cookie helpers. Verified no current caller sends two cookies, but pnpm check would not catch this semantic loss.

🟠 Issue 6 — Cloudflare Worker composition cache ignores BENCH_TICKET_DB identity

recipes/bench-ticket/cloudflare/worker.ts:32 · risk · identified by meta/muse-spark-1.2

Rotating or swapping the D1 binding without changing origin/secret reuses a Store pointed at the old database, so writes go to the wrong table and health.status lies.

cloudflare/worker.ts:32 caches by ${origin}\n${secret} only. cached holds the Store created via createCloudflareD1Store({database: env.BENCH_TICKET_DB}). If Miniflare tests or a deployment swaps BENCH_TICKET_DB while reusing the isolate, compositionFor returns the previous isolate's store. Health will report storage: ok against the old DB while the new DB is empty.

Checked worker.ts:22 key function and 24-41 factory. No inclusion of env.BENCH_TICKET_DB object identity or database binding name. Accepted risk in prod (bindings immutable per deploy) but breaks tests and hot-swap.

🟠 Issue 7 — Mailpit SMTP DATA missing dot-stuffing and adds extra blank line

recipes/bench-ticket/mail-smtp.ts:85 · risk · identified by meta/muse-spark-1.2

A mail body containing a line starting with . would truncate the SMTP transaction at \r\n.\r\n, and the current DATA payload always inserts an extra empty line before the terminating dot.

mail-smtp.ts:84 builds body ending in \r\n, then sends `${body}\r\n.` via smtpDialog. After socket.write adds \r\n, the wire is text\r\n\r\n.\r\n (blank line before dot). More importantly, no body.replace(/^\./gm, '..') dot-stuffing is performed. Today the bench-ticket renderer emits Your Bench Ticket code is ... with no leading dots, so not triggered, but a future renderer or user-controlled subject could inject a dot-line and abort delivery, causing begin to 500.

Checked mail-smtp.ts:81 body construction and mail-catcher.ts renderer. headerSafe strips \r/\n from headers but not from body lines.

🟠 Issue 8 — Hard-coded weak email-code secret committed in repo

recipes/bench-ticket/docker-compose.yml:14 · risk · identified by meta/muse-spark-1.2

Local docker-compose.yml ships with a static 32×0x0b secret (CwsLC...) that is trivially guessable if copied to a cloud deploy, allowing an attacker to forge email-code HMACs and bypass account verification.

docker-compose.yml:14 and handler.ts:206 enforce 32-128 byte base64 secrets, but the compose file comments "Local demo only — never reuse in a cloud deploy" without enforcement. Runbooks for Cloudflare/Azure/AWS correctly generate a fresh secret via randomBytes(32), but nothing prevents docker-compose.yml being used as template for prod. Secret is also visible in history.

Checked docker-compose.yml:14, composition.ts:89 length checks, and runbooks azure.md:81, aws.md:124. This is intentional for one-shot local dev, but warrants a lint or if (origin.startsWith('https:') && secret === demoSecret) throw guard.

🟠 Issue 9 — http origin allowed for any hostname, not just localhost

recipes/bench-ticket/composition.ts:124 · risk · identified by meta/muse-spark-1.2

A production deploy mis-configured to http://bench.example.com would start and set non-Secure cookies over plaintext, leaking bench_ticket_session on the wire.

composition.ts:124 comment says "HTTP is allowed only for local development hostnames" but originParts only checks new URL(origin).origin === origin. It does not enforce that http: origins must be localhost, 127.0.0.1, or *.localhost. handler.ts:sessionCookie sets Secure only when origin.startsWith('https:'), so an http:// prod origin yields SameSite=Lax without Secure.

Checked composition.ts:124 and handler.ts:193. No test covers http://evil.com being rejected. Add if (url.protocol === 'http:' && !/^(localhost|127\.0\.0\.1|.*\.localhost)$/.test(hostname)) throw or document risk explicitly.

🟠 Issue 10 — Node host trusts absolute req.url over configured origin

recipes/bench-ticket/host.ts:42 · risk · identified by meta/muse-spark-1.2

An attacker sending GET http://evil.com/api/me HTTP/1.1 could control the Request.url origin parsed by the handler, potentially bypassing origin-based checks or polluting logs, and a malformed URL triggers an unhandled 500 instead of 400.

host.ts:42 does new URL(req.url ?? '/', origin) as base. If req.url is absolute, origin is ignored (per WHATWG URL). handler.ts:254 then does new URL(request.url) and uses pathname only, so routing still works, but request.url now reflects evil.com. More importantly, new URL throws TypeError for inputs like http://[::1 which requestFromNode does not catch; the server's .catch in host.ts:121 converts it to 500 internal_error rather than 400.

Checked host.ts:42 and handler.ts:254. No validation that req.url is origin-relative before constructing Request.

🟠 Issue 11 — Missing request body size limit in readJson

recipes/bench-ticket/handler.ts:260 · risk · identified by meta/muse-spark-1.2

A large JSON body (e.g. 100 MB subject/body) is buffered fully in memory before parsing, allowing a single unauthenticated POST /api/tickets to OOM the Worker/Node process.

handler.ts:260 does await request.text() with no Content-Length or byte cap, then JSON.parse. Support Desk limits (SupportDeskLimitError → 413) are checked only after parsing and inside the transaction. An attacker can send {"subject":"x".repeat(50<<20)} and force the isolate to allocate tens of MB per request.

Checked handler.ts:260 and composition.ts:240 allowed categories but no payload cap. No Content-Length guard in host.ts:requestFromNode either. Add 64-128 KiB limit for bench-ticket JSON.

🟠 Issue 12 — New fixture calls @​pegma APIs that no other repo code exercises, so a drift breaks CI and the "CI-tested / green" claims

recipes/bench-ticket/composition.ts:36 · risk · identified by z-ai/glm-5.3-flash

If any of the export names or signatures below do not exist in the pinned published packages, pnpm run check (which typechecks recipes/tsconfig.json) and pnpm test both fail, and the claims shipped in this PR — fixture.status: 'green' in src/data/recipe-backlog.ts, the "Fixture | green" row in docs/catalog/RECIPE_BACKLOG.md, the "CI-tested fixture" wording in recipes/README.md and the runbook pages — become false, because the fixture is the only consumer of these APIs in the whole repo.

Instances I could not corroborate anywhere else in the repository (grep across worker/src, recipes/, docs/, public/ found no other usage):

  • createMemoryLimiter from @​pegma/rate-limit (recipes/bench-ticket/composition.ts:36, called at lines 212 and 220). The production worker and the Northshelf fixture only ever use createDurableLimiter; the memory-tier factory name and its { clock } second argument appear nowhere else.
  • createStorePingCheck and healthProbeCollection from @​pegma/health (composition.ts:18-19, used at lines 289-291). The production worker's health route uses only createProcessCheck / runHealthChecks / toHealthResponse, and probes its support store ad hoc via store.collection(...).get(...) (worker/src/support-desk.ts probeSupportStore). Nothing in the repo documents a health-owned probe collection.
  • createProcessCheck('process') (composition.ts:288). The only other caller, worker/src/index.ts:187, invokes createProcessCheck() with no argument, so the accepted-arity/name behavior of the pinned @​pegma/health version is unverified.
  • import { IdentityError } from '@​pegma/identity' plus new IdentityError('invalid_input', ...) in recipes/bench-ticket/handler.ts (readJson), and the mapped error.code strings (rate_limited, verification_failed, invalid_input, not_found, conflict). The production worker throws its own ApiError and never constructs IdentityError directly.
  • The IdentityMailRenderer.render(content) contract (content.expired, content.purpose, content.code, content.expiresAt, content.newEmail) in createBenchTicketMailRenderer — the Northshelf fixture only passes a renderer through and never implements one, so the content shape is unpinned by any other repo code.

What I checked: recipes/cf-passkey-accounts/composition.ts (confirms createIdentity, createSessionStore, identity.createMailWorker, sessions.create, createDurableLimiter shapes), worker/src/identity-api.ts (confirms beginAccountCreation(email, key) / finishAccountCreation({codeHandle, code, rateLimitKey})), worker/src/support-desk.ts and worker/src/support-access.ts (confirm createSupportDeskApplication options, supportPermissions, and the four mapped Support Desk error classes). Proof gap: the @​pegma/* packages live in node_modules, which is not inspectable in this checkout, and I cannot execute the test suite — so this is a risk finding, not a confirmed failure. If the author did run the suite locally, most of these resolve to fine.

🟠 Issue 13 — Offline eval pins (authorization-* at 0.4.0, new entra entry) can diverge from live npm, silently degrading production plans while eval:assembly stays green

evals/assembly-eval.test.ts:39 · risk · identified by z-ai/glm-5.3-flash

The PR moves EVAL_NPM for all nine @​pegma/authorization-* packages from 0.1.2 to 0.4.0 and adds '@​pegma/authorization-entra': '0.4.0'. These offline pins make the offline eval pass, but the production catalog build uses fetchNpmLatestVersion against registry.npmjs.org (src/data/compile-catalog.ts). If any of the five authorization packages not pinned by this repo (authorization-contracts, authorization-auth0, authorization-entra, authorization-stripe, authorization-tokens) is not actually at 0.4.0 on npm, the live catalog.json marks the authorization-core component partial, and planComposition(productionOnly: true) silently skips every recipe with requiresPublished: ['authorization-core', ...] — which after this PR is both cf-passkey-accounts and support-queue-slice — while pnpm eval:assembly keeps reporting passRate === 1 because EVAL_NPM never hits the network.

Corroborating evidence I found: package.json pins only five authorization packages (core, policy, identity, storage, admin) at 0.4.0; the component registry prose still says "0.1.4 on npm across nine synchronized packages" (src/data/components.ts), which now contradicts the PR's own 0.4.0 pins. Proof gap: I cannot query npm from this review environment, so the version reality of the unpinned five is unverifiable here; the concrete cost is an offline/live divergence that this eval is structurally unable to catch.

🟠 Issue 14 — Azure and AWS runbooks pass the email-code HMAC secret as a plaintext env var, contradicting the repo's own secret guidance

src/pages/runbooks/azure.md:128 · risk · identified by z-ai/glm-5.3-flash

The Cloudflare runbook explicitly says the email-code HMAC secret must be "a Worker secret (not a vars value)", and every runbook repeats "Do not commit it". The Azure and AWS runbooks then deploy it as a plain environment variable:

  • src/pages/runbooks/azure.md: az containerapp create ... --env-vars ... BENCH_TICKET_EMAIL_CODE_SECRET_BASE64="$SECRET" — visible to anyone who can run az containerapp show, and to container env dumps.
  • src/pages/runbooks/aws.md step 5 env table: BENCH_TICKET_EMAIL_CODE_SECRET_BASE64 | $SECRET on the App Runner/ECS task — same exposure via aws apprunner ... / task definitions.

Concrete cost: anyone with read-only describe access to the container app or task definition obtains the HMAC key that mints email-code verification material. The Cloudflare runbook demonstrates the repo knows the right mechanism; the other two should at least note the tradeoff or use the platform's secret references (--secrets + secretref on Container Apps, Secrets Manager/SSM on App Runner).

🔵 Issue 15 — Dockerfile invalidates pnpm cache on any source change

recipes/bench-ticket/Dockerfile:6 · nit · identified by meta/muse-spark-1.2

Every code edit reinstalls all dependencies, slowing CI and local docker compose --build by minutes and increasing flake risk on registry hiccups.

recipes/bench-ticket/Dockerfile:5 copies package.json+pnpm-lock.yaml, then 6 does COPY . . before 7 RUN pnpm install --frozen-lockfile. Any file change (e.g. handler.ts) dirties the layer before install, so Docker cannot reuse the cached pnpm install. Correct order is install first, then copy source. Also ENV NODE_ENV=production is set after install, which currently preserves dev tsx needed at runtime (CMD ["pnpm", "exec", "tsx", ...]), but a future reorder would drop tsx and break the container with Cannot find module 'tsx'.

Checked Dockerfile layers and package.json dev tsx@​4.23.13 used at runtime.

🔵 Issue 16 — Wrangler database_id placeholder will fail wrangler deploy if not replaced

recipes/bench-ticket/cloudflare/wrangler.jsonc:9 · nit · identified by meta/muse-spark-1.2

First-time deploy fails with D1 database not found and the error directs to wrangler.jsonc rather than the runbook step, increasing agent one-shot failure rate.

cloudflare/wrangler.jsonc:9 ships with "database_id": "REPLACE_AFTER_D1_CREATE". wrangler deploy -c recipes/bench-ticket/cloudflare/wrangler.jsonc before d1 create + manual edit will error. The runbook correctly says to copy the UUID, but the repo could ship with a wrangler.jsonc that uses database_name lookup or a script to inject the id (wrangler d1 create with --json + jq). As-is, CI never deploys this Worker, so the placeholder is untested.

Checked wrangler.jsonc and cloudflare.md:22 docs. No predeploy check for placeholder.

🔵 Issue 17 — Examples excerpt brittle to signature braces

src/pages/examples.astro:36 · nit · identified by meta/muse-spark-1.2

src/pages/examples.astro:excerptFunction assumes the function signature contains no { before the body brace. If createBenchTicketComposition ever adds a return-type object literal or default param with {, the excerpt will slice at the wrong { and ship truncated, non-compiling TypeScript on pegma.dev/examples.

The helper skips (...) then takes the next { as body start. Today's createBenchTicketComposition(options: BenchTicketCompositionOptions): BenchTicketComposition has no inline {, so it works, but the comment's guard "must not embed object-literal braces in the signature (use a named interface)" is only a convention. A future edit adding = { store: ... } default would break the page build (pnpm run check would throw no body).

Checked examples.astro:36 logic and composition.ts:176 signature. Existing benchTicketExcerpt test not present; failure would surface at build time.

Part 1 of 2; all findings are preserved.

Comment thread recipes/bench-ticket/handler.ts Resolved
Comment thread recipes/bench-ticket/handler.ts Resolved
Comment thread recipes/bench-ticket/host.ts Resolved
Comment thread recipes/bench-ticket/handler.ts Resolved
Comment thread recipes/bench-ticket/host.ts Resolved
Comment thread src/pages/runbooks/azure.md Resolved
Comment thread docs/catalog/RECIPE_BACKLOG.md Resolved
Comment thread src/data/recipe-backlog.ts Resolved
Comment thread README.md Resolved
@github-actions

Copy link
Copy Markdown

OpenRouter pull-request review — continued

Findings (continued)

🔵 Issue 18 — Non-Cloudflare hosts share one email-code rate-limit bucket under the hardcoded 'local' key

recipes/bench-ticket/handler.ts:321 · nit · identified by z-ai/glm-5.3-flash

On every Node deployment of the demo (Local Docker, Azure Container Apps, AWS App Runner), request.headers.get('cf-connecting-ip') is absent, so /api/auth/begin and /api/auth/finish pass the literal key 'local' into the durable limiters. Ten begin calls within 10 minutes — from any mixture of users — exhaust bench-ticket-email-code-request for everyone, and begin starts returning 429. Behind Container Apps / App Runner load balancers there is also no x-forwarded-for fallback, so even with the header present the intended per-IP keying never materializes outside Cloudflare.

The runbook failure-sign tables (src/pages/runbooks/local-docker.md, azure.md, aws.md) cover SMTP, storage, and origin failures but never rate-limit exhaustion, so an agent following the runbook has no recovery path documented for this. A per-request key derived from x-forwarded-for (or a documented note that the demo shares one bucket) would make the failure legible.

🔵 Issue 19 — writeNodeResponse collapses repeated Set-Cookie headers into one comma-joined value

recipes/bench-ticket/host.ts:112 · nit · identified by z-ai/glm-5.3-flash

recipes/bench-ticket/host.ts writeNodeResponse builds a flat Record<string, string> via response.headers.forEach((value, key) => { headers[key] = value; }). The Headers iterator merges multiple set-cookie headers into a single comma-joined string, and a flat record also keeps only the last duplicate. Today each Bench Ticket response carries at most one cookie, so nothing breaks — but the moment the host sets two cookies (for example a session cookie plus a future preference or CSRF cookie), Node's http server would emit one mangled Set-Cookie header, silently corrupting both.

This is the Node bridge the cloud runbooks tell agents to copy verbatim ("reuse the Node host (host.ts) with the store factory swapped"), so the pattern propagates. Using response.headers.getSetCookie() and writing each cookie separately would fix it. Not a live bug today; flagged because the demo is presented as the template for production-shaped hosts.

🔵 Issue 20 — Dockerfile copies the lockfile layer and then copies everything anyway — install never caches and the redundant COPY is dead weight

recipes/bench-ticket/Dockerfile:6 · nit · identified by z-ai/glm-5.3-flash

recipes/bench-ticket/Dockerfile does COPY package.json pnpm-lock.yaml ./ immediately followed by COPY . ., and only then RUN pnpm install --frozen-lockfile. The first COPY provides no cache benefit because the very next COPY . . invalidates the layer on any source change, so every image rebuild (including the ones the Azure and AWS runbooks instruct after swapping the store factory) re-runs the full workspace install. The intended pattern would be COPY manifests, pnpm install, then COPY . .. As written, the first COPY line is pure dead weight.

Minor extra: with the current order the final image also ships the entire Astro site, worker/, evals/, and docs/ (see the .dockerignore finding) for a demo that only runs recipes/bench-ticket/host.ts. The Azure runbook's "Building image fails on tsx" row leans on this exact Dockerfile, so reordering is safe as long as install stays before ENV NODE_ENV=production.

🔵 Issue 21 — .dockerignore leaves site sources, worker/, docs/, and evals/ in the demo image

.dockerignore:1 · nit · identified by z-ai/glm-5.3-flash

The new .dockerignore excludes node_modules, .git, dist, coverage, .wrangler, worker/.dev.vars, and env files — but not src/, public/, docs/, evals/, .github/, .claude/, or the worker/ directory itself. The demo image builds from the repo root (docker-compose.yml sets context: ../..) and only ever executes recipes/bench-ticket/host.ts, so every one of those trees is baked into the image unused: slower builds and pushes, and a larger attack/download surface for what is documented as a one-process demo.

Concrete cost: the Azure runbook's ACR push and the AWS runbook's ECR push both ship this image; each rebuild after the documented host.ts edit re-uploads all of it. Adding the non-app directories (keeping recipes/) would cut the context substantially.

🔵 Issue 22 — demo:bench-ticket script fails at startup without an env var and is documented nowhere

package.json:16 · nit · identified by z-ai/glm-5.3-flash

Running pnpm demo:bench-ticket throws BENCH_TICKET_EMAIL_CODE_SECRET_BASE64 is required from requiredEnv() in recipes/bench-ticket/host.ts, and then defaults the mail catcher to Mailpit SMTP at 127.0.0.1:1025, which is not running outside the compose stack — so even with the secret set, the first begin request fails when the SMTP send errors. Neither README.md (which enumerates the dev workflow) nor the Local Docker runbook (which uses docker compose only) mentions the new script, so it is an undocumented, failing-by-default entry point.

Either document the env contract (BENCH_TICKET_EMAIL_CODE_SECRET_BASE64, optionally BENCH_TICKET_MAIL_CATCHER=console) or drop the script until it has a documented path.

🔵 Issue 23 — Cloudflare runbook runs wrangler secret put before the Worker's first deploy

src/pages/runbooks/cloudflare.md:60 · nit · identified by z-ai/glm-5.3-flash

Step 4 of src/pages/runbooks/cloudflare.md runs npx wrangler secret put BENCH_TICKET_EMAIL_CODE_SECRET_BASE64 -c recipes/bench-ticket/cloudflare/wrangler.jsonc before the first wrangler deploy in step 5. On a fresh Cloudflare account no Worker named bench-ticket exists yet; depending on wrangler version this either errors with a script-not-found style failure or inserts an extra interactive prompt (create a draft Worker?) before the expected secret-value prompt. The runbook's "Paste $SECRET at the prompt" line only anticipates the value prompt.

Either move the secret put after the first deploy or add a failure-sign row covering the not-found/prompt case. Proof gap: I cannot execute wrangler here, and recent wrangler behavior differs across versions (some offer to create the Worker interactively), so this may work as written in an interactive shell.

🔵 Issue 24 — Cloudflare runbook's D1 failure-sign command targets the local D1 database, not the deployed one

src/pages/runbooks/cloudflare.md:120 · nit · identified by z-ai/glm-5.3-flash

The failure-sign row for "Health 503 / storage fail" in src/pages/runbooks/cloudflare.md prescribes npx wrangler d1 execute bench-ticket --command 'SELECT name FROM sqlite_master;'. Since wrangler v3, d1 execute runs against a local SQLite database by default; without --remote it never touches the deployed D1 that the Worker actually uses. An agent following the table would "confirm" schema on a database the Worker never reads and then redeploy without fixing anything.

Fix: append --remote (with the -c recipes/bench-ticket/cloudflare/wrangler.jsonc flags already used elsewhere in the doc) to the prescribed command.

🔵 Issue 25 — Mailpit SMTP provider omits SMTP dot-stuffing

recipes/bench-ticket/mail-smtp.ts:90 · nit · identified by z-ai/glm-5.3-flash

recipes/bench-ticket/mail-smtp.ts builds the DATA payload as [...headers, '', request.mail.text, ''].join('\r\n') plus a bare \r\n. terminator, without doubling leading dots per RFC 5321. Any mail body containing a line that starts with . terminates DATA early, and the remainder is interpreted by Mailpit as SMTP commands (command injection into the SMTP session).

Today the only renderer output is fixed strings plus an 8-digit code and a timestamp, so the demo path cannot trigger it — but createBenchTicketMailRenderer's email_changed branch interpolates content.newEmail into the body, and this provider is exactly the code the runbooks present as the reusable local-mail pattern. A text.replace(/(^|\r\n)\./g, '$1..') (or a comment stating the constraint) closes it cheaply.

🔵 Issue 26 — AWS runbook's log-tail instructions assume a CloudWatch Logs group App Runner does not create

src/pages/runbooks/aws.md:9 · nit · identified by z-ai/glm-5.3-flash

src/pages/runbooks/aws.md says to follow logs with aws logs tail … --follow, and the index table (src/pages/runbooks.md) lists AWS mail as "console / CloudWatch". App Runner does not emit application logs to a CloudWatch Logs group unless an observability configuration is explicitly attached to the service, so aws logs tail fails with no log group for a default deployment — and the runbook's failure-sign row "No code in logs | Tail logs before begin" then sends the agent after logs that do not exist.

The runbook does hedge with "or App Runner application logs", so this is a doc-accuracy nit: either state the observability-configuration step, or lead with the platform log stream and drop the aws logs tail shorthand.

🔵 Issue 27 — AWS runbook states unmerged-adapter API details (option names and defaults) as fact

src/pages/runbooks/aws.md:104 · nit · identified by z-ai/glm-5.3-flash

src/pages/runbooks/aws.md documents the not-yet-published @​pegma/storage-dynamodb as if its API were fixed: "The adapter can create the table on first use (createTableIfMissing defaults to true)", a createDynamoDbStore({ client, tableName, createTableIfMissing: false }) option set, and a createS3BlobStore({ client, bucket, endpoint, maxObjectBytes }) shape that nothing in this repository corroborates (the s3 blob adapter is never wired anywhere in-repo). If storage-core#7 lands with different option names or defaults, agents following the runbook write code against invented facts; the doc only hedges for the DynamoDB factory ("If the published factory options differ, copy them from that package's README"), not for the stated default or for createS3BlobStore.

Concrete cost: the runbook's own failure table can't rescue this — a wrong option name surfaces as a type/usage error after the package finally lands, exactly the "do not invent" behavior the rest of the doc enforces. Suggest marking the option names/defaults as provisional until the PR merges.

🔵 Issue 28 — AWS runbook teardown depends on $ACCOUNT that is unset in a fresh shell

src/pages/runbooks/aws.md:190 · nit · identified by z-ai/glm-5.3-flash

The teardown block in src/pages/runbooks/aws.md runs aws s3 rb "s3://bench-ticket-blobs-${ACCOUNT}" --force, but ACCOUNT was only exported in the earlier step-3/step-5 shells. Run in a new terminal (the likely case days later, as the other runbooks' teardowns are), it expands to s3://bench-ticket-blobs- and the delete fails, leaving the bucket billed. The neighboring dynamodb delete-table and ecr delete-repository lines hardcode their parameters, so only the bucket line breaks.

Fix: re-derive it in the teardown (ACCOUNT=$(aws sts get-caller-identity --query Account --output text)) the way step 3 does.

🔵 Issue 29 — Azure runbook selects resources with --query '[0].name', which breaks on re-runs

src/pages/runbooks/azure.md:75 · nit · identified by z-ai/glm-5.3-flash

src/pages/runbooks/azure.md resolves both the storage account and the ACR via az ... list -g rg-bench-ticket --query '[0].name' -o tsv. On a second run against the same resource group (the failure-sign table explicitly encourages retrying after a name collision by adding a suffix), [0] returns whichever resource the list API returns first — not necessarily the one just created — so the table/container credentials and the IMAGE registry can silently point at an older account or registry.

Capturing the name from the create command's own output (or filtering by the exact name prefix used in create) removes the failure mode.

🔵 Issue 30 — Backlog doc lists adapters for support-queue-slice while the compiled recipe ships adapters: []

docs/catalog/RECIPE_BACKLOG.md:92 · nit · identified by z-ai/glm-5.3-flash

docs/catalog/RECIPE_BACKLOG.md P7 table says "Adapters | memory (local Docker); storage-cloudflare-d1; storage-azure-tables; forthcoming storage-dynamodb", but src/data/recipe-backlog.ts keeps adapters: [] for the recipe (compare cf-passkey-accounts, which declares { componentId: 'storage-core', adapterId: 'cloudflare-d1' }). The compiled catalog.json therefore shows no adapter selections for the recipe, and planComposition's host-demote logic never sees adapter hosts for it.

Cost: agents reading catalog.json (the doc's stated machine source of truth) get a different adapter story than the human backlog page. Either populate adapters in the data or trim the doc row to "host chooses".

🔵 Issue 31 — Recipe capabilityTags include rate_limit_memory but omit rate_limit_durable although email-code limits are durable

src/data/recipe-backlog.ts:290 · nit · identified by z-ai/glm-5.3-flash

src/data/recipe-backlog.ts tags support-queue-slice with rate_limit_memory (the passkey-path memory limiters) but not rate_limit_durable, even though the composition wires the email-code request and verification limiters with createDurableLimiter(policy, store, ...) over the injected Store — the PR body itself calls this out: "Rate-limit for email codes is the durable limiter over the injected Store."

Concrete cost: an agent requesting rate_limit_durable gets zero tag overlap with this recipe, so plan_composition never surfaces it as an alternative for a durable-limit-bearing plan; the tag set also makes the recipe appear memory-only to catalog consumers. Adding rate_limit_durable fixes both the semantics and future plan coverage.

🔵 Issue 32 — The Cloudflare Worker entry (composition caching + D1 store) is never executed by CI

recipes/bench-ticket/cloudflare/worker.ts:1 · nit · identified by z-ai/glm-5.3-flash

recipes/bench-ticket/cloudflare/worker.ts is only typechecked by pnpm run check; no test imports or executes it (vitest.config.ts includes recipes/**/*.test.ts, and no test file touches cloudflare/), unlike composition.ts and handler.ts which have test coverage. The Cloudflare runbook then instructs agents to deploy this exact file.

Concrete cost: a runtime-only mistake in this entry — the module-level composition cache keyed on origin+secret, createSchemaIfMissing: true on first request, or a Workers-incompatible call reached through handler.ts — ships undetected by the CI that the runbooks describe as validating the fixture. A minimal vitest-pool-workers test (health + begin against the D1 binding) would pin it.

🔵 Issue 33 — README's portability-exhibit bullet still cites @​pegma/sessions@​0.1.0

README.md:27 · nit · identified by z-ai/glm-5.3-flash

README.md (the "portability exhibit" bullet, just above the new runbooks bullet) says the account API composes "exact @​pegma/sessions@​0.1.0 today", while the repo's own dependency set and health detail report sessions 0.2.0, and this PR's catalog pins everywhere else say @​pegma/sessions@​0.2.0 (recipe pins, EVAL_NPM, worker health detail). The stale version is pre-existing, but this PR is the version-bump-heavy change that makes the contradiction visible on the page it edits; a reader comparing README to catalog.json now sees two different pins for the same package.

One-line fix while this file is open.

Part 2 of 2; all findings are preserved.

Workflow run

Map SupportDeskQueueCapacityError like the production host, reject a NaN
Mailpit SMTP port before connect, and inject the Azure/AWS email-code
secret through platform secret refs instead of plaintext container env.

Co-authored-by: Fly Over Coder <FlyOverCoder@gmail.com>
@cursor

cursor Bot commented Sep 11, 2026

Copy link
Copy Markdown

Triage of the OpenRouter review on 306cb1a (32 inline threads). Head is now 7020b0e.

Fixed

  • SupportDeskQueueCapacityError → HTTP 503 queue_unavailable (same mapping as the production host).
  • SMTP port: MAILPIT_SMTP_PORT / createMailpitSmtpProvider reject NaN and out-of-range values before net.connect.
  • Azure/AWS HMAC: Container Apps --secrets + secretref:; AWS Secrets Manager runtime secret. Not a plaintext env var.

Dismissed (not re-opened)

  • Shared 'local' rate-limit key: demo limiter, not DDoS protection. Trusting X-Forwarded-For without a documented trusted hop would be a security guess.
  • Sync mail-drain 500: Azure/AWS use the console catcher; Mailpit race stays a local-docker nit.

Dismissed nits / risks (no churn): multi-Set-Cookie, D1 cache identity, SMTP dot-stuffing, compose demo secret, http origin, absolute req.url, JSON body cap, fixture API novelty, offline EVAL_NPM, Dockerfile/dockerignore, demo:bench-ticket env, wrangler secret-put order, d1 execute without --remote, App Runner log group, unmerged adapter option names, $ACCOUNT teardown, Azure [0].name, backlog adapters/capabilityTags, Worker CI gap, README sessions pin.

Not merged. Still draft.

…ool.

Health and email-code begin now run through worker.ts against Miniflare D1,
which also pins composition reuse until the email-code secret rotates.

Co-authored-by: Fly Over Coder <FlyOverCoder@gmail.com>

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OpenRouter pull-request review

Verdict: partial
Scope: latest-commit (commit-range)
Mode: verify
Commit: 7020b0e727c30933dc14846b27b4178ad93f1853
Judge: openai/gpt-5.6-luna
Cost: $0.1536 (lanes $0.1531 + judge $0.0005)

Lanes

  • meta/muse-spark-1.2: ok (0 finding(s), 25.5s, 88425+5013 tokens (19953 cached), 3 tool round(s), via Meta, $0.11)
  • z-ai/glm-5.3-flash: ok (1 finding(s), 582.6s, 343834+38927 tokens (221056 cached), 7 tool round(s), via Together, $0.0432)

Round 2 resolution

  • ❌ r1-1 not fixed — Shared rate-limit key local on non-Cloudflare hosts: Still request.headers.get('cf-connecting-ip') ?? 'local' in handler.ts:295/302 (begin/finish). No per-IP extraction (X-Forwarded-For, socket address) added. Outside Cloudflare all requests still share single durable 10/10m bucket; diff only touched queue-capacity and SMTP port.
  • ❌ r1-2 not fixed — Successful begin masked as 500 when mail catcher fails: handleBenchTicketRequest still await drainMail(composition) immediately after beginAccountCreation/beginEmailSignIn with no try/catch. Mailpit SMTP 4xx/5xx or 8s timeout in mail-smtp.ts:smtpDialog still bubbles to catch->mapError->500, masking successful enqueue and causing duplicate outbox entries on retry.
  • ✅ r1-3 fixed correctly — SMTP port NaN not validated before net.connect: Fixed by new parseMailpitSmtpPort() in host.ts:31-37 and guard in mail-smtp.ts:76-78 rejecting NaN/out-of-range 1-65535. host.ts:53 now uses helper; tests in host.test.ts assert throw for 'notanumber'/'0' and NaN.
  • ✅ r1-4 fixed correctly — Bench Ticket HTTP host does not map SupportDeskQueueCapacityError — a queue-capacity throw surfaces as HTTP 500 internal_error: Fixed: handler.ts now imports SupportDeskQueueCapacityError and maps to 503 {error:'queue_unavailable'} in mapError (handler.ts:270). Covered by new handler.test.ts 'maps SupportDeskQueueCapacityError to 503' test.
  • ❌ r1-5 not fixed — Node adapter loses multi-Set-Cookie via Headers.forEach: writeNodeResponse in host.ts:114-121 still uses response.headers.forEach((v,k)=>headers[k]=v) then writeHead. No getSetCookie() handling, so multiple Set-Cookie still joined with ', '. joinIncomingHeader fix only covers incoming Cookie, not outgoing.
  • ❌ r1-6 not fixed — Cloudflare Worker composition cache ignores BENCH_TICKET_DB identity: cloudflare/worker.ts:32-40 compositionCacheKey still ${origin}\n${secret} only; cached Store from createCloudflareD1Store({database: env.BENCH_TICKET_DB}) is reused after D1 binding rotation. No DB identity in key.
  • ❌ r1-7 not fixed — Mailpit SMTP DATA missing dot-stuffing and adds extra blank line: mail-smtp.ts still builds DATA as ${body}\r\n. after body ending \r\n (extra blank line) and does no replace(/^\./gm,'..') dot-stuffing. Current renderer avoids leading dots so not triggered, but future body with leading '.' would truncate at \r\n.\r\n.
  • ❌ r1-8 not fixed — Hard-coded weak email-code secret committed in repo: docker-compose.yml:14-15 still ships BENCH_TICKET_EMAIL_CODE_SECRET_BASE64: CwsLC... (32x0x0b) with only comment 'Local demo only'. No enforcement preventing copy to prod; secret visible in history.
  • ❌ r1-9 not fixed — http origin allowed for any hostname, not just localhost: composition.ts:originParts still only checks new URL(origin).origin === origin. No restriction that http: origins must be localhost/127.0.0.1/*.localhost. Production http://bench.example.com would still start and set SameSite=Lax without Secure (handler.ts sessionCookie checks https: only).
  • ❌ r1-10 not fixed — Node host trusts absolute req.url over configured origin: host.ts:requestFromNode still new URL(req.url ?? '/', origin); absolute req.url bypasses configured origin and malformed URL throws TypeError to .catch 500 instead of 400. No validation/normalization added.
  • ❌ r1-11 not fixed — Missing request body size limit in readJson: handler.ts:readJson still await request.text() -> JSON.parse with no Content-Length/byte cap. SupportDeskLimitError 413 checked only after parsing/transaction, so 100MB subject/body can OOM Worker/Node.
  • 🤝 r1-12 disputed — New fixture calls @​pegma APIs that no other repo code exercises, so a drift breaks CI and the "CI-tested / green" claims: The fixing agent's rebuttal holds up against the repo: pnpm run check (package.json) includes tsc -p recipes/tsconfig.json --noEmit with include: ["./**/*.ts"], and pnpm test (vitest.config.ts) includes recipes/**/*.test.ts, so a nonexistent export or mismatched signature in the pinned @​pegma packages fails CI rather than silently keeping the 'green' claims; ci.yml runs both. The speci…
  • ❌ r1-13 not fixed — Offline eval pins (authorization- at 0.4.0, new entra entry) can diverge from live npm, silently degrading production plans while eval:assembly stays green*: evals/assembly-eval.test.ts EVAL_NPM still pins authorization-* at 0.4.0 with offline npmLookup. No version-skew guard versus live fetchNpmLatestVersion in src/data/compile-catalog.ts; diverged npm releases would still let eval stay green while prod catalog marks components partial.
  • ⚠️ r1-14 fixed incorrectly — Azure and AWS runbooks pass the email-code HMAC secret as a plaintext env var, contradicting the repo's own secret guidance: The AWS half is a correct fix: Secrets Manager bench-ticket/email-code-hmac, runtime-secret injection (App Runner runtime environment secrets or an ECS secrets entry, which describe-task-definition does not return), secretsmanager:GetSecretValue on the task role, and teardown deletion. The Azure half moves the value out of --env-vars (good) but the newly added guarantee is almost certain…
  • 19 nit finding(s) from earlier rounds retired (severity floor for follow-up rounds is risk).
  • Open findings after this round: 12 (2 bug-severity).

Warning

The PR head advanced after this review's diff was collected. This review is pinned to commit 7020b0e and does not cover the newest push.

Findings

🔵 Issue 1 — host.test.ts now contains a byte-identical duplicate of the Node incoming headers describe block

recipes/bench-ticket/host.test.ts:39 · nit · identified by z-ai/glm-5.3-flash

The latest commit pasted a second copy of the pre-existing describe('Node incoming headers', …) block in front of the new Mailpit SMTP port block, so recipes/bench-ticket/host.test.ts runs the same three tests twice (lines 5–22 and lines 39–56) under the same describe name.

Nothing fails — the duplicate asserts the same behavior against the same joinIncomingHeader implementation, which already special-cased cookie with ; before this commit — but the suite double-counts identical assertions, and a future edit to one copy (e.g., tightening the join contract) will silently diverge from the other. It is a copy-paste artifact of this commit, not intentional coverage.

Checked the file directly: both blocks are verbatim identical, and joinIncomingHeader (host.ts:79) is only consumed by requestFromNode and these tests, so deleting one copy has no other blast radius.

Workflow run

The SMTP-port commit copied the incoming-header describe block. Azure
still injects the HMAC via --secrets plus secretref; GET returns the name,
not the value.

Co-authored-by: Fly Over Coder <FlyOverCoder@gmail.com>
@cursor

cursor Bot commented Sep 11, 2026

Copy link
Copy Markdown

Verify review was pinned to stale 7020b0e; head is now 425d5de (Worker D1 tests already on 2c6aa9c). CI was green on 2c6aa9c.

Fixed: deleted the byte-identical duplicate describe('Node incoming headers') in recipes/bench-ticket/host.test.ts.

r1-14 Azure HMAC stays a correct fix, not a remaining plaintext env var. --secrets "email-code-hmac=$SECRET" plus BENCH_TICKET_EMAIL_CODE_SECRET_BASE64=secretref:email-code-hmac. az containerapp show returns the secret name and secretRef, not the value. Not in a committed file. AWS Secrets Manager path unchanged.

Stay dismissed (verify ❌ items we already declined): shared 'local' limiter, mail-drain 500, multi-Set-Cookie, D1 cache identity, SMTP dot-stuffing, compose demo secret, http origin, absolute req.url, JSON body cap, fixture API novelty, EVAL_NPM pins.

Not merged. Still draft.

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OpenRouter pull-request review

Verdict: partial
Scope: latest-commit (commit-range)
Mode: verify
Commit: 2c6aa9c9a094f3402cf1cc21aef27a1b4dc08f88
Judge: openai/gpt-5.6-luna
Cost: $0.1458 (lanes $0.1449 + judge $0.0010)

Lanes

  • meta/muse-spark-1.2: ok (0 finding(s), 36.3s, 92211+6881 tokens (33378 cached), 3 tool round(s), via Meta, $0.11)
  • z-ai/glm-5.3-flash: ok (2 finding(s), 656.9s, 225643+44977 tokens (160640 cached), 4 tool round(s), via Together, $0.0371)

Round 2 resolution

  • 🤝 r1-1 disputed — Shared rate-limit key local on non-Cloudflare hosts: Handler still does request.headers.get('cf-connecting-ip') ?? 'local' for begin/finish (handler.ts:327,342) so non-Cloudflare hosts share one durable bucket. Fixing agent argues not trusting X-Forwarded-For without a documented trusted hop would be a security guess and rate-limit is demo-only, not DDoS protection — accepted as intentional tradeoff, so not re-argued without new evidence.
  • 🤝 r1-2 disputed — Successful begin masked as 500 when mail catcher fails: await drainMail(composition) is still inside the try block, but the 'successful begin' framing is wrong: when the provider fails, the code never reached the catcher, so the user cannot proceed and a 500 is an honest signal, not a mask. The retry scenario leaves duplicate outbox rows that the next successful drain flushes, bounded by the 10/10min durable limiter. On the cloud paths the runbooks u…
  • ✅ r1-3 fixed correctly — SMTP port NaN not validated before net.connect: Fixed as claimed: host.ts:31 parseMailpitSmtpPort validates integer 1-65535 and throws on NaN/out-of-range, host.ts:53 uses it, and mail-smtp.ts:76 adds same guard before connect.
  • ✅ r1-4 fixed correctly — Bench Ticket HTTP host does not map SupportDeskQueueCapacityError — a queue-capacity throw surfaces as HTTP 500 internal_error: Fixed as claimed: handler.ts:11 now imports SupportDeskQueueCapacityError and mapError returns json(503,{error:'queue_unavailable'}); handler.test.ts adds test asserting 503 not 500.
  • ❌ r1-5 not fixed — Node adapter loses multi-Set-Cookie via Headers.forEach: No fix: host.ts:116 writeNodeResponse still does response.headers.forEach((v,k)=>headers[k]=v) then res.writeHead. Fetch Headers requires getSetCookie() for multiple Set-Cookie; forEach joins with ', '. Still latent; only one cookie set today.
  • 🤝 r1-6 disputed — Cloudflare Worker composition cache ignores BENCH_TICKET_DB identity: compositionCacheKey still excludes BENCH_TICKET_DB, but the stale-store scenario requires one isolate to observe two different DB bindings, which the runtime does not do: Workers bindings are immutable per deployed version, and a binding swap deploys a new version with fresh isolates (cold cache); wrangler dev and the vitest-pool-workers Miniflare restart on config change. The realistic rota…
  • ❌ r1-7 not fixed — Mailpit SMTP DATA missing dot-stuffing and adds extra blank line: No fix: mail-smtp.ts:83-89 still builds body via [...].join('\r\n') ending in \r\n then sends ${body}\r\n. (+ write adds \r\n => blank line before dot) and performs no body.replace(/^\./gm,'..') dot-stuffing.
  • 🤝 r1-8 disputed — Hard-coded weak email-code secret committed in repo: docker-compose.yml is unchanged and still ships the static 32-byte secret — deliberately. The value carries the explicit comment "Local demo only — never reuse in a cloud deploy", and all three cloud runbooks generate a fresh randomBytes(32) secret; the compose file is not a cloud deployment path. Labeled throwaway demo credential is a defensible tradeoff.
  • ❌ r1-9 not fixed — http origin allowed for any hostname, not just localhost: No change: composition.ts:124 originParts only checks url.origin===origin. No restriction that http: origins must be localhost/127.0.0.1. handler.ts:sessionCookie sets Secure only on https:, so http prod origin would set non-Secure cookies.
  • 🤝 r1-10 disputed — Node host trusts absolute req.url over configured origin: requestFromNode still builds new URL(req.url ?? '/', origin), so an absolute request-target can override the configured origin — but I falsified the impact: handler.ts derives only url.pathname and makes no security decision from request.url's origin (there is no origin-header check to bypass), and a malformed absolute target that throws is caught by the server's .catch in host.ts, which…
  • ❌ r1-11 not fixed — Missing request body size limit in readJson: No change: handler.ts:260 readJson still await request.text() with no Content-Length/byte cap, then JSON.parse, so large subject/body buffers fully in memory before SupportDeskLimitError 413 is checked.
  • 🤝 r1-12 disputed — New fixture calls @​pegma APIs that no other repo code exercises, so a drift breaks CI and the "CI-tested / green" claims: The risk rested on unpublished @​pegma APIs possibly not existing. Every @​pegma/* dependency is an exact pin in package.json (support-desk-application 0.1.1, identity 0.1.2, storage-core 0.4.0, storage-cloudflare-d1 0.4.1 …), so published-package API drift cannot silently break the fixture — breakage only arrives with a deliberate, reviewable version bump, and tsc -p recipes/tsconfig.json passi…
  • ❌ r1-13 not fixed — Offline eval pins (authorization- at 0.4.0, new entra entry) can diverge from live npm, silently degrading production plans while eval:assembly stays green*: No change to evals/assembly-eval.test.ts pins or src/data/compile-catalog.ts live-npm fetch path. Offline EVAL_NPM 0.4.0 pins can still diverge from registry; eval stays green while catalog could differ. Agent dismissed as nit with no code fix.
  • ✅ r1-14 fixed correctly — Azure and AWS runbooks pass the email-code HMAC secret as a plaintext env var, contradicting the repo's own secret guidance: Fixed as claimed: azure.md:117 now --secrets "email-code-hmac=$SECRET" + BENCH_TICKET_EMAIL_CODE_SECRET_BASE64=secretref:email-code-hmac, aws.md creates Secrets Manager bench-ticket/email-code-hmac and injects as runtime secret, with failure-sign rows and teardown steps added.
  • 19 nit finding(s) from earlier rounds retired (severity floor for follow-up rounds is risk).
  • Open findings after this round: 7 (0 bug-severity).

Warning

The PR head advanced after this review's diff was collected. This review is pinned to commit 2c6aa9c and does not cover the newest push.

Findings

🔵 Issue 1 — host.test.ts duplicates the entire 'Node incoming headers' describe block

recipes/bench-ticket/host.test.ts:36 · nit · identified by z-ai/glm-5.3-flash

The new commit added a second, byte-identical copy of the describe('Node incoming headers') block (lines 36–55) before the original one (lines 5–24), so the suite now runs every cookie/multi-value-header assertion twice.

The diff shows the block being re-added while the pre-existing one is kept as context, and the current file contains both copies in sequence (Node incoming headers, Mailpit SMTP port, Node incoming headers). Nothing fails — it is a copy-paste leftover that inflates the test count and will confuse future edits (fixing one copy silently leaves the other stale).

Delete one of the two identical blocks.

🟠 Issue 2 — aws.md prescribes 'App Runner runtime environment secrets', an App Runner capability I cannot confirm exists

src/pages/runbooks/aws.md:151 · risk · identified by z-ai/glm-5.3-flash

The runbook's primary example is App Runner (Create an App Runner service (or ECS/Fargate)), and after removing the plaintext env var it tells followers to "Inject that name from Secrets Manager / SSM (App Runner runtime environment secrets, or an ECS secrets entry)". If App Runner has no runtime-secrets injection (to my knowledge its ImageConfiguration supports only RuntimeEnvironmentVariables, with no secrets parameter), an App Runner follower has no executable path to honor the runbook's own rule "Do not put $SECRET in RuntimeEnvironmentVariables" and may fall back to the plaintext pattern the failure-sign table forbids.

The ECS/Fargate alternative in the same sentence is real (task-definition secrets with a Secrets Manager valueFrom), and the Secrets Manager creation plus secretsmanager:GetSecretValue task-role grant added here are correct. The security exposure from the prior finding is gone in both runbooks; this is only about whether the named App Runner mechanism exists.

Proof gap: I cannot reach AWS documentation from this review environment, so I cannot rule out that App Runner gained a runtime-secrets parameter after my knowledge cutoff. If it has not, reword to make ECS/Fargate the concrete path for secret injection (or have the container fetch the secret at startup via the task role).

Workflow run

App Runner injects Secrets Manager via ImageConfiguration.RuntimeEnvironmentSecrets,
not RuntimeEnvironmentVariables. Keep the HMAC out of plaintext env.

Co-authored-by: Fly Over Coder <FlyOverCoder@gmail.com>
@cursor

cursor Bot commented Sep 11, 2026

Copy link
Copy Markdown

Verify review was pinned to stale 2c6aa9c; head is now 7137420 (duplicate tests already gone on 425d5de).

Duplicate host.test.ts block: already deleted on 425d5de. Not re-deleted.

App Runner runtime secrets exist. API: ImageConfiguration.RuntimeEnvironmentSecrets (secret ARN as the map value). CLI: nested under --source-configuration / --cli-input-json. Distinct from RuntimeEnvironmentVariables. Docs: https://docs.aws.amazon.com/apprunner/latest/api/API_ImageConfiguration.html and https://docs.aws.amazon.com/apprunner/latest/dg/env-variable.html. Runbook now uses those field names. HMAC stays out of plaintext env.

Stay dismissed (this verify’s remaining ❌ items): multi-Set-Cookie, SMTP dot-stuffing, http origin, JSON body cap, EVAL_NPM pins.

Not merged. Still draft.

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OpenRouter pull-request review

Verdict: partial
Scope: latest-commit (commit-range)
Mode: verify
Commit: 425d5dee01afa9d2bdae07d6d23575b0bf4b55a3
Judge: openai/gpt-5.6-luna
Cost: $0.1806 (lanes $0.1799 + judge $0.0007)

Lanes

  • meta/muse-spark-1.2: ok (0 finding(s), 33.7s, 126476+6351 tokens (35042 cached), 4 tool round(s), via Meta, $0.15)
  • z-ai/glm-5.3-flash: ok (1 finding(s), 413.4s, 418861+28259 tokens (363648 cached), 11 tool round(s), via Together, $0.0333)

Round 2 resolution

  • 🤝 r1-1 disputed — Shared rate-limit key local on non-Cloudflare hosts: Still handler.ts:327,342 cf-connecting-ip ?? 'local' and durable limiter over Store, so non-CF hosts share bucket. Accepting fixing-agent tradeoff: deriving per-IP from X-Forwarded-For without documented trusted hop would be insecure guess; demo limiter not intended as DDoS protection.
  • 🤝 r1-2 disputed — Successful begin masked as 500 when mail catcher fails: await drainMail(composition) is still on the begin path, so a Mailpit outage on Local Docker still 500s after the code is enqueued. Verified both cloud runbooks set BENCH_TICKET_MAIL_CATCHER=console (azure.md, aws.md), and local-docker.md:122 documents the failure sign with a Mailpit troubleshooting row, so the residual is scoped to the local Docker demo. Reasonable scope tradeoff.
  • ✅ r1-3 fixed correctly — SMTP port NaN not validated before net.connect: Fixed at host.ts:31-35 parseMailpitSmtpPort validates 1–65535 and mail-smtp.ts:76 validates again before net.connect; host.test.ts covers NaN/0/out-of-range. Invalid MAILPIT_SMTP_PORT now fails fast with clear error.
  • ✅ r1-4 fixed correctly — Bench Ticket HTTP host does not map SupportDeskQueueCapacityError — a queue-capacity throw surfaces as HTTP 500 internal_error: Fixed at handler.ts:11,270-271: imports SupportDeskQueueCapacityError and maps to 503 {error:'queue_unavailable'} matching worker/src/support-desk.ts. handler.test.ts adds coverage for queued capacity.
  • 🤝 r1-5 disputed — Node adapter loses multi-Set-Cookie via Headers.forEach: Outgoing host.ts:writeNodeResponse: forEach still concatenates Set-Cookie with , instead of getSetCookie(). Accepting tradeoff: handler currently sets at most one set-cookie (session/clear); incoming joinIncomingHeader now correctly uses ; for Cookie. Latent multi-cookie corruption deferred.
  • 🤝 r1-6 disputed — Cloudflare Worker composition cache ignores BENCH_TICKET_DB identity: Still cloudflare/worker.ts:32-36 cache key ${origin}\n${secret} only; D1 binding swap reuses old Store. Accepting tradeoff: operational rotation is origin/secret (verified by worker.d1.test.ts); D1 swap implies redeploy/new isolate in practice.
  • 🤝 r1-7 disputed — Mailpit SMTP DATA missing dot-stuffing and adds extra blank line: Still mail-smtp.ts:84-93 no dot-stuffing and builds body\r\n\r\n.. Accepting tradeoff: bench-ticket renderer emits Your Bench Ticket code is ... with no leading-dot lines, so not triggered in this demo fixture.
  • 🤝 r1-8 disputed — Hard-coded weak email-code secret committed in repo: Still docker-compose.yml:14 hard-coded CwsLC... (32×0x0b). Accepting tradeoff: file comments 'Local demo only — never reuse in cloud deploy' and cloud runbooks generate fresh randomBytes(32) secret; not used as prod template.
  • 🤝 r1-9 disputed — http origin allowed for any hostname, not just localhost: Still composition.ts:originParts only checks url.origin===origin; http: not restricted to localhost. Accepting tradeoff: cloud runbooks set https: origins and sessionCookie sets Secure only on https; local http allowance intentional for dev.
  • 🤝 r1-10 disputed — Node host trusts absolute req.url over configured origin: Still host.ts:requestFromNode: new URL(req.url ?? '/', origin) trusts absolute req.url. Accepting tradeoff: handler.ts routes on pathname only, so evil.com origin does not bypass checks; malformed URL 500 is dev-only surface.
  • 🤝 r1-11 disputed — Missing request body size limit in readJson: Still handler.ts:260 await request.text() with no Content-Length/byte cap before JSON.parse. Accepting tradeoff: SupportDeskLimitError enforces category/payload limits after parse; adding second JSON cap deferred as non-must-fix for demo.
  • 🤝 r1-12 disputed — New fixture calls @​pegma APIs that no other repo code exercises, so a drift breaks CI and the "CI-tested / green" claims: Fixture novelty risk remains but pnpm run check typechecks recipes/tsconfig.json (now excluding *.d1.test.ts only) against pinned @​pegma/*@​0.4.0 etc.; drift would fail CI, protecting fixture.status:green claims. No new API drift observed.
  • 🤝 r1-13 disputed — Offline eval pins (authorization- at 0.4.0, new entra entry) can diverge from live npm, silently degrading production plans while eval:assembly stays green*: Still offline EVAL_NPM pins (0.4.0 + entra) vs live fetchNpmLatestVersion. Accepting tradeoff: evals/assembly-eval.test.ts pins are harness-only for offline eval; live catalog.json build fetches registry separately, divergence is expected eval scope.
  • ✅ r1-14 fixed correctly — Azure and AWS runbooks pass the email-code HMAC secret as a plaintext env var, contradicting the repo's own secret guidance: Fixed: src/pages/runbooks/azure.md now --secrets "email-code-hmac=$SECRET" + BENCH_TICKET_EMAIL_CODE_SECRET_BASE64=secretref:email-code-hmac (az containerapp show returns name/secretRef, not value); src/pages/runbooks/aws.md now Secrets Manager bench-ticket/email-code-hmac injected as runtime secret with secretsmanager:GetSecretValue and failure-sign row, not plaintext env var.
  • 19 nit finding(s) from earlier rounds retired (severity floor for follow-up rounds is risk).
  • Open findings after this round: 1 (0 bug-severity).

Warning

The PR head advanced after this review's diff was collected. This review is pinned to commit 425d5de and does not cover the newest push.

Findings

🟠 Issue 1 — Azure runbook still deploys the storage account key as a plaintext --env-vars value

src/pages/runbooks/azure.md:123 · risk · identified by z-ai/glm-5.3-flash

The same commit that moved the email-code HMAC to a Container Apps secret leaves a strictly more sensitive secret in plaintext env vars.

src/pages/runbooks/azure.md:123 deploys AZURE_STORAGE_ACCOUNT_KEY="$KEY" inside the --env-vars block. Plaintext container env values are returned verbatim by az containerapp show — that is exactly the exposure the runbook's own new HMAC row warns about ("az containerapp show returns the secret name and secretRef, not the value"), and the failure-sign row at line 156 even instructs operators to read the key back that way. An Azure Tables account key grants full read/write/delete on the pegma table and the bench-ticket-blobs container, so it is at least as sensitive as the HMAC this commit just hardened.

The repair is the identical pattern already used one line above: --secrets "storage-key=$KEY" plus AZURE_STORAGE_ACCOUNT_KEY=secretref:storage-key. The step-4 host snippet reads process.env.AZURE_STORAGE_ACCOUNT_KEY, so it works unchanged with a secretref, and the --set-env-vars BENCH_TICKET_ORIGIN=… update is an upsert that preserves other env entries.

Checked aws.md: the AWS path uses only an IAM task role and Secrets Manager, so no plaintext credential remains there — this is Azure-only. What I could not verify offline: whether the authors intend the storage key as a deliberate debugging convenience; the line-156 row suggests so, but it contradicts the secretref principle the same commit establishes for the HMAC.

Workflow run

Same Container Apps pattern as the email-code HMAC: --secrets
storage-key plus AZURE_STORAGE_ACCOUNT_KEY=secretref:storage-key.
az containerapp show then returns the name, not the key.

Co-authored-by: Fly Over Coder <FlyOverCoder@gmail.com>
@cursor

cursor Bot commented Sep 11, 2026

Copy link
Copy Markdown

Verify review was pinned to stale 425d5de; head is now 9c87360.

Fixed: Azure storage account key is no longer plaintext --env-vars. Same pattern as the HMAC: --secrets "storage-key=$KEY" plus AZURE_STORAGE_ACCOUNT_KEY=secretref:storage-key. Failure-sign row now checks for secretref: and recovers the key with az storage account keys list, not from az containerapp show. AWS path is IAM + Secrets Manager; no similar leak.

Stay dismissed (this verify marked them 🤝; not re-opened): 'local' limiter, mail-drain 500, multi-Set-Cookie, D1 cache identity, SMTP dot-stuffing, compose demo secret, http origin, absolute req.url, JSON body cap, fixture API novelty, EVAL_NPM pins.

Not merged. Still draft.

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OpenRouter pull-request review

Verdict: partial
Scope: latest-commit (commit-range)
Mode: verify
Commit: 7137420436a90cdc9d1200de3b3fbc673ad070b1
Judge: openai/gpt-5.6-luna
Cost: $0.1621 (lanes $0.1614 + judge $0.0007)

Lanes

  • meta/muse-spark-1.2: ok (0 finding(s), 24.2s, 104260+5359 tokens (27633 cached), 3 tool round(s), via Meta, $0.12)
  • z-ai/glm-5.3-flash: ok (1 finding(s), 647.2s, 382119+39147 tokens (318144 cached), 8 tool round(s), via Together, $0.0387)

Round 2 resolution

  • 🤝 r1-1 disputed — Shared rate-limit key local on non-Cloudflare hosts: Handler still uses request.headers.get('cf-connecting-ip') ?? 'local' (handler.ts:327,342) so non-Cloudflare hosts share one bucket. Fixing agent argues this is an intentional demo limiter, not DDoS protection, and deriving a per-IP key from X-Forwarded-For without a documented trusted hop would be a security guess. Accept as intentional tradeoff.
  • 🤝 r1-2 disputed — Successful begin masked as 500 when mail catcher fails: handler.ts:332 still await drainMail(composition) inside POST /api/auth/begin, so an SMTP 4xx/5xx/timeout bubbles to mapError → 500 via mail-smtp.ts. Fixing agent notes Azure/AWS use the console catcher (non-failing) and the Mailpit race is local-docker only. Accept as intentional local-only nit.
  • ✅ r1-3 fixed correctly — SMTP port NaN not validated before net.connect: Fixed as described. host.ts now exports parseMailpitSmtpPort with integer 1–65535 validation and is used for MAILPIT_SMTP_PORT; mail-smtp.ts createMailpitSmtpProvider also throws before net.connect. Covered by host.test.ts.
  • ✅ r1-4 fixed correctly — Bench Ticket HTTP host does not map SupportDeskQueueCapacityError — a queue-capacity throw surfaces as HTTP 500 internal_error: Fixed as described. handler.ts now imports SupportDeskQueueCapacityError and mapError returns 503 {error:'queue_unavailable'}; handler.test.ts asserts 503 not 500.
  • 🤝 r1-5 disputed — Node adapter loses multi-Set-Cookie via Headers.forEach: host.ts writeNodeResponse still uses response.headers.forEach → headers[key]=value which joins multiple Set-Cookie with ', '. Fixing agent notes handler currently sets at most one set-cookie, so latent. Accept as intentional risk accepted for demo.
  • 🤝 r1-6 disputed — Cloudflare Worker composition cache ignores BENCH_TICKET_DB identity: cloudflare/worker.ts compositionCacheKey still ${origin}\n${secret} only, store (BENCH_TICKET_DB) not in key. Fixing agent argues rotation that matters is secret/origin, D1 identity not must-fix for demo. Accept as tradeoff.
  • 🤝 r1-7 disputed — Mailpit SMTP DATA missing dot-stuffing and adds extra blank line: mail-smtp.ts DATA still builds ${body}\r\n. without dot-stuffing and with extra blank line. Fixing agent notes demo renderer never emits leading '.' lines, so not churned. Accept as latent nit.
  • 🤝 r1-8 disputed — Hard-coded weak email-code secret committed in repo: docker-compose.yml:14 still ships static base64 32×0x0b secret with comment 'Local demo only'. Fixing agent notes cloud runbooks generate fresh randomBytes(32) and compose is labeled local-only. Accept as intentional demo default.
  • 🤝 r1-9 disputed — http origin allowed for any hostname, not just localhost: composition.ts originParts still only checks new URL(origin).origin === origin, allows http://bench.example.com. Handler then sets non-Secure cookies. Fixing agent notes cloud runbooks set HTTPS origins; not tightening local http check. Accept as tradeoff.
  • 🤝 r1-10 disputed — Node host trusts absolute req.url over configured origin: host.ts requestFromNode still does new URL(req.url ?? '/', origin) so absolute req.url overrides origin. Fixing agent notes routing uses pathname only. Accept as intentional not to add absolute-URL handling.
  • 🤝 r1-11 disputed — Missing request body size limit in readJson: handler.ts readJson still does await request.text() then JSON.parse with no Content-Length/byte cap. Fixing agent notes SupportDesk enforces limits after parse. Accept as intentional not adding second cap.
  • 🤝 r1-12 disputed — New fixture calls @​pegma APIs that no other repo code exercises, so a drift breaks CI and the "CI-tested / green" claims: Fixture still sole consumer of @​pegma/identity/sessions/support-desk APIs, but pnpm run check typechecks recipes/tsconfig.json (now excluding **/*.d1.test.ts) against pinned packages. Fixing agent argues CI already covers drift. Accept as tradeoff.
  • 🤝 r1-13 disputed — Offline eval pins (authorization- at 0.4.0, new entra entry) can diverge from live npm, silently degrading production plans while eval:assembly stays green*: evals/assembly-eval.test.ts pins remain offline EVAL_NPM values vs live fetchNpmLatestVersion. Fixing agent notes EVAL_NPM is offline eval harness only, not live catalog build. Accept as intentional.
  • ✅ r1-14 fixed correctly — Azure and AWS runbooks pass the email-code HMAC secret as a plaintext env var, contradicting the repo's own secret guidance: Fixed as described. azure.md now uses --secrets "email-code-hmac=$SECRET" plus BENCH_TICKET_EMAIL_CODE_SECRET_BASE64=secretref:email-code-hmac; aws.md injects via App Runner ImageConfiguration.RuntimeEnvironmentSecrets (and ECS secrets) with Secrets Manager bench-ticket/email-code-hmac, distinct from RuntimeEnvironmentVariables. Docs updated with teardown.
  • 19 nit finding(s) from earlier rounds retired (severity floor for follow-up rounds is risk).
  • Open findings after this round: 1 (0 bug-severity).

Warning

The PR head advanced after this review's diff was collected. This review is pinned to commit 7137420 and does not cover the newest push.

Findings

🟠 Issue 1 — Azure runbook still ships the storage account master key as a plaintext env var while teaching the opposite for the HMAC

src/pages/runbooks/azure.md:123 · risk · identified by z-ai/glm-5.3-flash

An operator following the Azure runbook deploys the Azure Storage account master key as a plain env var: az containerapp create --env-vars ... AZURE_STORAGE_ACCOUNT_KEY="$KEY". Anyone with read access to the container app gets the full key from az containerapp show or a container env dump — master-key control of the whole storage account (Tables and Blobs), not just the demo table.

This is the exact exposure class the commit just fixed for the email-code HMAC two lines above: the new comment says az containerapp show returns only the secret name and secretRef for secrets, yet AZURE_STORAGE_ACCOUNT_KEY remains a plain entry, and the failure-sign table row Confirm AZURE_STORAGE_ACCOUNT / AZURE_STORAGE_ACCOUNT_KEY on the container app: az containerapp show actively instructs operators to print it.

The repair is the identical pattern the runbook now demonstrates: add storage-key=$KEY to --secrets and set AZURE_STORAGE_ACCOUNT_KEY=secretref:storage-key. Secret-referenced env vars materialize as their value inside the container, so the section-4 wiring snippet (process.env.AZURE_STORAGE_ACCOUNT_KEY!) keeps working unchanged. The AWS runbook has no analogue (it uses the task role, no keys in env), so this is Azure-specific.

What I checked: the AZURE_STORAGE_ACCOUNT_KEY line is pre-existing context, but it sits in the exact --env-vars block this commit rewrote and contradicts the commit's own added comment about plaintext env vars; the secretref mechanics are proven by the HMAC fix in the same command.

Workflow run

@cursor

cursor Bot commented Sep 11, 2026

Copy link
Copy Markdown

Verify review was pinned to stale 7137420; head is 9c87360.

Azure AZURE_STORAGE_ACCOUNT_KEY plaintext --env-vars: already fixed on HEAD. --secrets "storage-key=$KEY" plus AZURE_STORAGE_ACCOUNT_KEY=secretref:storage-key. Not re-committed.

No dismissed items re-opened. Not merged. Still draft.

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OpenRouter pull-request review

Verdict: clean
Scope: latest-commit (commit-range)
Mode: verify
Commit: 9c873602312eb1754712cfb186380173bbef6004
Judge: openai/gpt-5.6-luna
Cost: $0.1386 (lanes $0.1385 + judge $0.0001)

Lanes

  • meta/muse-spark-1.2: ok (0 finding(s), 17.0s, 102205+3747 tokens (39778 cached), 3 tool round(s), via Meta, $0.0999)
  • z-ai/glm-5.3-flash: ok (0 finding(s), 413.9s, 489095+24945 tokens (393728 cached), 12 tool round(s), via Together, $0.0386)

Round 2 resolution

  • 🤝 r1-1 disputed — Shared rate-limit key local on non-Cloudflare hosts: Handler still uses request.headers.get('cf-connecting-ip') ?? 'local' at handler.ts:295 so Node hosts share one bucket. Fixing agent rebuttal is demo limiter, not DDoS protection; deriving per-IP from X-Forwarded-For without trusted hop would be a security guess. No new evidence the global bucket is exploited in the one-shot demo stores; treated as intentional tradeoff, not re-argued without…
  • 🤝 r1-2 disputed — Successful begin masked as 500 when mail catcher fails: Begin still does await drainMail(composition) synchronously; SMTP failure still bubbles to 500 via mail-smtp.ts:smtpDialog. Fixing agent rebuttal: Azure/AWS use console catcher, local-docker drain-on-begin is accepted nit. Mail outbox remains durable; no new evidence to overturn tradeoff.
  • ✅ r1-3 fixed correctly — SMTP port NaN not validated before net.connect: Fixed. host.ts:31 parseMailpitSmtpPort validates integer 1-65535 and throws MAILPIT_SMTP_PORT must be…; mail-smtp.ts:76 validates options.port. Wired at host.ts:53. Covered by host.test.ts NaN/out-of-range throws.
  • ✅ r1-4 fixed correctly — Bench Ticket HTTP host does not map SupportDeskQueueCapacityError — a queue-capacity throw surfaces as HTTP 500 internal_error: Fixed. handler.ts:11 imports SupportDeskQueueCapacityError and handler.ts:270 maps to json(503,{error:'queue_unavailable'}). Test handler.test.ts:221 maps SupportDeskQueueCapacityError to 503 asserts.
  • 🤝 r1-5 disputed — Node adapter loses multi-Set-Cookie via Headers.forEach: Still host.ts:writeNodeResponse uses response.headers.forEach which concatenates multiple Set-Cookie with , . Handler currently sets at most one set-cookie so not exercised. Agent rebuttal: latent single-cookie case, not re-opening. No multi-cookie path added.
  • 🤝 r1-6 disputed — Cloudflare Worker composition cache ignores BENCH_TICKET_DB identity: Cache still worker.ts:35 compositionCacheKey = origin+secret only; D1 identity ignored. Agent rebuttal: rotation that matters is secret, D1 swap requires redeploy. Verified cache code unchanged except export.
  • 🤝 r1-7 disputed — Mailpit SMTP DATA missing dot-stuffing and adds extra blank line: SMTP DATA still mail-smtp.ts:97 ${body}\r\n. with no dot-stuffing and extra blank line. Current renderer never emits leading-dot lines. Agent rebuttal: demo body safe, not churning. Behavior unchanged.
  • 🤝 r1-8 disputed — Hard-coded weak email-code secret committed in repo: docker-compose.yml:18 still ships static CwsLC... secret. File comment says local-demo-only and cloud runbooks generate fresh randomBytes(32). No enforcement added; agent intentional local-demo tradeoff.
  • 🤝 r1-9 disputed — http origin allowed for any hostname, not just localhost: composition.ts:originParts still only checks url.origin===origin, allows http://prod.example. Cloud runbooks set https origins and handler.ts:sessionCookie sets Secure only for https. Agent: not tightening local http check this pass.
  • 🤝 r1-10 disputed — Node host trusts absolute req.url over configured origin: host.ts:requestFromNode still new URL(req.url ?? '/', origin) which trusts absolute req.url. Routing uses pathname only. Agent: pathname routing safe, not re-opening.
  • 🤝 r1-11 disputed — Missing request body size limit in readJson: handler.ts:readJson still await request.text() with no byte cap; limits enforced post-parse via SupportDesk. Agent: keeping existing Support Desk limits, no second cap.
  • 🤝 r1-12 disputed — New fixture calls @​pegma APIs that no other repo code exercises, so a drift breaks CI and the "CI-tested / green" claims: Bench-ticket is still sole consumer of several @​pegma packages. Guard is package.json:check includes tsc -p recipes/tsconfig.json and new vitest.bench-ticket.config.ts D1 tests; agent relies on that CI gate.
  • 🤝 r1-13 disputed — Offline eval pins (authorization- at 0.4.0, new entra entry) can diverge from live npm, silently degrading production plans while eval:assembly stays green*: EVAL_NPM pins remain offline harness pins per agent; live catalog uses fetchNpmLatestVersion. No registry divergence evidence presented; treated as harness vs live distinction.
  • ✅ r1-14 fixed correctly — Azure and AWS runbooks pass the email-code HMAC secret as a plaintext env var, contradicting the repo's own secret guidance: Fixed. Azure azure.md:118 --secrets "email-code-hmac=$SECRET" "storage-key=$KEY" plus secretref:email-code-hmac/secretref:storage-key (not plaintext env). AWS aws.md:146 RuntimeEnvironmentSecrets ARN map distinct from RuntimeEnvironmentVariables, with secretsmanager create-secret and teardown delete.
  • 19 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).

Workflow run

@FlyOverCoderKY
FlyOverCoderKY marked this pull request as ready for review September 11, 2026 21:39
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 11, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
🔒 Security Review ✅ Completed 2026-09-11T21:51:02.496637Z 9c87360 Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@FlyOverCoderKY
FlyOverCoderKY merged commit 02d6792 into main Sep 11, 2026
2 checks passed
@FlyOverCoderKY
FlyOverCoderKY deleted the cursor/environment-runbooks-0d5d branch September 11, 2026 22:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants