Skip to content

feat(mcp): queue standing, snooze-respecting sends, scheduled model changes, clearer delegate and thread-id errors - #94

Merged
chrisohearn merged 16 commits into
integration/mcp-events-20261109from
r4/mcp-tool-reliability
Nov 13, 2026
Merged

chrisohearn merged 16 commits into
integration/mcp-events-20261109from
r4/mcp-tool-reliability

Conversation

@chrisohearn

@chrisohearn chrisohearn commented Nov 13, 2026 •

Copy link
Copy Markdown
Owner

Round four, items 11, 11b, 14, 15 and 16 (ledger r4/w4-tools). MCP tools failed or gave no useful feedback in five places where agents, mostly Jarvis, kept hitting them.

In every acceptance check, <deploy_ms> is the deploy time in epoch milliseconds.

16. t3_thread_result and t3_thread_read accept links and bare mcp: uuids

Evidence. Jarvis's ChatGPT sign-in (4d4ef9ba) got thread_not_found 27 times. The log stores no arguments, but request and response sizes identify the calls exactly:

  • 18 calls: 67-byte requests with 262-byte replies. Those are a bare 36-character uuid plus maxChars, answered with the existing "Did you mean mcp:<uuid>?" hint. The mcp: thread existed, and Jarvis retried anyway, in parallel bursts right after portfolio_status.
  • 9 calls: 71-byte requests with 209-byte replies. Those are mcp:<uuid> with no live match. These remain open (see below).
  • Likely source of the bare uuids: outside clients get hosted links, which escape mcp: as mcp%3A, and a model drops that part. This is not verified.
  • No link-shaped ids appear in the failing calls.

Change. A new fork-only file, apps/server/src/mcp/threadReference.ts, resolves what was passed:

  • the exact id, t3-thread:// v1 and v2 links, and hosted /threads/<env>/<id> links (percent-escaped ids included);
  • a bare uuid as its mcp: thread, and the reverse.

Only these two read tools resolve; write tools keep their exact-id checks. When nothing resolves, the error names the problem:

  • a link to another environment says to pass that environmentId;
  • a deleted thread is called deleted;
  • otherwise the error names up to three closest ids, or points to t3_environment_links and t3_thread_search.

mcp:launch: ids already worked (106-byte requests succeed), and a test now covers them. The 9 unexplained misses stay open with no argument logging added: the new replies have distinct sizes ("deleted", "Closest", "not in this environment"), so response_bytes will show which case they are.

Tests. threadReference.test.ts covers every reference shape, a link to another environment, deleted, closest and unknown ids. OrchestratorMcpService.test.ts is updated for the new messages.

Acceptance (read-only):

sqlite3 -readonly ~/.t3/userdata/statev2.sqlite "select tool, count(*) calls, sum(error_class='thread_not_found') not_found, sum(error_class='thread_not_found' and response_bytes=262) bare_uuid_hints from mcp_request_log where tool in ('t3_thread_result','t3_thread_read') and started_at > <deploy_ms> group by tool"

Pass: bare_uuid_hints is 0, and the not_found share is well under the earlier 7.5% (20 of 341 overall).

11. t3_thread_send reports where a queued message waits

Evidence. Waits come from queueing behind a busy run on the same thread: p50 is 17–19 minutes and p90 is 47–49. Idle starts take under 3 seconds at p90. Senders had no way to see this.

Change. When a send queues, the result gains an optional queue field:

  • position (1 starts next) and messagesAhead;
  • activeRunId and activeRunAgeSeconds;
  • held when the queue waits for a resume.

The order is the real delivery order, with automatic task completions first. The server reads only active and queued runs and their user messages. A failed read only leaves the field out, because the message is already queued. t3_thread_post is not affected: post-only messages never create a run, so they never queue. Linked peers pass the field through, since RemoteDelegation.followUp spreads the result.

Tests. queueStanding.test.ts covers order, completion priority, held queues, no active run and a missing run. OrchestratorMcpService.test.ts covers the wiring and filters at a fixed clock.

Acceptance. This one can't be read from the database. Check the next queued t3_thread_send to the Jarvis inbox while it runs: the result has queue.position, queue.messagesAhead and queue.activeRunAgeSeconds.

11b. Agent sends and posts keep a thread's snooze

Evidence. On 2026-11-13 a worker's evidence handoff woke two threads with dated holds, snoozed until 11-18 and 11-24 (thread.unsnoozed at 02:21:12Z and 02:21:16Z, actor server). Nobody had released those holds. Every message.dispatch that wasn't an automatic wake ended the snooze, post-only messages included.

Change.

  • Orchestrator: message.dispatch gains respectSnooze. On a snoozed thread:
    • a post is recorded and the thread stays snoozed;
    • a turn is queued, held behind the thread's last run and marked snoozeDeferred, and the snooze stays.
    • Snoozing again is allowed with such a turn queued.
  • Release: a fork-only sweep, SnoozeDeferredDelivery, resumes the queue once the snooze ends or someone wakes the thread. It uses the scheduler and DueHint, like UsageLimitRecoveryWorker, and the partial queued-runs index keeps the query cheap.
    • Any release (queue.resume, or an app message releasing held runs) clears the flag, so a later failure hold is never released by the sweep.
    • releaseUnattendedHolds and the preparation-retry release skip deferred turns, so a background run finishing during the snooze can't start them early.
    • Held runs survive a restart: recovery keeps held queued runs, flag included.
  • What still wakes: a thread that has never run, and a snooze the server set itself until a usage limit resets (snoozeLimitedThreads is on live). Those aren't anyone's hold.
  • MCP: t3_thread_send, t3_thread_post and t3_thread_send_attachments default to respectSnooze: true. Send and post results carry snoozedUntil and a warning, read from the thread after the dispatch, saying whether it was held, recorded, joined the running turn, or ended the snooze. respectSnooze: false keeps the old waking behavior.
  • App sends are unchanged: a person's message wakes the thread, as before.

Why the MCP default is to respect the snooze. A snooze is a person's dated hold. The incident shows agents ending it with no intent to: relays, handoffs and supervisor nudges. An agent that must wake a thread can still say so with respectSnooze: false, and the warning tells every sender what happened. The cost: a sender waiting on a snoozed thread now waits until it wakes. Repeated sends, such as supervisor nudges, each add a held turn, and all of them run at wake; the supervisor should skip snoozed rows.

Tests.

  • runtimeLayer.test.ts: a held send and a post that keep the snooze, re-snoozing with a held turn, the real release query, and resume. A released turn loses its deferral.
  • SnoozeDeferredDelivery.test.ts: the sweep on the test clock releases at snooze end and on a manual wake, exactly once, plus wake-time selection.
  • OrchestratorMcpService.test.ts: the default, the override, and each warning.

Acceptance (read-only):

sqlite3 -readonly ~/.t3/userdata/statev2.sqlite "select count(*) from orchestration_v2_projection_runs where status='queued' and json_extract(payload_json,'$.snoozeDeferred')=1"
sqlite3 -readonly ~/.t3/userdata/statev2.sqlite "select count(*) from mcp_request_log where tool in ('t3_thread_send','t3_thread_post') and started_at > <deploy_ms>"

Pass: after deploy, no unexplained thread.unsnoozed events from agent sends on threads with a future snooze. Held turns appear in the first count while their threads sleep, and leave it after they wake.

Interaction with #93 (server notices keep a snooze). No double handling: the two paths cover disjoint messages.

After review (6b7205d):

  • Refused releases are retried. Each release attempt uses its own command id, so a refused queue.resume (a limited provider, say) is no longer replayed from its rejected receipt. A usage limit's resume also releases snooze-held turns once the thread is awake. Tested: the sweep retries a refused release with a new id and then succeeds.
  • "Snoozed" means what the sidebar shows. The orchestrator check and the sweep both use isSnoozed, so a thread that woke on an error or a request stops holding agent messages and gets them released. Tested: a thread that failed after its snooze is released before its date. isSnoozed moved to SnoozeState.ts, re-exported from ThreadSettlementService, to avoid an import cycle with Orchestrator.
  • Deleted ids: asking for a deleted thread by its exact id (mcp:X) reports it as deleted instead of answering with a live X.

14. t3_thread_configure can schedule a model change on a busy thread

Evidence.

  • The refusals: all 5 invalid_request errors from t3_thread_configure are the busy refusal on the Jarvis inbox. The 239-byte request matches {threadId: <inbox>, modelSelection: {codex_c12813c1…, gpt-6-luna, reasoningEffort: low}} byte for byte, and the 304-byte reply matches OrchestratorProviderSelectionBusyError.
  • Why a Codex effort change is refused: checked read-only, the inbox's live session runs in ~/.t3/worktrees/Codex Engineering Loop/t3-987e021a…. The thread's worktree path is ~/.t3/scratch/2026-11-12-this-thread-is-the-inbox-a1c87c23. That workspace mismatch makes the switch plan restart the session, which a busy thread refuses.
  • A hidden problem: queued runs carry a snapshot of their model. A change that did apply on a busy thread was silently undone as each queued run started.

Change. applyAt: "next_turn" on thread.model-selection.set and on t3_thread_configure:

  • On a busy thread, the orchestrator validates the switch plan and stores scheduledModelSelection (afterRunId, queuedThroughOrdinal) on the thread. It releases no session and applies nothing in-session.
  • Queued runs: runs queued through that ordinal follow the thread, the same way runs queued before a failover do (queuedRunFollowsThread). A run whose sender named a model keeps it (explicitModelSelection on the run), and later implicit sends take the schedule rather than that older pick.
  • Later sends: later implicit sends take it through queueTailModelSelection, and an idle start takes it too. Steers do not.
  • Clearing: the schedule clears on the first run start that leaves none of the earlier queued runs waiting. A regular model change also clears it, and scheduling the current model cancels it.
  • Idle threads apply the change at once, as before.
  • The tool:
    • returns {status: "scheduled", afterRunId, sequence};
    • a configuration read shows scheduledModelSelection;
    • the model and options are checked up front against the provider registry, because a bad value would otherwise fail each queued message in turn.
  • Refused: applyAt without modelSelection, applyAt with runtimeMode (runtimeMode rules are unchanged), and switching provider instance (provider.switch), which still needs an idle thread.

Known limits.

  • Queue hold: at the boundary, if the replaced session still runs background work, the existing queued-start rule holds the queue. This was already true for a model picked ahead of a queued message. Only the app's resume releases it, since t3_queue has no resume action. The acceptance check counts held runs on the inbox.
  • Messages sent from the app carry the composer's model, so a later app message starts with that model. Its explicit pick wins, as before. The user doc says so.
  • The session-restart variant is covered at schedule time (Orchestrator.control-reads.test.ts). At the boundary it uses the existing explicit-pick switch path; the runtime-layer harness has no live sessions to restart.

Tests.

  • Orchestrator.control-reads.test.ts: busy and idle, for both an instance switch and a session-restarting model change. The schedule is stored, and runs, sessions and outbox are untouched.
  • runtimeLayer.test.ts: two runs queued before a schedule and one after. Each starts with the new model, and the schedule clears after the last earlier run starts.
  • core.test.ts: the MCP result, the read view, and every refusal, including an unadvertised model.

Acceptance (read-only):

sqlite3 -readonly ~/.t3/userdata/statev2.sqlite "select count(*), sum(error_class is not null) from mcp_request_log where tool='t3_thread_configure' and started_at > <deploy_ms>"
sqlite3 -readonly ~/.t3/userdata/statev2.sqlite "select json_extract(payload_json,'$.modelSelection'), json_extract(payload_json,'$.scheduledModelSelection') from orchestration_v2_projection_threads where thread_id like 'mcp:launch:be52150e%'"
sqlite3 -readonly ~/.t3/userdata/statev2.sqlite "select count(*) from orchestration_v2_projection_runs where thread_id like 'mcp:launch:be52150e%' and status='queued' and json_extract(payload_json,'$.queueHeld')=1"

Pass, after Jarvis schedules a lower effort (item 37):

  • the configure call succeeds;
  • the inbox's modelSelection shows the new effort once a run has started, and scheduledModelSelection is null once the earlier queued runs have drained;
  • the held count is 0.

15. delegate_task errors name the field and the valid choices

Evidence. 6 of 24 calls failed, all in under 145 ms. The 240-second worst case is a normal mode: "wait", not an error. Matched by reply size:

  • 3 were the cross-project error "A local task runs in this thread's project…" (273 bytes);
  • 1 was "Pass target.projectId: this thread's project has no repository to match there." (215 bytes, from RemoteDelegation);
  • the 400-byte reply fits the worktree-isolation error, with its project title and path;
  • one 267-byte invalid_request stays unmatched.

Change. Each error now names the field and what is accepted:

  • cross-project: names both projects and says to use t3_thread_launch with projectId: "<id>";
  • unknown instance or driver: lists the registered ones, capped at 12;
  • unadvertised model: lists the model slugs (shared with t3_thread_launch);
  • driver/instance mismatch: says to pass only one of the two;
  • unresolvable worktree commit: names the checkout;
  • remote "no repository": points to t3_project_list with that environmentId.

Tests. The fork-only-driver delegation test is extended with the cross-project case, and the launch model test now expects the list.

Acceptance (read-only):

sqlite3 -readonly ~/.t3/userdata/statev2.sqlite "select error_class, count(*) from mcp_request_log where tool='delegate_task' and started_at > <deploy_ms> group by 1"

Pass: no repeated identical failures from one session. Each failure is followed by a corrected call or a t3_thread_launch.

Notes

  • Migration: none. New fields live in thread and run payload JSON, and optional fields need no migration.
  • Upstream files touched: Orchestrator.ts, ThreadManagementService.ts, runtimeLayer.ts, OrchestratorMcpService.ts, contracts/orchestrationV2.ts, contracts/orchestratorMcp.ts, the thread and attachment toolkit handlers, providerModels.ts, RemoteDelegation.ts, docs/user/outside-agents.md and docs/orchestration-v2/orchestrator-mcp-server.md. The new logic is in fork-only files: threadReference.ts, queueStanding.ts, snoozeNotice.ts and SnoozeDeferredDelivery.ts.
  • Agent context: the tool list grows by 270 bytes over the tip (57,258 to 57,528): applyAt, plus respectSnooze on send and post. Post's copy has no description, since its result warning explains it. agentContextBudget.json is updated. This needs the agent-context-increase label.
  • Decision record: docs/jarvis/decisions/0017-agent-sends-respect-snoozes-and-scheduled-model-changes.md covers the snooze default and applyAt: "next_turn". Its number is provisional and settled at merge.
  • Evals: not run. They need an Anthropic key or a Codex proxy, and neither is configured here; buying usage would need Chris's go-ahead. mcp-tool-use --context measured 74 tools. No existing case covers applyAt, respectSnooze or the new warning text. The fixes for items 16 and 11 are server behavior, which mocked eval tools can't exercise.
  • Checks: under the round-four resource rule (after the 03:37Z out-of-memory incident), I ran only focused checks locally, under the shared lock with two workers: the changed test files (178 tests), the touched runtime-layer cases and the apps/server typecheck, all passing. Before the rule, check:changed for items 11, 14, 15 and 16 passed (typecheck of 41 packages, 2,953 tests), and so did all of src/orchestration-v2 (2,789 tests). Hosted CI is the full gate.

🤖 Generated with Claude Code

@chrisohearn chrisohearn added the agent-context-increase Maintainer-approved growth in model-facing context for new tools label Nov 13, 2026
@chatgpt-codex-connector

Copy link
Copy Markdown
Codex Review Summary: ❌ Failed

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

Review Status Commit Review trigger
📝 Code Review ❌ Failed 2026-11-13T03:59:06.035094Z
We couldn’t complete this review. Comment @codex review to try again.
a566769 PR opened
ℹ️ 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.

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@chrisohearn chrisohearn left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

Independent Claude Opus review of 6b7205d (review of record)

Read-only review of the diff and source. No tests run (resource rule). The code matches a566769; 6b7205d adds only the 0017 decision record. GitHub reports MERGEABLE, with CI still pending.

P2

  • SnoozeDeferredDelivery.ts:105,118 with Orchestrator.ts:15445 and :15686/:15555: the sweep reuses the commandId snooze-deferred-release:<firstRunId>. When queue.resume is refused (for example "Continue the limited thread...", because a person snoozed a thread whose last run hit a usage limit), the refusal is saved as a rejected receipt. Every retry then replays that rejection, so the "retries in a minute" path is dead. The held turns stay held until someone acts in the app, because limit-resume (agent/server) does not release held runs. Fix: don't record this refusal, or derive the commandId per attempt. Add a test for a refused release.

P3

  • Orchestrator.ts:7003-7006: respectsSnooze checks the raw snoozedUntil, not isSnoozed(). A thread the sidebar shows as awake (woke on error, a pending request, a guest message) still holds agent sends until the stored date. The warning tells the sender, so this isn't blocking.
  • Orchestrator.ts:15449: the sweep's queue.resume releases every held queued run on the thread, including holds made for other reasons (a missing worktree, background work). That is the same as a manual resume, but worth knowing.
  • Orchestrator.ts:978,1005: runs queued before a schedule follow the scheduled selection even if they carry an explicit model pick. The doc covers only picks made after scheduling.
  • threadReference.ts:40: if mcp:X is deleted and a live X exists, X is returned silently instead of "deleted". In practice this is very unlikely.
  • Orchestrator.ts near :6995: this conflicts textually with #93 (git merge-tree confirms). The two changes are compatible: add #93's serverNotice to automaticWake and keep respectsSnooze. Because respectsSnooze requires !automaticWake, server notices keep the snooze under both. Whichever PR merges second resolves it.

Checks

  • (a) Links: non-T3 hosts fail to parse, and v2 or hosted links to another environment are refused. Lookups go only through getThreadShell in this environment. Reads have no per-thread grant, so nothing is widened. No path or SQL use of the input.
  • (b) Held turns persist in run payload, survive a restart (recovery keeps held queued runs), and stay out of releaseUnattendedHolds and the failure release. Every release path clears the flag. Release order is delivery order. The sweep is gated by DueHint and runs one grouped query per tick on the partial index. Usage-limit snoozes still wake (exact resetAt match, as limitRecovery sets it). The exception is P2.
  • (c) The schedule is stored in the thread payload, so it survives a restart. It clears on the first start with no earlier queued run, or on a regular change. It touches no runtimeMode: MCP refuses applyAt with runtimeMode, and provider.switch is refused.
  • (d) Error messages add ids, slugs, project paths and environment ids. No secrets. (e) Tool list +409 bytes (56426→56835); needs the agent-context-increase label. (f) No migration files; the new fields are optional JSON.

Verdict: no blocking findings

rallymewrx and others added 13 commits November 12, 2026 21:38
…mcp: uuids

18 of Jarvis's 27 thread_not_found results were bare uuids of mcp: threads,
likely from hosted links that escape mcp: as mcp%3A. Reads now resolve t3-thread:// v1
and v2 links, hosted links and bare uuids, say when a thread was deleted,
and name the closest ids otherwise.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A send that queues behind a busy run now returns its queue position, the
messages ahead of it, the active run and its age, and whether the queue
is held. Same-thread waits run 17 to 49 minutes, and senders had no way
to see why.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Three of six delegate_task failures in two days were a cross-project
target.projectId, whose error never said that t3_thread_launch with
projectId starts work in another project. That error now does, and the
provider, driver, model, worktree and linked-project errors name the
field at fault and list what is accepted.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…thread

The Jarvis inbox always has a run going, so every effort change was
refused as busy. With applyAt: "next_turn", the change is stored on the
thread and the next turn starts with it. Messages queued before it start
with it too, the way messages queued before a failover follow the
thread. It clears once none of those wait. Reading the configuration
shows the pending change, and scheduling the current model cancels it.
Provider instance switches and runtime mode changes still need an idle
thread.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…for outside agents

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A scheduled model or option that the provider rejects would fail each
queued message in turn, so configure now checks it before scheduling.
applyAt without modelSelection is now an error instead of a silent read.
Also tests the queue standing a queued send returns.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…heduled change

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
On 2026-11-13 a worker's handoff woke two threads that were snoozed
until 11-18 and 11-24, because any send or post ended a snooze. Agent
sends and posts now leave a snoozed thread asleep by default. A send is
held behind the thread's last run until the snooze ends or someone
unsnoozes it, and a post is only recorded. Both results report
snoozedUntil with a warning, and respectSnooze: false keeps the old
waking behavior. Messages sent from the app still wake the thread.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A turn held for a snooze lost its hold whenever a later background run
completed, and nothing stopped a released turn that failed from being
released again by the sweep. Automatic releases now skip deferred turns,
and any release clears the deferral. Usage-limit snoozes, which the
server sets itself, still wake on a send. t3_thread_send_attachments
keeps the snooze too, and the snooze notice reflects the thread's state
after the send. The release sweep is now tested on the test clock.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… model changes (0017)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ed model picks

From the PR #94 review:
- A refused queue.resume left a fixed command id whose rejected receipt
  every retry replayed. Each release attempt now gets its own id, and a
  usage-limit resume releases snooze-held turns once the thread is awake.
- Snooze checks use isSnoozed, so a thread that woke on an error or a
  request stops holding agent messages. isSnoozed moves to SnoozeState.ts
  to avoid an import cycle.
- A scheduled model change leaves queued messages that named a model
  alone, and later sends take the change, not an older queued pick.
- A deleted thread asked for by its exact id is reported as deleted,
  not swapped for its bare uuid.
- Shorter respectSnooze and applyAt text: the tool list grows 270 bytes,
  not 409.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… tip

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@chrisohearn
chrisohearn force-pushed the r4/mcp-tool-reliability branch from 6b7205d to cfe85b0 Compare November 13, 2026 04:40
@chrisohearn

Copy link
Copy Markdown
Owner Author

Coordinator: the agent-context-increase label on this PR is now the maintainer's decision on record. +270 bytes for the queue, snooze and schedule options, after an independent review with no blocking findings; paid evals waived (no spend). Workers: please don't apply this label yourselves; it's reserved for the coordinator after review.

@chrisohearn chrisohearn left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

Independent delta review of cfe85b0 (review of record, follows 6b7205d review)

Read-only review of the diff and source; no tests run. A range-diff against 6b7205d shows the 11 rebased commits are unchanged apart from the #93 conflict in Orchestrator.ts and the budget number. The new commits are 146946f (the review fixes) and cfe85b0 (budget only). GitHub reports MERGEABLE, with CI pending (budget check passes).

  1. P2 fixed. SnoozeDeferredDelivery.ts:121 now uses snooze-deferred-release:<firstRunId>:<nowMs>, so each attempt gets its own command id and a refused queue.resume is retried every 60 s instead of replaying the rejected receipt. The test refuses snoozed once, then retries it and asserts that the two commandIds differ. releaseUnattendedHolds (:3246-3272) now releases snooze-deferred runs once isSnoozed is false and clears the flag, so a usage-limit resume releases them. No test covers that limit-resume path directly.
  2. P3s fixed. Snooze checks use isSnoozed (moved to SnoozeState.ts) in the send path, the release path and the sweep. The sweep also wakes on runtime-request.updated. Runs queued with a named model get explicitModelSelection and keep that model (test added). A deleted exact mcp: id now reports "was deleted" instead of resolving to its bare uuid (tests added).
  3. #93 resolution OK. serverNotice is declared at :6996, above the settle block. automaticWake = notification || delegatedCompletion || serverNotice (:7023-7026). The guard is if (snoozedUntil != null && !automaticWake && !respectsSnooze). A server notice is therefore an automatic wake: it keeps the snooze and is never held. The respectsSnooze block differs from 6b7205d only by the intended isSnoozed term.
  4. Budget OK: base 57258, head 57528, so +270 bytes (was +409).

Non-blocking (P3):

  • queueTailModelSelection: threadAtRunStart clears the scheduled change once only explicit-pick runs remain queued before it. If no send has been queued after the schedule, a new agent send in that window inherits the older explicit pick, not the scheduled model.
  • A respectSnooze: true send to a thread that isSnoozed shows as awake only because of a pending request or guest message now clears the stored snooze. The thread then does not re-snooze when the request resolves. Consider skipping the hold without unsnoozing.

Verdict: no blocking findings

rallymewrx and others added 2 commits November 12, 2026 22:02
… into tmp/r4-w4-94-on-tip

# Conflicts:
#	apps/server/src/orchestration-v2/Orchestrator.ts
#	apps/server/src/provider/agentContextBudget.json
#	packages/contracts/src/orchestratorMcp.ts
… held

Resuming a queue, an unfreeze included, released every queued run. That
included turns an agent's send held for a snooze that still holds the
thread. queue.resume now leaves those while the thread is snoozed. The
snooze sweep only resumes awake threads, so it still releases them. The
sweep also skips frozen threads, whose queue only an unfreeze resumes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

@chrisohearn chrisohearn left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

Independent merge-resolution check of b564470 (follows cfe85b0 review). Diff-only, blobless clone, no tests run.

  • Merge bfe4be4: --remerge-diff shows three conflicts (Orchestrator.ts, orchestratorMcp.ts, agentContextBudget.json) plus one extra edit (SnoozeDeferredDelivery.ts, $.frozen IS NULL). The other 29 #90 files match 7eddc7fc51..f0e6e4a325 line for line. Nothing from #90 or #94 was dropped (Orchestrator deletions = #90's own + the two resolved #94 lines).
  • (1) frozenHold = frozen && !postOnly, whatever automaticWake/respectSnooze say, so server notices and snooze-respecting agent sends queue held (queueBehindRun falls back to latestRun; queueHeld ORs respectsSnooze || frozenHold). startNextQueuedRun also returns early while frozen. Snoozed but unfrozen: only respectsSnooze sends are held.
  • (2) The sweep skips frozen threads, so nothing lifts a freeze except the gated unfreeze. b564470 makes queue.resume keep snoozeDeferred runs while isSnoozed, so an unfreeze does not release a hold for a snooze still in force. Releases after wake are unchanged, and unfreezing emits thread.* events, so the sweep checks the thread again. That is the intended split, and the new ThreadFreeze test covers it.
  • Note (non-blocking): this also covers a user's plain queue.resume on a snoozed thread, which used to release those turns. queued-run.start with a runId still starts one, because startNextQueuedRun picks it by id regardless of queueHeld.
  • Contracts: the send result keeps #90's held/frozen and #94's queue/...SnoozeNotice. Budget: base 57258, #94 +270, #90 +670, so 58198 is additive and consistent.
  • (4) No other changes: the merge has only those regions, and b564470 has only the queue.resume filter and its test.
    Verdict: no blocking findings

…ol-reliability

t3_thread_configure reads its configuration only when none of
modelSelection, runtimeMode, applyAt and acknowledgeOnly is given.
Budget re-measured on the tip.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

@chrisohearn chrisohearn left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

Independent merge-resolution check of c5992fb (follows b564470 check)

Read-only Claude Opus review run by the round-four coordinator. Codex hosted review is at its usage limit, so this is the review of record.

  • Worked from a fresh blobless clone. No tests run locally. GitHub CI on this head is all green, including Agent context budget, Typecheck, Lint and Test Server 1-8. GitHub reports MERGEABLE/CLEAN.
  • The merge parents are b564470 and a59003e. The old merge-base is f0e6e4a. The base side brings #86, #96 and #100.
  • git show --remerge-diff shows exactly three resolved regions: the t3_thread_configure read predicate in thread/handlers.ts, agentContextBudget.json, and one added line in core.test.ts. Nothing else changed beyond the clean merge.
  • I compared each changed file's diff on one side of the merge with its diff on the other side, in both directions. Outside those three regions every file matches. No #94 change is lost, and no #96, #86 or #100 change is dropped or altered.
  • Predicate (thread/handlers.ts:262-267): it reads only when modelSelection, runtimeMode, applyAt and acknowledgeOnly are all undefined. Nothing that sets a field falls into the read path. The read result has both scheduledModelSelection (#94) and acknowledgeOnly (#96).
  • Schema (thread/tools.ts): applyAt and acknowledgeOnly each appear once. There are no duplicate fields, and the success union order is still correct.
  • Write paths: acknowledgeOnly is handled first and refuses modelSelection and runtimeMode. runtimeMode plus applyAt, applyAt alone, and provider.switch plus applyAt are all refused.
  • Tests: the #94 busy-thread mock (core.test.ts:1380) gained the acknowledgeOnly read. The #96 and PeerForwarding mocks already had it. I found no other stale mock.
  • Budget: 57928 at the old base, plus 270 (#94) and 133 (#96), gives 58331, which matches the JSON. The two PRs edit different parts of the configure tool, so the sum is exact. The agent-context-increase label is approved.

P1: None. P2: None.

P3 (follow-up, not blocking): thread/handlers.ts:129 (configureAcknowledgeOnly) does not refuse applyAt. {acknowledgeOnly: true, applyAt: "next_turn"} sets the mode now and silently ignores applyAt. Only combining the two PRs makes this pair possible. Nothing wrong is written. Fix: add || input.applyAt !== undefined to that guard, plus one refusal case in the configure test.

Verdict: merge

chrisohearn pushed a commit that referenced this pull request Nov 13, 2026
… model for default turns

From the PR #94 delta review:
- A default agent send to a thread that counted as awake only because of
  a pending request, guest message or error erased its dated snooze. It
  now delivers and keeps the stored snooze. So does a thread that has
  never run. The send's warning says it was delivered.
- A scheduled model change was cleared once only explicit picks were
  ahead of it, so a later default message got the older pick. It now
  stays until a default-model turn starts with it, after everything
  queued before it, and a model named after the change replaces it.
- Tests: a later completed run, such as a usage limit's resume,
  releases snooze-held turns only once the thread is awake.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@chrisohearn
chrisohearn merged commit 060bd88 into integration/mcp-events-20261109 Nov 13, 2026
19 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agent-context-increase Maintainer-approved growth in model-facing context for new tools

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants