Skip to content

feat(observe): tool parts carry when OAR saw their start and end - #92

Merged
xxchan merged 1 commit into
mainfrom
tool-part-times
Oct 3, 2026
Merged

xxchan merged 1 commit into
mainfrom
tool-part-times

Conversation

@xxchan

@xxchan xxchan commented Oct 3, 2026

Copy link
Copy Markdown
Member

A host can show what a tool call did, but not how long it ran. Codex sleep calls (#84) need this most. The model asks to wait 50 s and a steer cuts the wait short; only the observed times show how long it actually waited ("Waited 8 s of 50 s").

What changes

  • ViewPart tool gets optional startedAt and endedAt: the receivedAt of the call's tool_call_started and tool_call_ended records, in epoch ms. This is the same rule as tasksOf's TaskView.
  • They record when OAR observed the record, not a time the runtime reported. Only what was seen is set:
    • A running call has no endedAt.
    • An end whose start was never seen has no startedAt.
    • Nothing is filled in from other times.
  • docs/design/chat-ui.md's mapping row says so.

Tests

  • A new view test: a sleep call with both times, a running call, and an end without a start.
  • Existing tool-part expectations now include the times.
  • pnpm run check passes.

Scope agreed with @cindy.

🤖 Generated with Claude Code

A host could show what a call did but not how long it took. Codex `sleep`
calls (#84) need it most: the model asks to wait 50 s, a steer cuts it
short, and only the observed times tell how long it really waited.

`startedAt` / `endedAt` on a view tool part are the `receivedAt` of its
`tool_call_started` / `tool_call_ended` records, the same rule as
`tasksOf`'s TaskView: OAR's observation, not a runtime-reported time, and
only what was seen.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@xxchan
xxchan merged commit 3f3517d into main Oct 3, 2026
12 checks passed
@xxchan
xxchan deleted the tool-part-times branch October 3, 2026 09:37
@xxchan xxchan mentioned this pull request Oct 3, 2026
xxchan added a commit that referenced this pull request Oct 3, 2026
Patch release: #92 adds `startedAt` and `endedAt` (the `receivedAt` of
the start and end records) to SessionView tool parts. Version bump only.

🤖 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]>
xxchan added a commit that referenced this pull request Oct 3, 2026
Codex `sleep` items arrive as tool calls since #84. `classifyTool` left
them as `other`, so hosts showed "Used a tool" while the model was
waiting.

**What changes**
- **New `ToolActionKind` `"wait"`.** Codex `sleep` maps to it.
- **New `ToolAction.durationMs`.** For a wait, this is the duration the
agent asked for, taken from the input's `durationMs`. It's set only when
the value is a finite positive number.
- **Actual wait time.** The time actually waited is the tool part's
`endedAt - startedAt` (#92), since a steer can end a wait early. With
both, a host can show "Waited 8 s of 50 s".
- **Labels and summaries.** Labels are "Waiting" / "Waited" / "Wait
failed". `toolGroupSummary` says "waited" or "waited N times".

**Compatibility.** Hosts that switch exhaustively on `ToolActionKind`
get one more case. Otherwise the change is additive.

**Tests.** Classification, the duration guard, labels and the summary
wording. `pnpm run check` passes.

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

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>
stamp-build Bot added a commit that referenced this pull request Oct 29, 2026
<!-- stamp:review:v1 -->
<sup><img
src="https://cdn.slock.ai/avatars/6aabf32c-20bc-4cba-b55a-2aa72b60999b/8ba4452ceb890f1930886ef4286fdb99.webp"
width="16" height="16" align="absmiddle" alt=""> <b>Otter</b> from
open-agent-runtime opened this pull request through
Stamp</sup><br><sup><a
href="https://stamp.build/review?receipt=prc_e6a24614c82047bc447bfb66211a3320"><picture><source
media="(prefers-color-scheme: dark)"
srcset="https://stamp.build/assets/brand/stamp-glyph-dark.d907ffcadb44.svg"><img
src="https://stamp.build/assets/brand/stamp-glyph-light.58a2c10ed108.svg"
width="13" height="12" align="absmiddle" alt=""></picture> View in Stamp
→</a></sup>

---
<!-- /stamp:review:v1 -->

A host could not select Claude's native permission mode through OAR: the
adapter always added bypass and refused `--permission-mode`. Accept
`default`, `dontAsk`, `acceptEdits` and `plan` through `launchArgs`,
omit OAR's bypass when a mode is supplied, and force native
`--permission-prompts none` so remaining approvals are denied locally
instead of waiting for an unavailable host answer.

Reject permission prompt tools, non-none prompt targets, missing or
unknown modes, and a conflicting explicit bypass before process launch
with `UnsupportedOptionError`. Default bypass is unchanged. No approval
API or new event is added; the native init frame remains the evidence
for the actual mode.

Document the consequential resume rule: the host must repeat its mode,
because omission restores OAR bypass. Also record plan's
model-classifier limits and the design decision to defer human approvals
until a host needs them. The prior native investigation remains linked
as historical evidence.

Validation: `CI=1 pnpm run check` on current main passed (2,252 unit
tests and 19 mock cases), as did the build, Claude's shared behavior
suite, and all 68 applicable native vendor tests on Linux with Claude
2.1.312 and local model providers. The new native cases cover every
mode, reapplying versus omitting a mode on resume, and both
plan-classifier decisions. The new launch regression failed before the
implementation and verifies typed refusals occur without spawning. No
real account quota was used.

Windows CI exposed a native denial for a temporary-directory 8.3 alias
in the acceptEdits fixture. Document that native safety check,
canonicalize fixture paths, and use a separate Bash script with literal
quoted arguments. Keep native tool-result diagnostics and all original
side-effect expectations. The seven focused native cases and full check
pass locally. The Windows Claude job also passes at 8cd53b6, including
all seven new permission cases with unchanged assertions.

Task #92; implements the maintainer decision following merged #506.

---------

Co-authored-by: Otter <[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.

1 participant