Skip to content

feat(observe): ToolAction.paths names every file a read or edit call involves - #167

Merged
xxchan merged 2 commits into
mainfrom
tool-action-paths
Oct 7, 2026
Merged

xxchan merged 2 commits into
mainfrom
tool-action-paths

Conversation

@xxchan

@xxchan xxchan commented Oct 7, 2026 •

Copy link
Copy Markdown
Member

What

classifyTool("codex", "fileChange", input) returned { kind: "edit_file" } with no file. A fileChange item's input is its changes array, and the detail extractor only reads JSON objects. So a host listing the files an agent read or wrote (Ferry D072's fresh-conversation opening) saw codex edits but never their files.

Closes #166.

Shape (as decided in #166)

ToolAction gains paths?: readonly string[]:

  • Every file path the call involves, in the runtime's order, each once. Set only on read_file and edit_file. Absent when the input names none.
  • codex fileChange: each change's path. A rename's target (kind.move_path) comes right after its source.
  • claude Read / Edit / Write, and the pi, opencode and cursor read/write tools: the one path detail already read, so hosts read paths with no per-runtime logic.
  • claude NotebookEdit (review): its notebook_path. The old detail never read that key, so detail is now that path too.
  • pi and cursor ls are read_file, so their paths entry is the listed directory. Whether to list it is up to the host (said in the doc comment).
  • detail is the first of paths. No "(+N more)" text.
  • kind stays edit_file for the whole call, even when one fileChange adds, updates and deletes.

The recording

tests/replay/fixtures/codex-file-change.raw.jsonl: real codex 0.160.1 against the scripted provider (codex-aimock, no login, no tokens). Recorded with a new recorder mode:

pnpm sea-trial:record codex-aimock file-change "apply the patch"

It runs in a scratch directory seeded with notes.txt, gone.txt and old-name.txt. The model sends one patch: update notes.txt, add added.txt, delete gone.txt, update old-name.txt and move it to new-name.txt. The scratch path is replaced with <cwd> in the fixture. The recorded changes:

[
  {"path":"<cwd>/added.txt","kind":{"type":"add"},"diff":"fresh line\n"},
  {"path":"<cwd>/gone.txt","kind":{"type":"delete"},"diff":"deleted\n"},
  {"path":"<cwd>/notes.txt","kind":{"type":"update","move_path":null},"diff":"@@ -1 +1 @@\n-old note\n+new note\n"},
  {"path":"<cwd>/old-name.txt","kind":{"type":"update","move_path":"<cwd>/new-name.txt"},"diff":"@@ -1 +1 @@\n-moved before\n+moved after\n\n\nMoved to: <cwd>/new-name.txt"}
]

What the recording shows:

  • move_path is snake case. It is null on an update that doesn't rename, and add/delete don't have the key.
  • Paths are absolute.
  • The list comes sorted by path, not in the patch's order. paths keeps codex's order.
  • item/started and item/completed carry the same changes.

So classifyTool gives { kind: "edit_file", detail: "<cwd>/added.txt", paths: [added, gone, notes, old-name, new-name] }.

How the mock got a fileChange out of codex: aimock's gpt-5.1 has no model metadata in codex, so codex offers no apply_patch tool. A direct function call is answered unsupported call: apply_patch, and aimock can't send the freeform custom tool call codex's own apply_patch uses. Instead the model sends apply_patch <<'EOF' … EOF through exec_command. codex intercepts that, applies it, and reports it as a fileChange item (no commandExecution). The files on disk ended up changed as the patch says.

Tests

  • tests/replay/tool-activity.test.ts: the recorded call's kind/detail/paths (inline snapshot), and the codex file-change activity snapshot. toolCallsFromCodex now takes its input from codexItemInput, as the projection does. opencode's recorded read/write/edit now show paths equal to their detail.
  • tests/replay/codex-projection.test.ts: the new fixture folds (codex-file-change.projected.txt).
  • tests/tool-activity.test.ts: for each runtime with read/write tools (claude, pi, cursor, opencode), paths is [detail] with detail unchanged, using each vendor's input shape. claude NotebookEdit gives its notebook_path as paths and detail. paths is absent with no input, {}, an empty changes array, a NotebookEdit input without notebook_path, and on non-file kinds. A rename onto a path the same patch deletes is listed once.

pnpm run check and CI=1 pnpm run check are green (712 passed / 32 skipped, mock sea-trial 19/19). pnpm run build passes.

Docs

  • tool-activity.ts: the paths and detail doc comments, plus the recorded fileChange shape next to its reader.
  • docs/runtimes/codex.md: the recorded fileChange shape (and that a heredoc apply_patch arrives as one) and how classifyTool reads it.
  • docs/runtimes/opencode.md: one line on paths.
  • sea-trial/record.ts: the codex-aimock mode.

Compatibility

Additive: one new optional field. A codex fileChange and a claude NotebookEdit now have a detail (their first path), so oar run prints [Editing file] <path> for them. No version bump.

🤖 Generated with Claude Code

exe.dev user and others added 2 commits October 7, 2026 04:11
…involves

A codex fileChange classified as edit_file with no detail: its input is
the item's `changes` array, and the detail extractor reads only JSON
objects. A host listing the files an agent read or wrote (Ferry's fresh
conversation opening) saw codex edits but never their files.

ToolAction gains an optional `paths`, set only on read_file and
edit_file: every file path the call involves, in the runtime's order,
each once, absent when the input names none.

- codex fileChange: each change's `path`, a rename's `kind.move_path`
  right after its source. The shape comes from a new recording of real
  codex 0.160.1 against the scripted provider: `move_path` is snake
  case, `null` on an update that does not rename; paths are absolute and
  come sorted by path, not in the patch's order.
- claude Read/Edit/Write and the pi, opencode and cursor read and write
  tools: the one path `detail` already read.
- `detail` stays the first of `paths`, with no "(+N more)" text, and
  `kind` stays edit_file for a fileChange that adds, updates and deletes.

The fixture comes from `pnpm sea-trial:record codex-aimock file-change`,
a new recorder mode: real codex against aimock in a scratch directory
(no login, no tokens), the model sending apply_patch as an exec_command
heredoc, which codex runs as a fileChange item. The scratch path reads
`<cwd>` in the fixture.

Additive: a new optional field.

Refs #166

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Review on #167: `paths` is every file a call involves, and NotebookEdit
edits the file at `notebook_path`. Its old `detail` never read that key,
a historical omission rather than a reason to leave the notebook out, so
a host listing edited files would miss notebooks. NotebookEdit now gives
`notebook_path` as `paths` and so as `detail`.

The `paths` doc comment also says that for the pi and cursor `ls` tools
the path is the listed directory, which hosts may list or not.

Refs #166

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@xxchan
xxchan merged commit 561bffc into main Oct 7, 2026
13 checks passed
@xxchan
xxchan deleted the tool-action-paths branch October 7, 2026 04:19
@xxchan xxchan mentioned this pull request Oct 7, 2026
xxchan added a commit that referenced this pull request Oct 7, 2026
Release OAR and CLI 0.29.0. This PR changes only the two package version
fields.

**New**
- `ToolAction.paths` (#167, closes #166): on `read_file` and
`edit_file`, every file path the call involves, in the runtime's order,
each once; absent when the input names none. `detail` is its first
entry.
- codex `fileChange`: each change's `path`, and a rename's target right
after its source. Codex fileChange calls previously had no `detail`; now
`detail` is the first changed path, so `oar run` prints `[Editing file]
<path>` for them.
- claude `Read` / `Edit` / `Write` / `NotebookEdit` and the pi, opencode
and cursor read and write tools: the one path the call names
(`NotebookEdit` now has `notebook_path` as its `detail` too).
  - The `ls` tools (pi, cursor) give the listed directory.
- `kind` stays `edit_file` for a `fileChange` that adds, updates and
deletes at once.

Validation: all 13 checks passed on #167's final head (`ab273f5`), with
a new real codex 0.160.1 `fileChange` replay fixture. After this PR
passes CI and merges, tag its exact squash commit as `v0.29.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]>
stamp-build Bot added a commit that referenced this pull request Nov 5, 2026
<!-- stamp:review:v1 -->
<sup><img src="https://api.raft.build/api/avatars/pixel/bXVn.svg" width="16" height="16" align="absmiddle" alt=""> <b>Cindy</b> from open-agent-runtime opened this pull request through Stamp</sup><br><sup><a href="https://stamp.build/review?receipt=prc_1f7d3e4ef77d7080a181b5021947afd2"><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 request Codex sends the client during a turn (approval, user input, MCP elicitation, dynamic tool call) was recorded and never answered, so Codex waited and the turn hung. `Session` has no way for a host to answer, so nothing could ever settle it. Raft needs this to move Codex onto OAR (task #167, #oar-raft:3a629875 item 2).

OAR now records each request verbatim, answers at once and records the answer as its `answered` response, so `events()` reads `app_request` then `app_answered`.

- Decisions get their own native refusal from the app-server schema: `decline`, `denied`, an empty grant or answer set, or `success: false`.
- Anything else, including a method from a later version, gets JSON-RPC `-32601`.
- `serverRequest/resolved` now follows OAR's answer, so it no longer produces `app_request_cancelled`.

There is no option: no host can answer today, so none could want the old behaviour. When one needs to answer, that is a separate interface.

**Host-visible change:** on Codex, `app_answered` now follows `app_request`, and `app_request_cancelled` no longer appears. Through OAR these requests should be rare: with `approvalPolicy: never`, Codex declines MCP elicitations itself.

Validation:
- A native vendor case on Codex 0.163.0 drives the app-server under `approvalPolicy: "untrusted"`: the declined command does not run and the turn completes. This is the only reply with native evidence; the others come from the 0.163.0 schema and unit tests.
- Unit cases cover each reply, an unknown method, codex's numeric id being returned with its own type, and the record order.
- `CI=1 pnpm run check` passed.

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

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

classifyTool: codex fileChange yields no file path (its input is the changes array)

1 participant