Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(clients): restart continuations show as a T3 Code notice, not another agent's message #17723

Mergedjuliusmarmingemerged 1 commit intomain fromrefs/pull/17723/headmerged by juliusmarminge View on GitHub

juliusmarmingecommented

Problem

After a server restart, T3 Code prompts each interrupted turn to continue. That prompt was stored as an ordinary user message created by the agent, so the timeline showed it as your own bubble labelled "Sent by another agent". Nothing else sent it.

Change

A restart continuation is now a T3 Code notice, shown the same way as background task and delegated task wakes.

  • Contract: notification sources gain a system kind. The source union already reads unknown kinds as background_task, so older clients show a generic row instead of failing.
  • Server: continueRestartedRun attaches a system notification to the continuation. The summary is "T3 Code restarted and resumed this turn", or "T3 Code restarted and stopped background work" when only background work was lost, and the detail is the prompt the agent received. The orchestrator only accepted notifications on queued messages; it now also accepts one on a restart continuation, which starts immediately to resume the cut turn. The text the provider receives is unchanged.
  • Web: a system notice uses the T3 icon and expands to the prompt.
  • Mobile: a system notice uses the bolt icon. Expanding any notification now shows its detail text instead of the item as JSON.
  • Older history: continuations already saved as user messages are labelled "Sent by T3 Code" instead of "Sent by another agent". Messages that MCP tools and providers send between threads keep "Sent by another agent".

Scope and approval

Maintainer request (Julius): restart notices should say they come from T3 Code, then should not show as a user message at all, but as a collapsed work log row like the background update rows. The automatic "Continue where you left off." after a usage limit resets is still stored as a user-authored message. Changing that changes how adapters and thread settlement treat the turn, so it is left for a separate PR.

Verification

  • apps/server: RestartContinuation.test.ts asserts the continuation carries the system notice with the prompt as detail. runtimeLayer.test.ts dispatches a restart continuation with the notice through the real orchestrator and asserts the run has a notification turn item and no user_message item, and that a retried or stale continuation still does not add a run. The restart note replay and delegated completion suites pass unchanged.
  • packages/contracts, packages/client-runtime (userMessage.test.ts: server-sent continuations get "Sent by T3 Code", MCP and provider messages still get "Sent by another agent"), apps/mobile (threadActivity.test.ts: a system notice expands to its prompt), and the apps/web timeline suites pass.
  • Typecheck is clean for contracts, client-runtime, provider-core, shared, provider-acp, web, mobile, and server.
  • Web, checked in the Browser panel against a dev database copied from real data. The thread is a real one where the server restarted mid-turn. "Before" runs the main client on the stored message. "After" runs this branch with the message stored the way this branch now writes it.

Before: the continuation is a user bubble, "Sent by another agent". Before: restart continuation shown as a user bubble labelled Sent by another agent

After: a collapsed work log row from T3 Code. After: collapsed work log row reading T3 Code restarted and resumed this turn

After, expanded: the prompt the agent received. After, expanded: the row shows Continue where you left off.

Not checked: the mobile change (icon and expanded detail text) has unit coverage but was not run in a simulator. I did not trigger a live server restart end to end; the server path is covered by the orchestrator test above.

Claude Opus 5.5 in Claude Code, driven from T3 Code.

🤖 Generated with Claude Code


Devin Review
    1. github-actions[bot](GitHub profile, opens in a new tab) added labelsvouch:trusted

    2. juliusmarminge added labelsmacroscope-review

    3. Approvability

      Verdict: Approved at 702cb0d

      Macroscope's review found this PR approvable — This is a focused restart-recovery bug fix that preserves agent-facing behavior while changing only the event attribution and work-log presentation across supported clients. The additive contract and orchestration changes are covered by targeted tests and do not alter product defaults or introduce sensitive or deployment-related behavior.

      You can add or adjust custom eligibility rules. [Learn more](https://docs.macroscope.com/approvability#example-custom-eligibility-rules).
    4. Thread transfer impact

      ✅ Thread transfer remains within every enforced ceiling.

      ProviderMetricMain baselineThis PRImpactPR ceiling
      CodexTotal thread wire5.0 KiB4.9 KiB−23 B (−0.5%)6.8 KiB✅
      CodexThread snapshot wire3.8 KiB3.8 KiB0 B (0.0%)4.9 KiB✅
      CodexLive turn WebSocket wire1.2 KiB1.2 KiB−23 B (−1.9%)2.0 KiB✅
      CodexLive turn WebSocket decoded20.9 KiB20.8 KiB−41 B (−0.2%)29.3 KiB✅
      CodexLive turn messages21−1 (−50.0%)8✅
      ClaudeTotal thread wire5.0 KiB5.0 KiB0 B (0.0%)6.8 KiB✅
      ClaudeThread snapshot wire3.8 KiB3.8 KiB0 B (0.0%)4.9 KiB✅
      ClaudeLive turn WebSocket wire1.2 KiB1.2 KiB0 B (0.0%)2.0 KiB✅
      ClaudeLive turn WebSocket decoded21.2 KiB21.2 KiB0 B (0.0%)29.3 KiB✅
      ClaudeLive turn messages220 (0.0%)8✅

      Baseline: fa9f936 · PR result: 702cb0d · 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.

    5. Review in Change Stack →Review in Change Stack →

      No actionable comments were generated in the recent review. 🎉

      ℹ️ Recent review info
      ⚙️ Run configuration
      • Configuration used: Path: .coderabbit.config.ts
      • Review profile: CHILL
      • Plan: Team
      • Run ID: a95af61b-38af-4730-8b8c-4ecf65bc23e0

      📥 Commits

      Reviewing files that changed from the base of the PR and between fa9f936ef5cbbe4bd4f9890b638766fc92f45075 and 702cb0d812f5804dc7e0b094c6a15f570ad2d1bc.


      📒 Files selected for processing (12)
      • apps/mobile/src/features/threads/ThreadFeed.tsx
      • apps/mobile/src/lib/threadActivity.test.ts
      • apps/mobile/src/lib/threadActivity.ts
      • apps/server/src/orchestration-v2/Orchestrator.ts
      • apps/server/src/orchestration-v2/RestartContinuation.test.ts
      • apps/server/src/orchestration-v2/RestartContinuation.ts
      • apps/server/src/orchestration-v2/runtimeLayer.test.ts
      • apps/web/src/components/chat/MessagesTimeline.tsx
      • packages/client-runtime/src/state/threadExecution.ts
      • packages/client-runtime/src/userMessage.test.ts
      • packages/client-runtime/src/userMessage.ts
      • packages/contracts/src/orchestrationV2.ts

      Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.



      📝 Walkthrough

      Walkthrough

      The change adds explicit message attribution for automation, agents, and T3 Code. Restart continuations now dispatch system notifications with a summary and prompt detail. Client views handle the new notification source and display its detail.

      Changes

      T3 Code attribution and restart notifications

      Layer / File(s)Summary
      Resolve and display message attribution
      packages/client-runtime/src/userMessage.ts, packages/client-runtime/src/userMessage.test.ts, apps/mobile/src/features/threads/ThreadFeed.tsx, apps/web/src/components/chat/MessagesTimeline.tsx
      The resolver returns automation, agent, t3code, or null attribution. Mobile and web views use that value to select message labels.
      Dispatch restart notifications
      packages/contracts/src/orchestrationV2.ts, apps/server/src/orchestration-v2/RestartContinuation.ts, apps/server/src/orchestration-v2/Orchestrator.ts, apps/server/src/orchestration-v2/RestartContinuation.test.ts, apps/server/src/orchestration-v2/runtimeLayer.test.ts
      The notification source contract adds system. Restart continuations dispatch a system notification with an outcome, summary, and continuation text as detail. Dispatch validation permits these notifications with start_immediately.
      Present system notifications
      apps/mobile/src/lib/threadActivity.ts, apps/mobile/src/lib/threadActivity.test.ts, apps/web/src/components/chat/MessagesTimeline.tsx, packages/client-runtime/src/state/threadExecution.ts
      System notifications receive their corresponding icons. Notification detail is returned when no read paths are available, and system notifications do not resolve to child thread IDs.

      Priority: ⬇️ Low

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

      Change: Bug fix

      Sequence Diagram(s)

      sequenceDiagram
        participant RestartContinuation
        participant Orchestrator
        participant RuntimeTurnItems
        participant MessagesTimeline
        RestartContinuation->>Orchestrator: Dispatch continuation with system notification
        Orchestrator->>RuntimeTurnItems: Process continuation command
        RuntimeTurnItems->>MessagesTimeline: Provide notification turn item with summary and detail

      Suggested reviewers: maria-rcks, t3dotgg


      Merge Risk: ⚪ Minimal · up to 702cb

      The restart notice and message attribution changes are ready to merge after normal checks.

      Pre-merge checks | Passed 4
      ✅ Passed checks (4 passed)
      Check nameStatusExplanation
      Title checkPassedThe title clearly and concisely describes the main change: restart continuations now appear as T3 Code notices instead of agent messages.
      Description checkPassedThe description includes all required sections, explains the problem and implementation, documents scope and approval context, and provides focused verification results, screenshots, and known limitat…
      Linked Issues checkPassedCheck skipped because no linked issues were found for this pull request.
      Out of Scope Changes checkPassedCheck skipped because no linked issues were found for this pull request.

      ✨ Finishing Touches
      📝 Generate docstrings
      • Commit to this branch
      • Create a new PR

      🧪 Generate unit tests (beta)
      • Commit to this branch
      • Create a new PR

      • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

      Comment `@coderabbitai help` to get the list of available commands.
    6. juliusmarminge merged thisa7223f3

    7. juliusmarminge closed this

Sign in to join this conversation.