Repository navigation
FIX-2162 (A: server + engine): interrupted read, status sessionId, createInProcessFetch - #3857
Conversation
The status read now answers the request's session id, and refuses a request the caller does not reach (callerReachesRequest), the check the abort and recovery routes already make. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01BLKy6E8CuEKEBwJURCEChf
…errupted list (FIX-2162) GET /users/:userId/interrupted-requests lists the user's interrupted request records on every call, whoever marked them; check-interrupted stays the trigger. Both listings share one admission rule (tenant, then the instance's own resolver, else the host rule). Both interrupted lists name the instance id, falling back to the flow kind (BP-030). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01BLKy6E8CuEKEBwJURCEChf
…162) The engine owns the one dispatch path: wait for the router (500 on init failure), pick the handler by method (405 otherwise), read the route from the URL's path under basePath (404 outside it), and hand the Request through. node's createServerApp delegates its catch-all to it and drops its own path derivation; health, dedicated routes, JSON errors and dispose stay in node. README entries and changeset. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01BLKy6E8CuEKEBwJURCEChf
|
The latest updates on your projects. Learn more about Vercel for GitHub. 3 Skipped Deployments
|
|
from: claude (issue-implement, FIX-2162 slice A) @codex review Please look hardest at these areas:
🤖 Generated with Claude Code https://claude.ai/code/session_01BLKy6E8CuEKEBwJURCEChf Generated by Claude Code |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Codex Review: Didn't find any major issues. Keep them coming! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
…stanceof (FIX-2162) createInProcessFetch checked `input instanceof Request`, so a host's Request from another class (here: a shift-manager test that installs happy-dom's globals, swapping the global Request out from under @hono/node-server's) was stringified to "/[object Request]" and answered 404. The node host now dispatches through this function, so every /api/flows call 404'd in that test. Recognize a Request by its string url and method instead. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01BLKy6E8CuEKEBwJURCEChf
|
CI: "Packed release installs and imports" is red, but not because of this PR. The job fails in
All other checks on d951088 passed; Kitchen-sink E2E is still running. I'll re-run the failed job once. Generated by Claude Code |
…removed Retry starts a new request (metadata.retryOf on the successor) and leaves the original interrupted, so it never drops off the listing. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01BLKy6E8CuEKEBwJURCEChf
…removed Retry starts a new request and leaves the original interrupted. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01BLKy6E8CuEKEBwJURCEChf
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 28daeb8e6b
ℹ️ 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".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
…ngifying it createInProcessFetch recognised a foreign-class Request only when no init was given; with any init it fell through to String(input), answered 404 and lost the headers and body. It is now rebuilt the way new Request(request, init) does, init's fields winning. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01BLKy6E8CuEKEBwJURCEChf
The problem
A caller that saved only a request id cannot continue that request after a crash. The continue and retry routes need the session, and the status read does not give it. The interrupted list from
check-interruptedshows only what that one call swept, so a request that a sweep marked first is lost to the caller. Also, a caller who runs FSD in their own process must start a web server to call it.What this does
This is slice A of FIX-2162: the server and engine side. It adds things only. No client or caller changes; slice B does those, stacked on this PR.
This PR builds the server parts of this figure: the fetcher on the right side (
createInProcessFetch) and the reads that a request object needs. The client in the figure is slice B.sessionId. It also appliescallerReachesRequest, the tenant and owner check that the abort and recovery routes already apply. Another tenant's request now returns 404.GET /api/flows/users/:userId/interrupted-requestslists the user'sinterruptedrequest records on each call. It does not sweep. It uses the same row rule as/active-requests(tenant, then the instance's own resolver, else user and organization).flowIdis on both interrupted lists. An old record without it usesflowKind(BP-030)./active-requestsdoes not change.createInProcessFetch(app, { basePath? })in@flow-state-dev/enginereturns a fetch function that calls the engine in this process.@flow-state-dev/node'screateServerAppnow sends its API requests through it. Now there is one dispatch path.What's asked of you
Nothing here is yours to decide. This implements the approved direction, and no new product decision came up.
Parts worth reviewing closely
From here, this is for the code reviewer.
packages/engine/src/routes/request-status-routes.ts). Before, any caller who passed the route guard could read any tenant's request status. Now a caller in another tenant gets 404. A caller that reads status without the tenant header that it used to send will now get 404. I did not find such a caller, but I am not fully sure.packages/engine/src/routes/in-process-fetch.ts,packages/node/src/app.ts). Two differences from the old node code: (a) aRequestwith noinitgoes through unchanged, and a newRequestis made only wheninitis given; (b) a path outsidebasePathreturns 404. In node, Hono mounts atbasePath, so (b) does not change node behavior. Node's 70 tests did not change and pass.listingAdmitsinrecovery-routes.ts). I moved the/active-requestsrule into one function. The new read uses it too. The order of checks did not change.Fixes FIX-2162 (slice A of 2) · spec
specs/issues/FIX-2162/· spec review #3810 · goal checkgoals/client/does-every-job-with-one-client/needs the client, so it runs in slice B · slice B stacks on this PRHow to review this
Engineering calls
GET /users/:userId/interrupted-requests. The spec did not name it. It sits besidePOST /users/:userId/check-interrupted. If wrong: a rename in slice B before release, no other cost.flowIdoncheck-interrupted's list too, not only on the new read. The spec says "the interrupted list"; both lists now have the same entry shape. If wrong: one extra field.limit/offsetlater; additive.interruptedAtfalls back toupdatedAtfor a record that has nointerruptedAt.createInProcessFetch. It resolves against a fixed internal origin, and only the path is read, as the spec says.createInProcessFetch. Theapps/docspages in the spec's docs line (host adapters, connection resilience, the client tour) go with slice B, where the client'sfetcheruses this. I had no agent-dispatch tool in this run, so I wrote the README text; it is not a docs-writer/docs-editor pass.Verification
Red, then green, for each server behavior:
sessionId+ tenant check (engine/test/tenant-route-isolation.test.ts→ "request status rejects a cross-tenant requestId"). Red: 3 failed:expected { id: 'req_1', …(3) } to match object { id: 'req_1', sessionId: 's' }, andexpected 200 to be 404twice (other tenant, no tenant header). Green: 3 passed.engine/test/recovery-routes.test.ts→ "GET /users/:userId/interrupted-requests";engine/test/user-route-scoping.test.ts). Red: 6 failed: route parses asnot_found; readsexpected 404 to be 200; check-interrupted entry has noflowId; the scoping harness reportslist_interrupted_requestsis not user-addressed. Green: 59 passed across the three files.createInProcessFetch(engine/test/in-process-fetch.test.ts). Red: 7 failed,createInProcessFetch is not a function. Green: 7 passed (path under default and custombasePath, decoded segments, 405 incl. HEAD, 404 outsidebasePath, 500 on failed init, a real action and status read with no server).Request. Red: nodeserve()tests failed 5 (500 from HonoonError) when the fetch always made a newRequest. Green after the fix: node 70/70. The engine test "hands a Request with no init to the router untouched" pins it.Requestis recognised by shape (CI fix).createInProcessFetchnow recognises a host'sRequestby itsurl/methodstrings rather thaninstanceof, because test environments such as happy-dom replace the globalRequest. Regression test:engine/test/in-process-fetch.test.ts→ "hands over a Request from another class by its URL, not as a stringified object".Full runs on the final head:
pnpm --filter @flow-state-dev/engine test: 305 files, 4069 passed, 8 skipped.pnpm --filter @flow-state-dev/node test: 7 files, 70 passed. Note: in this session the shell exportedFSDEV_DEFAULT_MODEL=vercel/openai/gpt-5-nano, a form core now rejects, so everyFlowStateinit failed. I ran node tests with that variable unset. It is an environment issue, not this change.pnpm --filter @flow-state-dev/{engine,core,node} typecheck: exit 0.Changeset:
.changeset/interrupted-read-in-process-fetch.md(engine minor, core minor). Node has none: what it serves does not change.Generated by Claude Code