Skip to content

fix(acp): forward agent OOM priority to reverse terminals - #652

Merged
stamp-build[bot] merged 2 commits into
mainfrom
agent/otter/acp-terminal-oom
Nov 6, 2026
Merged

stamp-build[bot] merged 2 commits into
mainfrom
agent/otter/acp-terminal-oom

Conversation

@stamp-build

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

Copy link
Copy Markdown
Contributor

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


An ACP agent launched through an OOM-priority wrapper could still run its commands at the OAR host's priority: reverse terminals are children of OAR. The native Grok control reproduced an agent score of 500 with a command score of -1000.

On Linux, each reverse terminal now reads the requesting agent's and the host's oom_score_adj. Equal scores or an unreadable score keep the original launch path. Only differing scores use a pre-execution wrapper to apply the agent's value; a refused write keeps the inherited priority. Commands retain their arguments, environment, working directory and owned process group; other platforms keep the existing launch path. No public option is added.

The probe and selected evidence distinguish the tested paths: Grok 1.0.70, Kimi 2.4.1 and CodeBuddy 2.179.3 used reverse terminals and now report 500; OpenCode 1.19.5 and Antigravity CLI 1.5.0 ran this command in their own processes and already inherited that score. The host stayed unchanged. This does not claim every tool in those runtimes uses the same path. A separate, existing CodeBuddy full-command-line parsing failure is documented and remains outside this fix.

Validation:

  • Full check: 3,585 unit tests and 18 mock behavior cases passed; typecheck and lint passed. Build and clean packed installation passed.
  • All 16 shared behavior backends passed. Full Grok, Kimi and CodeBuddy native vendor suites passed, including new Linux priority regressions. These use real runtime processes with local scripted providers, without account inference.
  • Unit cases cover pre-execution priority, descendant inheritance and cleanup, literal arguments, shell commands, current-score changes, unavailable processes, refused writes and relative PATH resolution. An equal-score regression checks the real command's original argv[0] and fails before the review fix. Disabling priority forwarding fails both the unit suite and the native Grok case on the score assertion; restoring it passes both.

macOS and Windows validation remains with this PR's CI.

@stamp-build
stamp-build Bot merged commit 607cd8e into main Nov 6, 2026
40 checks passed
@stamp-build
stamp-build Bot deleted the agent/otter/acp-terminal-oom branch November 6, 2026 05:43
@stamp-build stamp-build Bot mentioned this pull request Nov 6, 2026
stamp-build Bot added a commit that referenced this pull request Nov 6, 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_038a3f19ff5c2d6bb704961ba32d1148"><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 -->

DSH sessions can attach stdio MCP servers, and commands an ACP agent runs through OAR now take that agent's OOM score.

## DSH: session MCP servers (#650, fixes #646)
- `SessionOptions.mcpServers` now accepts stdio `command` and `args` on DSH, through native MCP client plugins in OAR's private invocation patch. The model sees and calls the tools, and resume needs the entries supplied again.
- A server that fails to start refuses the open, where DSH's own loader would otherwise continue without it. A native namespace collision also refuses, and the user's configuration is not changed.
- HTTP entries and non-empty `env` or `headers` stay refused. **Do not move tokens into `args`:** persistence of command and args has not been audited either.
- Verified on Linux with DSH 0.2.1-rc.5 and 0.2.2-rc.1 and a local provider, and by CI on macOS and Windows with the pinned 0.2.1-rc.5. No real account was used.

## ACP terminals take the agent's OOM score (#652)
- A host that wraps a runtime's command to raise its OOM score now gets that score on reverse terminal commands too. These are started by OAR, so they used to keep the host's score, and a runaway command under a protected host stayed protected.
- Linux only, with no option. OAR changes the launch only when the agent's score differs from its own. With equal scores, or if either score cannot be read, the command starts as before. If the kernel refuses the write, the command keeps the host's inherited score.
- Real Grok 1.0.70, Kimi 2.4.1 and CodeBuddy 2.179.3 sent reverse terminal requests and now run them at the agent's score. OpenCode 1.19.5 and Antigravity CLI 1.5.0 ran the probe's command in their own processes. This covers the measured command paths, not every tool a runtime has.

## Tests
- The fake login CLIs now publish their state atomically, so a killed writer cannot leave half a file (#651).

🤖 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.

0 participants