Skip to content

fix(claude): refuse launchArgs that collide with OAR's flags; classify host-set limits and schema failures - #356

Merged
xxchan merged 4 commits into
mainfrom
fix/claude-limits-launchargs
Oct 12, 2026
Merged

xxchan merged 4 commits into
mainfrom
fix/claude-limits-launchargs

Conversation

@xxchan

@xxchan xxchan commented Oct 12, 2026

Copy link
Copy Markdown
Member

Closes #336. Closes #339. Both come from Lookout's comparison with the Claude Agent SDK (#342).

#336: launchArgs that collide with flags OAR manages are refused at open (UnsupportedOptionError on launchArgs, before claude starts), with the option to use instead:

  • --continue/-c and --session-id: claude exited next to OAR's own --session-id (failed: runtime exited);
  • --resume/-r: use SessionOptions.resume;
  • --fork-session: the conversation forked but Session.id kept the old id, so resuming by it returned to the original;
  • --permission-mode: silently overridden by OAR's --dangerously-skip-permissions;
  • --print/-p, --input-format, --output-format: OAR drives claude over stream-json;
  • --json-schema: use SessionOptions.outputSchema (feat: expose native structured output controls #349).
    Long flags are matched in their --flag=value form too. Everything else still passes unchecked.

#339: host-set limits and schemas get their own FailureClass:

  • limit_reached: claude's result subtypes error_max_turns and error_max_budget_usd;
  • output_schema: claude's error_max_structured_output_retries and grok's structuredOutputError (both were unknown).
    failureAdvice says not to retry either until the host changes the limit or the schema; failureText words them.
  • A claude error result's reason is now its subtype followed by claude's own errors text (error_max_turns: Reached maximum number of turns (2), error_max_structured_output_retries: Failed to provide valid structured output after 5 attempts ...), for every error_* result. It used to be the subtype alone.
  • Cost is not passed through in this PR: claude's total_cost_usd is computed at list price (costBasis: "list"), which is not what a subscriber pays. Reopen if a host needs it.

Behavior changes: FailureClass gains limit_reached and output_schema (exhaustive switches need the cases); turns that were unknown in those situations now carry the new classes; claude error reasons are longer; launchArgs with those flags are refused instead of breaking the session.

Tests: each refused flag and its = form, other flags passing (tests/claude/claude-launch-args.test.ts); the subtype mapping and the reason text (tests/failure-mapping.test.ts); the recorded claude and grok structured-output failures now output_schema. Lint, typecheck and the unit suite pass.

🤖 Generated with Claude Code

exe.dev user and others added 2 commits October 12, 2026 02:12
…y host-set limits and schema failures (#336, #339)

launchArgs carrying --continue, --resume, --session-id, --fork-session,
--permission-mode, the print/stream-json flags or --json-schema are
refused at open with the option to use instead. New FailureClass values:
limit_reached (claude error_max_turns, error_max_budget_usd) and
output_schema (claude error_max_structured_output_retries, grok
structuredOutputError). A claude error result's reason keeps its subtype
and adds claude's errors text.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@xxchan
xxchan merged commit aa61e72 into main Oct 12, 2026
17 checks passed
@xxchan
xxchan deleted the fix/claude-limits-launchargs branch October 12, 2026 02:55
xxchan added a commit that referenced this pull request Oct 12, 2026
Adds a "Coming from ..." table to `docs/runtimes/claude.md` (Claude
Agent SDK) and `docs/runtimes/codex.md` (codex SDK): each SDK option and
its OAR counterpart, or why there is none, with links to the open
issues. From Lookout's comparisons in #342.

Docs only, so CI skips it. To merge after #356 (the table states that
`--continue` and `--fork-session` in `launchArgs` are refused and that
`--max-turns` ends as `limit_reached`).

🤖 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 xxchan mentioned this pull request Oct 12, 2026
xxchan added a commit that referenced this pull request Oct 12, 2026
Release OAR and CLI 0.57.0. This PR changes only the two package version
fields.

Most of this release comes from comparing OAR with the Claude Agent SDK
and the codex SDK (#342): in common host scenarios OAR should be no
worse than a runtime's own SDK.

**Added: `listModels` names the default model and each model's
provider** (#347, #355)
- `ModelEntry.default: true` marks the model a session uses when no
`model` is set, where the runtime says so: codex's configured model
(`config/read` for the host's cwd, when it is listed), else codex's
catalog `isDefault`; a new ACP session's current model on grok, kimi and
antigravity; the default saved in pi's settings (global plus the project
at the host's cwd). claude, cursor and opencode mark none, because they
cannot say which model an unset session runs. OAR never picks one.
- `ModelEntry.provider: { id, displayName? }` for runtimes with several
providers: pi (with pi's display name, omitted when it only repeats the
id) and opencode (`providerID`), so hosts never parse `id`.

**Added: host-set limits and schemas have their own failure classes**
(#339, #356)
- `limit_reached`: claude stopped at `--max-turns` or `--max-budget-usd`
(result subtypes `error_max_turns`, `error_max_budget_usd`).
- `output_schema`: the runtime could not produce output matching
`SessionOptions.outputSchema` (claude
`error_max_structured_output_retries`, grok `structuredOutputError`).
Both used to be `unknown`.
- `failureAdvice` says not to retry either until the host changes the
limit or schema; `failureText` words them.
- A claude error result's `reason` is now its subtype followed by
claude's own `errors` text (`error_max_turns: Reached maximum number of
turns (2)`).

**Added: reasoning tokens** (#345, #362)
- `TokenTotals.reasoning`: the part of `output` the runtime reports as
reasoning, on codex (`reasoningOutputTokens`), grok, pi, pi-durable and
cursor. It is already inside `output`, so do not add it again.
Unreported stays absent and a reported 0 stays 0; it accumulates,
survives resume baselines and `withChildren`, and replays the same from
JSON records. claude and the other ACP runtimes report none.

**Fixed: claude `launchArgs` that collide with OAR's own flags are
refused** (#336, #356)
- `--continue`/`-c`, `--resume`/`-r`, `--session-id`, `--fork-session`,
`--permission-mode`, `--print`/`-p`, `--input-format`, `--output-format`
and `--json-schema` (also in `--flag=value` form) are refused at open
with an `UnsupportedOptionError` naming the option to use. Before,
`--continue` made claude exit, `--fork-session` left `Session.id` on the
old id, and `--permission-mode` was silently overridden. Each argument
is compared whole, so a value equal to one of these flags is refused
too.

**Changed: `oar mcp` returns structured results** (#304, #360)
- `run`, `wait` and `list` declare an `outputSchema` and return
`structuredContent` alongside the JSON text, for clients that call tools
from code (OpenCode v2's `execute`, codex code mode).
- `wait` now returns `{ reports }` and `list` returns `{ agents, unread
}` (both were top-level arrays; `list` carries the unread reports as a
field instead of a text note).

**Fixed: `session_linked` once per edge** (#324, #361)
- A child session's lineage is emitted on the first frame that names it,
not on every frame that repeats it (OpenCode v2 repeated it on every
child frame). The graph was already deduplicated; a resumed session's
new stream reports the edge again once.

**Fixed: inventory** (#351, #357)
- claude's commands no longer carry an empty `argumentHint: ""`.
- The inventory spec says plainly that a reader starts the runtime in
`cwd` as a session would, so it can run that workspace's code: do not
inventory an untrusted directory.

**Behavior changes**
- `FailureClass` gains `limit_reached` and `output_schema`; `ModelEntry`
gains `default` and `provider`; `TokenTotals` gains `reasoning`. Hosts
with an exhaustive `switch` or `Record` need the new cases.
- `oar mcp` `wait` and `list` return objects, not arrays.
- claude error reasons are longer; claude `launchArgs` with the flags
above are refused.

Validation: every PR passed all 17 checks on its final head (#358 and
#359 change only Markdown and one comment). #355 and #356 merged with
trees equal to their CI trees; #357, #360, #361 and #362 merged after
typecheck, lint and the full unit suite passed locally on top of the PRs
merged before them. Verified against real runtimes with mock providers
and no account: codex 0.162.1 default under four configurations, pi with
two providers and saved defaults, grok, kimi and opencode listings;
claude 2.1.296 launchArgs refusals (claude not started), `--max-turns`,
`--max-budget-usd` and exhausted schema retries; grok schema errors; the
built `oar mcp` returning structured `list` and `wait`; codex 0.162.1
reasoning counts of 3 then 7 across a resume; `session_linked` once on
OpenCode v2, codex and grok recordings. After this PR passes CI and
merges, tag its exact squash commit as `v0.57.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]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant