Repository navigation
fix(mothership): skip the 30s workflow pickup wait when no chat view is reading - #10148
Conversation
…is reading A client-routed workflow tool waited 30s for a chat view to pick it up before the server ran it, even when no view was reading the turn's stream at all (tab closed, user on another chat or page). Dispatch now checks whether the send's own response is still attached or a reconnected reader holds a short-lived Redis mark; with neither, it waits only 5s for a view that is re-attaching. A present view keeps the full grace, and an unknown (no Redis, failed read) counts as present.
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
[Medium impact] The reviewed changes appear safe to merge. SummaryThis PR shortens workflow pickup waits when no chat view is reading and tracks reconnected readers across servers.
No new actionable issues found. waleedlatif1 kept the pickup tests as intentional timing unit tests, with reader behavior covered separately against real Redis. Greptile withdrew the earlier testing finding. Reviews (4) · Last reviewed commit: "fix(mothership): clear a reader's mark w..." · Reviewed by Greptile |
There was a problem hiding this comment.
All reported issues were addressed across 10 files
Reply with feedback, questions, or to request a fix.
Turn on auto-fix | Re-trigger cubic
…fore its first event Each reconnect attachment now holds its own entry in a per-stream sorted set, removed on release, so leaving stops counting at once instead of lingering until the TTL. The route awaits the first mark before reading, and the Redis suite skips when no test Redis is configured locally.
|
@cubic-dev-ai review this PR |
@waleedlatif1 I have started the AI code review. It will take a few minutes to complete. |
|
@cubic-dev-ai review this PR |
@waleedlatif1 I have started the AI code review. It will take a few minutes to complete. |
Summary
run_workflow,run_block,run_from_block,run_workflow_until_block) waited a fixed 30s for a chat view to claim them before the server ran them, even when nothing was reading the turn's stream (tab closed, user on another chat or page). Roughly a third of client-routed workflow calls hit this wait and then ran server-side anyway.mothership_stream:<streamId>:viewers, scored by when it lapses, refreshed every 3s, 10s TTL); release removes it, and each refresh drops lapsed members.Type of Change
Testing
handlers.test.ts: no view → server claims at 5s; view present → not claimed before 30s; view re-attaching during the short grace → not claimed before 30s. The first and third fail on the code they fix.start.test.ts: the send counts as viewed while its response is attached and defers to reader presence once it disconnects (fails if the in-process signal is inverted).viewer.integration.ts(real Redis): attached reader visible after its hold resolves, untouched stream not, another attached reader keeps a stream counted, a released reader stops counting at once and never re-marks.workflow-client-fallback.test.tsandapp/api/copilot/chat/stream/route.test.tslocally; biome on changed files. Full type-check and audits left to CI.Checklist
test-auditauthoring gate)