Repository navigation
perf(observe): groupToolActivity classifies by tool name, not input - #319
Merged
Merged
Conversation
xxchan
pushed a commit
that referenced
this pull request
Oct 10, 2026
classifyTool's kind never depends on the call's input, so grouping no longer passes it and needs no cache keyed on part identity (Lookout's review of #319). Co-Authored-By: Claude Opus 5.5 <[email protected]>
groupToolActivity called classifyTool, which parses each call's whole input, for every tool part each time it ran. A host that words a live turn on every record (Ferry on iOS) paid tools x input size per record, and since 0.52 streamed arguments are records too. A view replaces a part on every change and never mutates one, so each part's kind is now cached by the part object (per runtime) in a WeakMap. Closes #318. Co-Authored-By: Claude Opus 5.5 <[email protected]>
classifyTool's kind never depends on the call's input, so grouping no longer passes it and needs no cache keyed on part identity (Lookout's review of #319). Co-Authored-By: Claude Opus 5.5 <[email protected]>
xxchan
force-pushed
the
perf/tool-group-kind-cache
branch
from
October 10, 2026 07:56
92ec0f8 to
004d7c5
Compare
Merged
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]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #318.
groupToolActivitycalledclassifyToolfor every tool part of a section each time it ran, andclassifyToolparses each call's whole input. A host that words a live turn on every record (Ferry's iOS bridge) paid tools × input size per record. Since 0.52, streamed tool arguments are records too.Change: grouping now calls
classifyTool(runtimeId, tool.tool)without the input. A call's kind depends only on its runtime and tool name; the input only adds detail, paths and fields, which grouping never reads. No cache and no reliance on part objects staying unchanged. Lookout measured 400 calls at 2,160 ms on main and 286 ms with this change, with identical groups on recordings of 1,487 and 4,917 records.Tests:
tests/tool-groups-cache.test.tschecks that grouping never hands a call's input toclassifyTooland that the counts stay the same. It fails without the change. Existing grouping tests, lint and typecheck pass.🤖 Generated with Claude Code