Repository navigation
refactor(gateway): flatten HTTP request stages - #127264
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: needs maintainer review before merge. Reviewed August 21, 2026, 12:08 PM ET / 16:08 UTC. ClawSweeper reviewWhat this changesThe PR changes the gateway HTTP router from Merge readiness✅ Ready for maintainer review Keep open. Current main still uses wrapper objects and Priority: P3 Review scores
Verification
Live VerificationCommand: Result: PASS (completed) Assertions:
How this fits togetherGateway HTTP requests enter one ordered router, where probe, core, plugin, and Control UI handlers either claim the request or fall through. Claimed work produces the response; unclaimed requests reach startup readiness and then the final 404. flowchart LR
A[HTTP request] --> B[Gateway router]
B --> C[Ordered route stages]
C --> D{Stage claimed request?}
D -->|yes| E[HTTP response]
D -->|no| F[Startup readiness]
F --> G[503 or 404 response]
Before mergeNone. Agent review detailsSecurityNone. PR surfaceSource -10. Total -10 across 1 file. View PR surface stats
Review metrics
Technical reviewBest possible solution: Retain the direct-callable representation, preserving the existing stage order and admission wrappers, once the draft is ready for normal maintainer review. Do we have a high-confidence way to reproduce the issue? Not applicable: this is a behavior-neutral refactor; direct source comparison and existing boundary tests establish the preserved contract. Is this the best way to solve the issue? Yes: representing a metadata-free stage as its callable directly is the narrowest maintainable cleanup and keeps the existing admission wrapper explicit. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 8531da19930d. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
|
|
Maintainer landing preflight is complete for exact head
Proceeding with the repository-native squash landing workflow. |
|
Merged via squash.
|
What Problem This Solves
The gateway HTTP router still wrapped every ordered request stage in a
{ run }object even though the stage contract no longer carries metadata. This residue from the earlier route-staging consolidation adds structure without owning behavior and makes the canonical short-circuit flow harder to scan.This is part of an explicitly maintainer-authorized, bounded refactor campaign.
Why This Change Was Made
The gateway HTTP request router now owns one canonical array of callable stages and invokes each callback directly. Admission remains an explicit wrapper only for admitted stages.
The change removes the object shell from the initial probe, MCP app, plugin-auth, and plugin-dispatch stages while preserving:
trueshort-circuit behaviorfalsefallthrough and exception propagation to the existing outer 500 handlerNo routes, error policy, tests, docs, changelog, config, protocol, or public surface changed. Production LOC is
+55/-65(net-10); tests are+0/-0.Open PR #119446 adds
cfg: configSnapshotinside the unchanged plugin authorization call. Its exact one-line semantic delta remains compatible with this callable flow; the deterministic combined resolution contains both changes and no additional behavior.User Impact
No user-visible behavior changes. This only removes obsolete internal routing structure from the gateway HTTP owner.
Evidence
pnpm format src/gateway/server-http.tsnode scripts/run-vitest.mjs src/gateway/server-http.request-trace.test.ts- 14 passednode scripts/run-vitest.mjs src/gateway/server-http.mcp-app-admission.test.ts- 8 passednode scripts/run-vitest.mjs src/gateway/server-http.probe.test.ts- 58 passednode scripts/check-changed.mjs -- src/gateway/server-http.ts- passed on Blacksmith Testboxtbx_01m0jg1wdx5jajp6225n3s9yqhgit diff --check0a1c4c117b80f48e56fe1519cbcce61e2fa1f6a0AI-assisted: yes.