Repository navigation
perf(headless-runner): reuse a turn's tools and memory across its steps - #7417
Merged
Merged
Conversation
A turn that runs step by step connected to OpenWork MCP, listed the tools and read memory/ again before every model call. A turn run in one go does each once. - The run's first step lists the tools and reads memory; later steps show the model the same list and memory, so every request starts the same and no later step waits on either before its model call. - A later step connects only when the model calls an MCP tool, starting as soon as the model begins writing the call, and closes when the step ends. Nothing stays open between steps. - When that connection can't be made, the step's MCP calls say they were not made and the next step connects again. The turn no longer ends mcp_unavailable there; the first step still does. - A restart or a fresh MCP token lists the tools again. Signed-off-by: Jalil <reachjalil@gmail.com>
Contributor
|
The latest updates on your projects. Learn more about Vercel for GitHub. 3 Skipped Deployments
|
This branch was previously deployed
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.
What is this about?
Making each step of a headless runner turn start sooner: a step-mode turn now lists the OpenWork MCP tools and reads
memory/once, not before every model call.What problem does it solve?
Every step reconnected to OpenWork MCP, listed the tools and re-read memory before calling the model. In a hosted runner's turn logs that took about a second per step at the median, and most steps never call an MCP tool. A memory write mid-turn also changed the next step's system prompt, which missed the prompt cache.
What was the situation before?
A turn run in one go connected and read memory once. A step-mode turn, which is every new turn, did both on every step.
How is this implemented?
runner.ts: the run keeps the tool list (per MCP token) and the memory files its first step read; later steps reuse them.laterStepTools: a later step connects only when the model calls an MCP tool, starting as the model begins writing the call, and closes when the step ends. Nothing stays open between steps.mcp_unavailablethere; the first step still does.What else changed?
OWNER-CELLS.mdandmemory.tscomments describe the once-per-run reads.Release note
Multi-step answers from Workbot, Slack replies and Automations start each step sooner.
Evidence
scripts/steps.test.ts— before: a connection and a memory read before every step's model call; after: one tool listing and one memory read per run, and a later connection only for an MCP call.scripts/steps.test.ts— before: an unreachable MCP server on a later step ended the turn; after: the call says it was not made and succeeds on the next step.