Skip to content

feat(observe): a tool phase says when claude is still writing its arguments; phaseLabel names the action - #317

Merged
xxchan merged 2 commits into
mainfrom
feat/phase-writing-args
Oct 10, 2026
Merged

xxchan merged 2 commits into
mainfrom
feat/phase-writing-args

Conversation

@xxchan

@xxchan xxchan commented Oct 10, 2026

Copy link
Copy Markdown
Member

Closes #314.

Since 0.52 (#302), a claude call's tool_call_started arrives at content_block_start, before its arguments stream. AgentStatus.phase became { tool } right there, so phaseLabel read Running mcp__ferry__show_widget for the whole time the model was writing the arguments. Ferry measured 9–14 s for a 2.5–4.5 KB widget.

Changes:

  • RunningPhase tool variant gains writing?: true. It is set from the call's first tool_call_input_delta until its complete tool_call_input, and only for the current call's phase. Only deltas set it: an ACP call whose input arrives later without deltas is already running. In practice only claude streams arguments.
  • phaseLabel(phase, runtimeId?):
    • a writing phase reads Writing <tool> arguments;
    • with a runtime id, a running call reads as its action from classifyTool / toolActionLabel (Editing file, Running command), and an MCP or unclassified tool by its short name (Running show_widget);
    • without a runtime id, today's wording stays.
  • Docs: docs/spec/conversation.md.

Tests:

  • Status: writing during deltas, cleared by the complete input, untouched by another call's input. It fails without the change.
  • Labels: actions, MCP short name, unclassified, and writing with and without a runtime id.

The full suite (1,582), lint and typecheck pass locally.

🤖 Generated with Claude Code

exe.dev user and others added 2 commits October 10, 2026 07:39
…uments; phaseLabel names the action

Since 0.52 a claude call's tool_call_started arrives before its arguments
stream, so the status said "Running mcp__ferry__show_widget" for the many
seconds the model was still writing a widget, file or edit. The tool phase
now carries writing: true from the call's first tool_call_input_delta until
its complete tool_call_input, and phaseLabel reads it as
"Writing <tool> arguments". Only deltas set it: an ACP call that gets its
input later without deltas is already running.

phaseLabel(phase, runtimeId?) with a runtime id names a running call by its
action (classifyTool: "Editing file", "Running command"), an MCP or
unclassified tool by its short name. Without one, today's wording stays.

Closes #314.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Lookout: while claude streams a Write or Bash call's arguments the label
read 'Writing Write arguments' / 'Writing Bash arguments', though the
running label is 'Editing file' / 'Running command'. toolActionLabel gains
a writing state ('Preparing file edit', 'Preparing command', ...), and
phaseLabel uses it for classified tools; MCP and unclassified tools keep
'Writing <name> arguments'.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@xxchan
xxchan merged commit aa8f5e3 into main Oct 10, 2026
17 checks passed
@xxchan
xxchan deleted the feat/phase-writing-args branch October 10, 2026 07:56
xxchan added a commit that referenced this pull request Oct 10, 2026
Replaying a session's records lost the native parent/child graph, so
hosts such as Ferry could not reproduce `Session.usage().withChildren`.
Lineage now travels on the native frame that establishes it, and live
queries and replay use the same graph and token folds.

- Add `session_linked { parent, child, via: "tool_call" }` for Codex
collaboration items, ACP lineage notifications and OpenCode v2 child
attribution. `graphOf(records)` is exported through the observe, root
and browser entries. The kernel updates the same graph fold as each
record is appended, using a Set for node ids; `graph()` returns the
retained value without rescanning the log. Repeated facts retain their
original frames but produce one edge.
- Derive lineage by default in `usageOf(records, sessionId)`, retaining
its explicit graph override. SessionView keeps every session's latest
totals, so reports before lineage, nested descendants and repeated
cumulative figures contribute exactly once. Unrelated session ids never
imply a child, and the usage cursor includes the frame that establishes
relevant lineage even when another session reports it.
- Keep unknown accounting unknown. Old records without lineage do not
gain `withChildren`. Grok's root ledger already includes child spend:
its child ledgers remain native-only and are not added again. Correct
the contrary SessionUsage comment and attribution spec, linked to the
existing Grok evidence and regression.

Host impact: exhaustive event switches need a `session_linked` case.
Incremental SessionView checkpoints must retain `sessionGraph` and
`usageBySession` with its nested Maps; replay raw records when upgrading
checkpoints. The existing root `usageByAgent` and `usageTotal` fields
remain available. Adapter authors put the event returned by
`kernel.link(edge)` in the source frame; out-of-band `kernel.node()` is
removed. The live graph still starts with the known root id.
`graphOf([])` stays empty and learns the root from its first recorded
appearance; this initial seed is the only information supplied outside
the records.

Validation: full check (1,590 tests) and build on main aa8f5e3,
including #313, #315 and #317; all five behavior backends; 35 Codex
native tests. Added regressions cover JSON persistence, live/replay
equality after each append, synchronous source-frame observation,
incremental and flat-event views, graph and checkpoint immutability,
late edges, repeated reports, nested/shared descendants, cycles, unknown
totals and explicit graph overrides. Codex's actual Session path,
recorded Grok wire shapes and the OpenCode v2 child fixture all verify
replay against live results. All runtime tests use scripted providers,
with no real-account quota.

Closes #312.

---------

Co-authored-by: Otter <[email protected]>
@xxchan xxchan mentioned this pull request Oct 10, 2026
xxchan added a commit that referenced this pull request Oct 10, 2026
Release OAR and CLI 0.54.0. This PR changes only the two package version
fields.

**Added: session lineage is in the records** (#312, #320)
- New event `session_linked { parent, child, via: "tool_call" }`,
carried by the native frame that names the relationship: codex
collaboration items, ACP lineage notifications (grok) and OpenCode v2
child attribution. A host that folds the records now gets the same
session graph and the same `usage().withChildren` as a live `Session`.
- `graphOf(records)` is exported (root, observe and browser entries).
`Session.graph()` is the same fold, kept as each record is appended. A
live graph starts with its root id; `graphOf` learns the root from its
first record. An edge reported many times is in the graph once.
- `usageOf(records, sessionId)` derives lineage from the records by
default and still takes an explicit graph. Old records without
`session_linked` have no edges and no `withChildren`.
- grok child ledgers stay native-only, as before: the root's prompt
ledger already includes a foreground child's spend. A background child's
spend (grok's default) and the root turn grok runs after it are not in
`usage()` yet (#325).

**Added: a tool phase says when claude is still writing its arguments**
(#314, #317)
- `RunningPhase` `{ tool, callId }` gains `writing?: true` while a
call's arguments stream (`tool_call_input_delta`); the complete input or
the call's result clears it.
- `phaseLabel(phase, runtimeId?)` names the action when given the
runtime: "Preparing command", "Preparing file edit", "Running command",
"Reading file". MCP and unclassified tools read "Writing <name>
arguments" and "Running <name>". Without `runtimeId` it reads "Running
<tool>" as before, or "Writing <tool> arguments".
- `toolActionLabel` takes a `"writing"` state.

**Added: page fetches and subagent calls are classified** (#321, #322)
- New `ToolActionKind` `fetch`: claude `WebFetch` and cursor `webFetch`,
worded "Fetching page" and "fetched 2 pages". They were `web`, worded as
web searches. `web` now means a web search only.
- New `ToolActionKind` `subagent`: claude `Agent` (and its alias `Task`,
under which a call is recorded as `Task`) and opencode `subagent`,
worded "Running subagent" and "ran 2 subagents", with the subagent's
task (`description`) as `detail` and `description`.

**Fixed**
- `groupToolActivity` no longer parses every call's input on each
grouping: a call's kind depends only on its runtime and tool name (#318,
#319). A host that groups a live turn on every record pays far less: 400
calls went from 2,160 ms to about 300 ms.
- pi: the model catalog's `providers()[].configured` is true from the
start for a provider with a key or login in `auth.json`, not only after
`refresh()` (#291, #323). An environment key still counts only after
`refresh()`. As in pi itself, `configured` means the provider has an
entry, not that its key works.

**Behavior changes**
- New event kind `session_linked`, and new `ToolActionKind`s `fetch` and
`subagent`. Hosts with an exhaustive `switch` or `Record` need the new
cases.
- Counts that grouped page fetches under `web` now show them as `fetch`;
claude `Agent`/`Task` and opencode `subagent` calls count as `subagent`,
not `other`.
- An incremental `SessionView` checkpoint must keep `sessionGraph` and
`usageBySession`; replay the raw records when upgrading an older
checkpoint.
- Adapter authors: put the event `kernel.link(edge)` returns in the
source frame's events. `kernel.node()` is removed.

Validation: every PR passed all 17 checks on its final head. #317
differed from its CI tree only in the version fields from the 0.53.0
release, and #320's merged tree equals its CI tree. #319, #323 and #322
each merged after typecheck, lint and the full test suite passed locally
on top of the PRs merged before them, and each merged tree equals that
verified tree. Lookout verified each with no account: #320 against real
codex 0.162.0 and grok 1.0.50 with a mock provider and OpenCode v2
2.0.26 on a free model (the live graph equals `graphOf` of the records
after every one of 222 records, and replayed usage equals live); #317
and #322 against the real claude CLI 2.1.292 with a mock provider,
including `WebFetch`, `Agent` and `Task`; #319 with identical groups to
0.53.0 on recordings of 1,487 and 4,917 records; #323 with temporary
`auth.json` files and the network blocked. After this PR passes CI and
merges, tag its exact squash commit as `v0.54.0` to trigger npm trusted
publishing.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: exe.dev user <[email protected]>
Co-authored-by: Claude Opus 5.5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

observe: phaseLabel says "Running <tool>" while claude still writes the call's arguments (0.52)

1 participant