Skip to content

fix(testing): refuse an effort on the scripted runtime with UnsupportedOptionError - #846

Closed
TennyZhuang wants to merge 1 commit into
botiverse:mainfrom
TennyZhuang:scripted-runtime-effort-refusal
Closed

TennyZhuang wants to merge 1 commit into
botiverse:mainfrom
TennyZhuang:scripted-runtime-effort-refusal

Conversation

@TennyZhuang

Copy link
Copy Markdown
Contributor

What changes and why

scriptedRuntime refused SessionOptions.effort with a plain Error. The contract on SessionOptions.effort says a runtime with no effort channel "rejects with an UnsupportedOptionError on effort". docs/design/capabilities.md §2 says the same about an option a runtime cannot take at all: the typed error lets a host tell "not this runtime" from a failure without reading prose. The scripted runtime now throws new UnsupportedOptionError("effort", …) with the same message as before.

Not declared in refusedSessionOptions:

  • effort is not a RefusableSessionOption, and no built-in runtime declares an effort refusal. Their effort refusals are thrown directly with UnsupportedOptionError("effort", …) (ACP shared/acp/effort.ts, dsh, factory, antigravity).
  • capabilities.md §3 adds a declaration "for a real pre-action need, not mirrored for every option". A host already learns which runtimes take an effort from listModels' effortLevels, and the scripted runtime has no listModels.
  • Widening the public type just for this did not seem warranted.

How it was verified

  • A new test in tests/scripted-runtime.test.ts asserts the open rejects with an UnsupportedOptionError carrying option: "effort" and the message naming the level. It fails on main.
  • OAR_TEST=scripted pnpm sea-trial passed (session.effort-never-substituted passes; the listModels case skips as before).
  • CI=1 pnpm run check passed: 494 test files passed / 120 skipped, 4450 tests passed / 595 skipped, mock behavior 18 passed / 1 skipped. After that run, a comment in the change was shortened by one line so it merges with the exit PR under the 300-line lint limit. Lint, typecheck, the affected test files and the scripted behavior suite were re-run on the final commit and passed.
  • These full runs were on 15d762c. The branch has since been rebased onto 83efa1e (current main) with no conflicts; on the rebased commit I re-ran typecheck, lint, the scripted test files and OAR_TEST=scripted pnpm sea-trial (17 passed, 2 skipped), all passing. The full check was not re-run after the rebase.

For reviewers to look at closely

  • The refusedSessionOptions decision above. If you'd rather make effort declarable, that is a wider change: the public type, refuseSessionOptions, and the registry tests in tests/refused-session-options.test.ts.
  • community/morph also refuses effort with a plain Error (community/morph/session.ts:80). It is left alone here to keep this PR to the scripted runtime; it could follow separately.

🤖 Generated with Claude Code

…edOptionError

`scriptedRuntime` refused `SessionOptions.effort` with a plain `Error`. The
contract says a runtime with no effort channel rejects with an
`UnsupportedOptionError` on `effort`, as every other option a runtime cannot
honor, so a host can tell "not this runtime" from a failure without reading
the message. The message is unchanged.

It is not declared in `refusedSessionOptions`: `effort` is not a
`RefusableSessionOption`, and a host already learns which runtimes take an
effort from `listModels`' `effortLevels`.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
stamp-build Bot added a commit that referenced this pull request Nov 16, 2026
…847)

<!-- 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_b8d81bbbd635dd7c987fb912cf5a57c3"><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 -->

Hosts could only make a scripted session exit by disposing it, so they could not exercise an unexpected runtime exit. Add `ScriptedTurn.exit(code?)`: a standalone `exited` response ends an active turn through the existing folds, discards held inputs, aborts the script signal and suppresses later frames and task reports. An exit while idle keeps the previous turn outcome; disposal after exit is accepted without a second exit record.

Unchanged cherry-pick of TennyZhuang's #845 (`bc446c43a72f7cf1a779d5141341b805cb50e587`), preserving the original author and commit message. Thanks to TennyZhuang and Airwing for the implementation and regression cases. This Stamp PR supplies the repository CI and review path; the original PR will be closed with thanks after this merges.

Validation: full `CI=1 pnpm run check` passed (4,481 unit tests and 18 mock behavior cases); `OAR_TEST=scripted pnpm sea-trial` passed 17 cases with 2 expected skips. Six exit regressions cover active/idle exit, queue dropping, observers, rejected controls, disposal and late task reports. The cherry-picked tree matches the reviewed fork commit byte for byte.

Merge before the companion effort-refusal change #848 (from #846). That change will be rebased onto this merge and checked again before merging.

Co-authored-by: TennyZhuang <[email protected]>
stamp-build Bot added a commit that referenced this pull request Nov 16, 2026
…848)

<!-- 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_bf6910859c4934437f867e22f03d02f8"><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 -->

`scriptedRuntime` rejected a requested effort with a plain Error. It now throws `UnsupportedOptionError` with `option: "effort"`, retaining the existing message so hosts can classify the refusal without parsing prose. A regression checks the error type, option and requested level.

Unchanged cherry-pick of TennyZhuang's #846 (`87b4d3a48e8e1155262887ffedc8bed58921995a`), preserving the original author and commit message. Thanks to TennyZhuang and Airwing for the fix. This Stamp PR supplies the repository CI and review path; the original PR will be closed with thanks after this merges.

Validation: full `CI=1 pnpm run check` passed (4,484 unit tests and 18 mock behavior cases); `OAR_TEST=scripted pnpm sea-trial` passed 17 cases with 2 expected skips. The effort-refusal patch is unchanged from the reviewed fork commit.

Based on #847's merged exit fix (`8e7db6503054dfbbb054b4b13efb03e6de41e743`), with full checks rerun on the combined source. No expansion of `RefusableSessionOption` is included.

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

stamp-build Bot commented Nov 16, 2026

Copy link
Copy Markdown
Contributor

Closed by Otter, an agent of open-agent-runtime that did not open it, through Stamp.

Reason:

Thank you, TennyZhuang, for this fix. It has been merged through #848 as 4572f67, preserving your original authorship and patch. All 41 CI checks passed. Closing this original PR now that the change is on main.


Otter commented through Stamp · server open-agent-runtime · head when posted 87b4d3a
View in Stamp →

@stamp-build stamp-build Bot closed this Nov 16, 2026
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