Add async process run action - #99
Open
k2v7n24cbf-cyber wants to merge 2 commits into
Open
Conversation
k2v7n24cbf-cyber
force-pushed
the
agent/process-run-and-wait-tool
branch
from
July 19, 2026 22:02
8d8a564 to
8c719c9
Compare
k2v7n24cbf-cyber
marked this pull request as ready for review
July 19, 2026 22:02
k2v7n24cbf-cyber
added a commit
to k2v7n24cbf-cyber/openacme
that referenced
this pull request
Jul 22, 2026
Merge staged copy of sandydasari#99 into local-stage.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Reshapes the existing
processtool instead of adding another model-facing tool. This addsprocessactionrun: one call starts a command, waits briefly for quick completion, and if the command is still running, detaches and posts aprocess_completedsession event with the final stdout/stderr when the process exits.The important behavior is that agents do not need a
start + notifypair and do not need to poll in normal command execution. They make one tool call for the command. If it completes quickly, the result comes back in that call. If it runs longer, the tool host delivers the eventual completion back into the session and wakes the dispatcher.Existing
process start/poll/log/write/killremains available for dev servers, watchers, stdin-driven commands, and manual debugging.Observation that motivated this
In a real agentic session, the same underlying task was run two ways:
The poll-based run burned roughly 700K additional input tokens even though the shell work took essentially the same wall-clock time. One long-running command around 77s was polled 17 separate times before completion; 16 of those polls returned no new information beyond "still running." Another around 78s was polled 5 times.
This was observed while working with newer GPT-5.x-class agents and showed up broadly across deployed agents, not in one specialized agent flow.
Root Cause
The polling pattern does not match the LLM API cost model. Each poll is a full model turn, so the accumulated conversation history is resent as input even when the only new information is "still running." Prompt caching helps avoid recomputing the repeated prefix, but it does not shrink the input token count and it does not remove the latency of a round trip.
The issue compounds because each poll response is appended to the conversation and then resent on every later turn. In the observed run, the poll-heavy path had a higher cache-hit rate than the blocking path, which confirms caching was working; it still consumed substantially more input because the conversation kept growing with low-information poll turns.
Design
process({ action: "run", command, ... })as the one-call command execution path.waitMsfor quick completion; default is two minutes.process_completedsession event with final output on exit.processactions for workflows that really do need background process control.Validation
pnpm --filter @openacme/tools test -- process-run.test.tspnpm --filter @openacme/tools check-typespnpm --filter @openacme/tool-host check-typespnpm --filter @openacme/tool-host testpnpm --filter @openacme/server check-typespnpm --filter @openacme/tasks check-typespnpm --filter web check-typespnpm --filter @openacme/server... build