Skip to content

docs(design): record when OAR may use a runtime's stored credentials - #1052

Merged
stamp-build[bot] merged 2 commits into
mainfrom
agent/cindy/credential-reading-rule
Nov 20, 2026
Merged

stamp-build[bot] merged 2 commits into
mainfrom
agent/cindy/credential-reading-rule

Conversation

@stamp-build

@stamp-build stamp-build Bot commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor

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


Records the principle xxchan stated in review today for using a runtime's stored credentials, replacing a blanket "never read credentials" rule that was stated in review but contradicted shipped Kimi and Factory account usage.

The rule: OAR does not create usage the runtime's own client would not create.

  • Reading locally, without a request, is allowed (for example the id_token_email Antigravity saves beside its token at login).
  • A request is allowed only when the native client makes the same one in ordinary use, at a comparable rate. Never a proxy of the vendor API.
  • OAR never writes or refreshes the store; no token bytes, paths or raw replies leave it.
  • OS keychains get their own decision; polls do not read them. Where a runtime can use a keychain or a plain file, the file is read only once it is shown to be the store in use, otherwise the value is omitted or unsupported.
  • A private format feeds only answers that fail closed: display values, and credentials for a request the native client also makes. Facts about the session itself (turn outcome, liveness) never come from private storage, consistent with the 2026-11-15 conversation database refusal.

Docs only.

🤖 Generated with Claude Code

OAR does not create usage the runtime's own client would not create:
local reads are allowed, requests only when the native client makes the
same one, never a proxy; the store stays the runtime's; keychains get
their own decision; private formats feed display-only values.

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

stamp-build Bot commented Nov 20, 2026

Copy link
Copy Markdown
Contributor Author

CHANGES @ 5da02bd

Checked the five rules against the shipped Kimi (kimi/account-usage.ts, kimi/oauth-token.ts, kimi/auth-status.ts), Factory (factory/account-credential.ts, factory/account-usage.ts, factory/account.ts), and Antigravity (antigravity/token-email.ts, antigravity/account.ts) implementations. All existing anchors (../spec/account-usage.md#environment, #reading-a-runtimes-internal-conversation-database-2026-11-15) resolve and the core principle matches shipped code, with two substantive gaps/conflicts and one factual detail to tighten:

  1. Rule 4 (missing composite-store / keyring-shadowing rule): Rule 4 currently addresses only "a runtime that keeps its only copy there". All three adapters actually have to enforce a second boundary: when a runtime supports both an OS keyring and a plain file (Factory auth.v2.keyring / auth.v2.loginkeychain vs auth.v2.file, Kimi auth.storage !== "file", Antigravity compositeTokenStorage reading go_keyring first and only purging the plain file best-effort), OAR must prove the plain file is authoritative before reading it, or else return unsupported / omit the field so a stale plain file never misidentifies or bills the wrong account.
  2. Rule 5 (conflict with Kimi/Factory accountUsage and "version-gated"):
    • Rule 5 says private storage feeds "only for display, such as an email or plan name" and contrasts that with "a fact a host acts on". In shipped code, both Kimi and Factory read private credential stores (credentials/kimi-code.json, AES-256-GCM auth.v2.file + auth.v2.key, api-key-identity/seed.json) to produce accountUsage() snapshots (rateLimited, windows, reauth_required), which hosts do act on (routing, re-auth prompts). What makes those safe is fail-closed validation (an unreadable/unrecognized file produces unsupported, reauth_required, or an error, and a rejected token returns 401, rather than fabricating a silent wrong answer), while authStatus still uses the runtime's own ACP interface (authenticate / auth/status). Tightening Rule 5 to distinguish "display-only omission or fail-closed credential input to a vendor/status check" from "silently misreading private state as authoritative session/turn truth" removes the contradiction.
    • None of Kimi, Factory, or Antigravity version-gates its private-file read on the CLI semver; all three validate the stored schema/structure directly and omit or fail closed on mismatch. Replacing "version-gated" with "format-validated" (or "schema-validated") matches the code.
  3. Factual detail (agy 1.5.13, non-blocking): Considered and Rule 1 say agy 1.5.13 keeps the email "only in its stored OIDC id_token" and decodes it from id_token. On disk ([env] + [sym] agy 1.5.13), antigravity-oauth-token stores id_token_email (StoredToken.IDTokenEmail, extracted by agy from the OIDC id_token at login) alongside token; raw id_token JWT payload decoding is only a fallback. Also drop the extra blank line at line 848.

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

…eads

Address review on the stored-credentials rule: a plain file is read only
once it is shown to be the store the runtime uses; private formats feed
only answers that fail closed, including credentials for native-equivalent
usage requests; agy keeps id_token_email beside the token.

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

stamp-build Bot commented Nov 20, 2026

Copy link
Copy Markdown
Contributor Author

Addressed at f0a3c15.

  1. Rule 4 now covers the composite case: a plain file is read only once it is shown to be the store the runtime uses (Kimi's OAuth storage setting, no keyring-sealed auth.v2.* entry for Factory, no Secret Service for Antigravity on Linux); otherwise omitted or unsupported.
  2. Rule 5 is now "a private format only feeds answers that fail closed": format-checked, unrecognised gives a missing field, unsupported or reauth_required. It covers display values and credentials for a native-equivalent request (Kimi and Factory usage, where the vendor rejects a wrong one). Session facts (turn outcome, liveness) stay excluded. "version-gated" is gone.
  3. Considered and rule 1 now name id_token_email saved beside the token at login. Extra blank line removed. Also added the Antigravity plan through ACP authenticate as an example of the runtime's interface coming first.

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

@stamp-build

stamp-build Bot commented Nov 20, 2026

Copy link
Copy Markdown
Contributor Author

GO @ f0a3c15. All five rules now align with the shipped Kimi, Factory, and Antigravity implementations (including composite keyring/plain-file authority checks, fail-closed format validation for display and native-matching usage requests, and agy 1.5.13 id_token_email). Both anchors resolve and there are no em or en dashes.


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

@stamp-build
stamp-build Bot merged commit ef13a53 into main Nov 20, 2026
1 check passed
@stamp-build
stamp-build Bot deleted the agent/cindy/credential-reading-rule branch November 20, 2026 05:42
@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 1052 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

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