Skip to content

feat(server): thread shells carry each agent's latest tool action - #21

Merged
OmarAlex24 merged 4 commits into
feat/milestones-tracefrom
feat/milestones-last-action
Nov 11, 2026
Merged

OmarAlex24 merged 4 commits into
feat/milestones-tracefrom
feat/milestones-last-action

Conversation

@OmarAlex24

@OmarAlex24 OmarAlex24 commented Nov 11, 2026 •

Copy link
Copy Markdown
Owner

Problem

The milestone map needs to say what each agent did last: "Edited src/auth/refresh.ts", "Ran command · pnpm test", "Asked for a secret". Thread shells only carried the latest visible message. A client would have had to load every agent's transcript to find its last step.

Fix

The data.

  • Thread shells gain an optional latestAction with summary, detail and at. It is the thread's most recent tool step (command, file change, file search, web search or MCP tool), labelled the way the chat's work log labels it.
  • T3's own MCP tools read as actions, such as "Asked for a secret", "Delegated a child task" and "Marked a milestone". Other MCP tools lose their mcp__server__ prefix.
  • ProjectionStore finds it with one indexed lookup per shell. Fork migration 4 adds the partial index orchestration_v2_projection_turn_items_latest_tool_idx on tool items.

Keeping it current without extra traffic.

  • A subagent's shell refreshes when one of its tools finishes. Streaming output and running or pending tools still stay off the shell stream.
  • Thread rows read the quiet shell. While a run streams, latestAction is overlaid like the item counts, so a new action doesn't re-render quiet rows mid-run.

Notes

  • Traffic. In a real Haiku run with two delegated agents, this added about 6 shell publishes in total, one per finished subagent tool.
  • Cancelled tools. A cancelled T3 tool reads as if it completed. The label names the action, not its outcome.
  • Pull requests. A linked PR reads "Linked a pull request", without its number.
  • Older servers. The field is optional on the wire, so older servers just show no action.

Test plan

  • latestAction.test.ts table: searches, reads, T3 MCP tools ("Marked a milestone", "Asked for a secret", "Failed to delegate a child task"), other MCP tools with the prefix stripped, and reasoning or messages reading null
  • ProjectionStore.test.ts: shells carry the latest tool action, both from the shell list and from the projection
  • ShellStream.test.ts: a subagent's tool publishes its shell when it completes or fails, not while it runs
  • threadShell.test.ts: the existing quiet-shell case now also changes latestAction mid-run and still holds
  • ForkMigrations.test.ts: the fork history includes migration 4
  • Dev app with real Haiku agents: a finished agent showed "Ran command · ls src/orchestration-v2 | wc -l", and one that asked showed "Asked for a secret"

Built with Claude Opus 5.5 in Claude Code.

🤖 Generated with Claude Code

@OmarAlex24
OmarAlex24 added this pull request to stack #24 November 11, 2026 19:11
@github-actions github-actions Bot added the vouch:trusted PR author is trusted by repo permissions or the VOUCHED list. label Nov 11, 2026
@OmarAlex24 OmarAlex24 changed the title feat/milestones last action feat(server): thread shells carry each agent's latest tool action Nov 11, 2026
@OmarAlex24 OmarAlex24 added the agent-context-increase Accepts a deliberate increase in the agent context budget label Nov 11, 2026
@OmarAlex24
OmarAlex24 marked this pull request as ready for review November 11, 2026 19:37
@OmarAlex24
OmarAlex24 force-pushed the feat/milestones-last-action branch from 4fbb358 to 165332f Compare November 11, 2026 19:47
@github-actions

Copy link
Copy Markdown

Thread transfer impact

⚠️ The latest CI run did not produce a thread transfer result for 165332f.

This comment will update automatically after the next completed run.

OmarAlex24 and others added 4 commits November 11, 2026 14:46
Shells gain an optional latestAction ({ summary, detail?, at }) from the
thread's newest tool item (commands, file changes, searches, other tools),
labeled with deriveToolActivityPresentation and capped at 120 characters.
The list path reads it with one indexed lookup per thread and strips tool
output before decoding; the projection path picks the same item.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The shell stream drops subagent transcript events, so a child's latest
action never reached clients. A finished tool item now passes the filter;
streaming output still does not, so this costs one shell refetch per tool.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Thread rows read the quiet shell, which holds through streaming ticks. The
latest action changes with every tool call, so it is overlaid like the item
counts while the run streams.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… a raw tool name

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@OmarAlex24
OmarAlex24 force-pushed the feat/milestones-last-action branch from 165332f to 66b65f5 Compare November 11, 2026 20:47
@OmarAlex24
OmarAlex24 merged commit 76d17ee into feat/sandbox-environments Nov 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agent-context-increase Accepts a deliberate increase in the agent context budget size:L 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.

1 participant