Skip to content

fix(server): queue background notifications during active tools - #15892

Merged
Yash-Singh1 merged 2 commits into
mainfrom
t3code/queue-background-notifications
Oct 5, 2026
Merged

Yash-Singh1 merged 2 commits into
mainfrom
t3code/queue-background-notifications

Conversation

@Yash-Singh1

@Yash-Singh1 Yash-Singh1 commented Oct 5, 2026 •

Copy link
Copy Markdown
Collaborator

Automatic child-completion notices and scheduled prompts could interrupt Claude's pending tools. Claude then returned cancellation text that the parent model interpreted as a user refusal.

Keep Claude child-completion notices in T3's durable queue by recording that its native steering cancels pending tools. Bound scheduled prompts also queue behind active work. Explicit user steering retains its immediate behavior. Preserve native per-tool non-execution metadata and project cancelled calls as cancelled, distinct from permission denials.

For Claude, completionWake: always now delivers after the active run finishes. Existing delivery identities, deduplication, and recovery remain in use.

Validation after merging current main:

  • 223 focused tests passed across nine files, including the Bash command plus four pending status reads, child-completion and scheduled delivery, explicit steering, permission denials, completion races, recovery, and upstream background-work Stop behavior.
  • Server and contracts typechecks passed.
  • Targeted lint passed with two existing unused-variable warnings.

The regression replays the captured native frame shapes and Claude's queue-abort behavior through the real T3 services and adapter. It does not run a live Claude session. The live T3 database and installed application were untouched.

Closes #15351

Model: GPT 6.1 Sol. Harness: Codex.

- Preserve Claude's native tool cancellation metadata and avoid interrupting active tools for automatic deliveries
- Queue scheduled prompts for their bound thread
@github-actions github-actions Bot added the vouch:trusted PR author is trusted by repo permissions or the VOUCHED list. label Oct 5, 2026
@juliusmarminge juliusmarminge added the macroscope-review Opt PRs made by unvouched contributors in for Macroscope review. Vouched contributors auto-reviews label Oct 5, 2026
@github-actions github-actions Bot added the size:M 30-99 changed lines (additions + deletions). label Oct 5, 2026
@macroscopeapp

macroscopeapp Bot commented Oct 5, 2026 •

Copy link
Copy Markdown
Contributor

Approvability

Verdict: Not approved

Macroscope's review found this PR not approvable — This PR changes scheduled prompts from automatic dispatch to queued dispatch and alters Claude's active-tool steering behavior, affecting production orchestration semantics. The scheduled-task default change requires human review.

No code changes detected at f3f6efd. Prior analysis still applies.

You can add or adjust custom eligibility rules. Learn more.

@github-actions

github-actions Bot commented Oct 5, 2026 •

Copy link
Copy Markdown
Contributor

Thread transfer impact

✅ Thread transfer remains within every enforced ceiling.

Provider Metric Main baseline This PR Impact PR ceiling
Codex Total thread wire 5.0 KiB 5.0 KiB 0 B (0.0%) 6.8 KiB ✅
Codex Thread snapshot wire 3.8 KiB 3.8 KiB 0 B (0.0%) 4.9 KiB ✅
Codex Live turn WebSocket wire 1.2 KiB 1.2 KiB 0 B (0.0%) 2.0 KiB ✅
Codex Live turn WebSocket decoded 20.9 KiB 20.9 KiB 0 B (0.0%) 29.3 KiB ✅
Codex Live turn messages 2 2 0 (0.0%) 8 ✅
Claude Total thread wire 5.0 KiB 5.0 KiB +41 B (+0.8%) 6.8 KiB ✅
Claude Thread snapshot wire 3.8 KiB 3.8 KiB 0 B (0.0%) 4.9 KiB ✅
Claude Live turn WebSocket wire 1.2 KiB 1.2 KiB +41 B (+3.4%) 2.0 KiB ✅
Claude Live turn WebSocket decoded 21.2 KiB 21.2 KiB +41 B (+0.2%) 29.3 KiB ✅
Claude Live turn messages 1 2 +1 (+100.0%) 8 ✅

Baseline: a1d9d72 · PR result: f3f6efd · Source CI: success

Scenario and decoded snapshot size

10 historical turns, 5 command tools per turn, 878.9 KiB retained MCP result per historical turn, and a 1.05 MiB retained result in the measured turn.

  • Codex decoded thread snapshot: 108.5 KiB
  • Claude decoded thread snapshot: 108.8 KiB

Updated in place by a trusted workflow. PR artifacts are strictly validated and never executed.

@coderabbitai

coderabbitai Bot commented Oct 5, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository: pingdotgg/t3code/.coderabbit.yaml
  • Review profile: CHILL
  • Plan: Team
  • Run ID: efa4da68-5df0-4efa-8b7d-13646594a679
📥 Commits

Reviewing files that changed from the base of the PR and between 8dd73ca and f3f6efd.

📒 Files selected for processing (3)
  • apps/server/src/orchestration-v2/Adapters/ClaudeAdapterV2.test.ts
  • apps/server/src/orchestration-v2/Adapters/ClaudeAdapterV2.ts
  • apps/server/src/orchestration-v2/Orchestrator.ts

Included review availability: This review used your included allowance. 8 included reviews remain after this review. Your included PR review attempts over the past 7 days set your current allowance at 10 reviews per hour.


📝 Walkthrough

Walkthrough

The Claude adapter now records native tool non-execution metadata and marks cancelled tool results. Orchestration uses provider capability information when selecting delegated-completion delivery behavior. Scheduled prompts to existing threads use queue mode. Tests cover adapter results, steering behavior, and delivery scenarios.

Changes

Claude orchestration

Layer / File(s) Summary
Claude tool metadata
packages/contracts/src/orchestrationV2.ts, apps/server/src/orchestration-v2/Adapters/ClaudeAdapterV2.ts, apps/server/src/orchestration-v2/Adapters/ClaudeAdapterV2.test.ts, packages/contracts/src/orchestrationV2.test.ts
Turn items support optional toolNonExecutionKind, and turn capabilities support activeSteeringInterruptsTools. The Claude adapter reads SDK metadata and marks tool results cancelled when the kind is cancelled. Tests cover metadata values, contract round-tripping, and permission refusals.
Steering and queued delivery
apps/server/src/orchestration-v2/Orchestrator.ts, apps/server/src/scheduledTasks/ScheduledTaskService.ts, apps/server/src/orchestration-v2/SteeringCompletion.integration.test.ts
Delegated-completion dispatch excludes providers whose active steering interrupts tools. Scheduled prompts to existing threads use queue mode. Steering completion tests include interrupting native steering.
Delivery and interruption integration coverage
apps/server/src/orchestration-v2/ClaudeAutomaticDelivery.integration.test.ts
The integration test replays Claude messages for child completion, scheduled delivery, and user steering. It checks tool-result status and metadata, delivery outcomes, deduplication, and recovery.

Priority: ➖ Normal

Estimated code review effort: 3 (Moderate) | ~25 minutes

Change: Bug fix · Severity of issue fixed: Medium

Sequence Diagram(s)

sequenceDiagram
  participant User
  participant Orchestrator
  participant ScheduledTaskService
  participant ClaudeAdapterV2
  participant ClaudeSDK
  alt User steering
    User->>Orchestrator: Dispatch steer-active message
    Orchestrator->>ClaudeSDK: Offer priority-now message
    ClaudeSDK->>ClaudeAdapterV2: Return cancelled tool results and metadata
    ClaudeAdapterV2->>Orchestrator: Project cancelled items
  else Automatic delivery
    ScheduledTaskService->>Orchestrator: Dispatch existing-thread prompt in queue mode
    ClaudeSDK->>ClaudeAdapterV2: Return completed tool results
    ClaudeAdapterV2->>Orchestrator: Project completed tool items
    Orchestrator->>Orchestrator: Process queued delivery
  end
Loading

Suggested reviewers: juliusmarminge

Merge Risk: ⚪ Minimal · up to f3f6e

Claude background notifications are routed away from active steering during tool work. No merge-blocking issue is established by the available evidence.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 20.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 5 functions across 8 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Issue #15351 requires child-completion notices to reach the agent without cancelling pending tool calls. Claude now reports that active steering interrupts tools, and the orchestrator therefore avoids…
Out of Scope Changes check ✅ Passed The scheduled-prompt queue behavior, capability contract, cancellation metadata, and tests support the notification-interruption fix in #15351. The reviewed changes show no unrelated modifications.
Title check ✅ Passed The title clearly and concisely describes the main change: queueing background notifications while tools are active.
Description check ✅ Passed The description explains the problem, change, scope, and focused verification results. It links issue #15351, but it does not state maintainer approval or explain why the change qualifies for an excep…
  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Comment @coderabbitai help to get the list of available commands.

@Yash-Singh1

Copy link
Copy Markdown
Collaborator Author

Note

Generated by GPT 6.1 Sol

I am leaving CodeRabbit's 80% docstring-coverage suggestion unimplemented. The project's AGENTS.md asks comments to explain usage and constraints that are difficult to discover from the code. The new code already explains the undeclared SDK metadata and the native cancellation replay. Adding generic docstrings to meet a percentage would expand this fix without clarifying its behavior.

After merging current main, all 223 focused tests passed, along with the server and contracts typechecks. The PR description now records those results and the replay's limitations.

@Yash-Singh1
Yash-Singh1 merged commit 1beb035 into main Oct 5, 2026
30 of 31 checks passed
@Yash-Singh1
Yash-Singh1 deleted the t3code/queue-background-notifications branch October 5, 2026 04:31
sandscooling pushed a commit to sandscooling/t3code that referenced this pull request Oct 5, 2026
Upstream pingdotgg#15892 makes scheduled runs queue instead of steering, the fork's
68b5524 change, so the fork line, its test and README bullet are
dropped. PreviewAutomationBroker keeps the fork's host-reset reconnect
message on pingdotgg#15219's new scope shape. Silent breaks fixed: the settle cascade
moves to KeyedLock (pingdotgg#15577 deleted KeyedSerialExecutor), and the session
tools read the new McpInvocationScope thread, refusing a client outside one.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
github-actions Bot added a commit to omarcresp/t3code-flake that referenced this pull request Oct 5, 2026
## What's Changed
* fix(cli): reject accidental server launches by @maria-rcks in pingdotgg/t3code#15795
* feat(clients): reach one environment over several routes by @juliusmarminge in pingdotgg/t3code#15467
* feat(clients): learn an environment's LAN and tailnet addresses by @juliusmarminge in pingdotgg/t3code#15468
* fix(server): share MCP tool presentation across providers by @juliusmarminge in pingdotgg/t3code#15475
* revert(chat): remove automatic file-link repair by @maria-rcks in pingdotgg/t3code#15824
* perf(web): validate monospace fonts when selected by @maria-rcks in pingdotgg/t3code#15642
* fix(server): expand home-relative media paths by @maria-rcks in pingdotgg/t3code#15618
* fix(server): recover Linux runtime directory for device hub by @maria-rcks in pingdotgg/t3code#12402
* fix(web): center icons in thread details icon buttons by @RakshithBhat03 in pingdotgg/t3code#15669
* fix(mobile): back from an agent's thread returns to its parent by @AKolenda in pingdotgg/t3code#15068
* fix(dev): worktree setup never deletes a real env file by @juliusmarminge in pingdotgg/t3code#15845
* fix(server): drop the duplicate Option import that breaks main CI by @juliusmarminge in pingdotgg/t3code#15847
* fix(dev): write bootstrap warnings directly to stderr by @maria-rcks in pingdotgg/t3code#15865
* fix(mobile): a message that fails to send now says why in the thread by @shivamhwp in pingdotgg/t3code#15807
* fix(server): queue background notifications during active tools by @Yash-Singh1 in pingdotgg/t3code#15892
* refactor(server): share one keyed lock that releases idle keys by @juliusmarminge in pingdotgg/t3code#15577


**Full Changelog**: pingdotgg/t3code@v0.0.46-nightly.20261004.2657...v0.0.46-nightly.20261005.2667

Upstream release: https://github.com/pingdotgg/t3code/releases/tag/v0.0.46-nightly.20261005.2667
github-actions Bot added a commit to davidvanderklay/t3code-flake that referenced this pull request Oct 5, 2026
## What's Changed
* fix(cli): reject accidental server launches by @maria-rcks in pingdotgg/t3code#15795
* feat(clients): reach one environment over several routes by @juliusmarminge in pingdotgg/t3code#15467
* feat(clients): learn an environment's LAN and tailnet addresses by @juliusmarminge in pingdotgg/t3code#15468
* fix(server): share MCP tool presentation across providers by @juliusmarminge in pingdotgg/t3code#15475
* revert(chat): remove automatic file-link repair by @maria-rcks in pingdotgg/t3code#15824
* perf(web): validate monospace fonts when selected by @maria-rcks in pingdotgg/t3code#15642
* fix(server): expand home-relative media paths by @maria-rcks in pingdotgg/t3code#15618
* fix(server): recover Linux runtime directory for device hub by @maria-rcks in pingdotgg/t3code#12402
* fix(web): center icons in thread details icon buttons by @RakshithBhat03 in pingdotgg/t3code#15669
* fix(mobile): back from an agent's thread returns to its parent by @AKolenda in pingdotgg/t3code#15068
* fix(dev): worktree setup never deletes a real env file by @juliusmarminge in pingdotgg/t3code#15845
* fix(server): drop the duplicate Option import that breaks main CI by @juliusmarminge in pingdotgg/t3code#15847
* fix(dev): write bootstrap warnings directly to stderr by @maria-rcks in pingdotgg/t3code#15865
* fix(mobile): a message that fails to send now says why in the thread by @shivamhwp in pingdotgg/t3code#15807
* fix(server): queue background notifications during active tools by @Yash-Singh1 in pingdotgg/t3code#15892
* refactor(server): share one keyed lock that releases idle keys by @juliusmarminge in pingdotgg/t3code#15577


**Full Changelog**: pingdotgg/t3code@v0.0.46-nightly.20261004.2657...v0.0.46-nightly.20261005.2667

Upstream release: https://github.com/pingdotgg/t3code/releases/tag/v0.0.46-nightly.20261005.2667
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

macroscope-review Opt PRs made by unvouched contributors in for Macroscope review. Vouched contributors auto-reviews size:M 30-99 changed lines (additions + deletions). vouch:trusted PR author is trusted by repo permissions or the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Delegated-task notifications cancel queued Claude tool calls and tell the agent the user refused

2 participants