Repository navigation
fix(mcp): inbox relay messages say the run's state and why it stopped - #95
chrisohearn wants to merge 3 commits into
Conversation
Codex Review Summary: ❌ FailedThis 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. |
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
Review of record: independent Claude Opus review of
|
Webhook event data carries state and stopReason, but the inbox relay body did not, so Jarvis could not tell a restart cancel from a real one on the inbox route. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… a blocker A run that fails over to a fallback model is not a blocker; webhooks and observeEvent already skip it. The relay queued thread.blocker/failed for it and then ignored the failover run, which has a new id. It now skips the failing-over run and follows the run that continues it (and that run's own failover), so the inbox gets the failover run's result. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
5e1958e to
2798f5d
Compare
Follow-up to #93 (merged as 7eddc7f). This is review P3 #1. Ledger key
r4/w2-restarts. No migration.Problem. Webhook and replay deliveries carry each event's
state, plusstopReasonfor runs (#84, #93). Messages relayed to a pinned inbox (McpEventRelaycollect) carried neither. On the inbox route, Jarvis therefore couldn't tell a restart cancel (server_shutdown/server_restart) from a real cancel without reading the source thread.Change. A new
relayEventState(event)adds the following to the relay body:state: the run status, the request status, ordetached;stopReason: for a cancelled or interrupted run that recorded one, the same value the webhook data carries. A rolled-back run that still holds an earlier stop gets none, as inMcpEvents.observeEvent.Replay bodies already embed the full event data, so they are unchanged.
Failover runs (coordinator's decision, same PR). The inbox relay now matches
observeEventand the webhook path:run.updatedwith a failover in progress (notskipped) queues no message. Before, the inbox got a falsethread.blockerwithstate: "failed"for a run that was actually moving to the fallback model.failoverOfRunIdis the bound run, including chained failovers, and relays that run's result. It saves the followed run id on the binding asrun_id. The binding id stays the hash of the original run.Tests.
McpEvents.test.ts, existing inbox relay case: the relayed body now assertsstate: "failed"and nostopReason.McpEvents.test.ts, new relay case: a run fails with a failover pending, then dispatched to a fallback run, which completes. The inbox gets onethread.run.resultfor the fallback run (state: "completed") and no blocker. This fails on the previous relay, which sent the blocker.McpEvents.test.ts, existing stop-reason case:relayEventStategivesserver_shutdownfor a restart cancel, nostopReasonfor a cancel without a stop, and none for a rolled-back run.Acceptance (read-only, after deploy). The next restart that cancels a relay-bound run puts a
[T3 event relay]message in Jarvis's inbox. Its JSON has"state":"cancelled","stopReason":"server_shutdown"(orserver_restart). To check from the database:Not run: the
mcp-tool-useeval. This only adds fields to a model-facing relay message, and the eval calls paid models.🤖 Generated with Claude Code