perf(agents): pool shared harness runtimes - #191
Conversation
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Greptile SummaryThe PR introduces a shared, idle-reaped runtime pool for OpenCode subagents and wires its lifecycle into the server.
Confidence Score: 4/5The OpenCode pooling path should be fixed before merging because an unexpectedly dead harness remains cached and can make every later turn fail. The new pool supports replacement only when a runtime reports itself unusable, while the OpenCode implementation continues reporting usable after server or transport failures unless the pool explicitly closes it. Files Needing Attention: src/local-agent-adapters.ts, src/local-agent-runtime-pool.ts
|
| Filename | Overview |
|---|---|
| src/local-agent-runtime-pool.ts | Adds shared runtime acquisition, idle reaping, and shutdown handling; failed runs rely on the runtime implementation to report itself unusable. |
| src/local-agent-adapters.ts | Extracts OpenCode into a reusable harness runtime, but its usability state does not reflect an unexpectedly failed server. |
| src/local-agent-runtime-registry.ts | Routes OpenCode through the pool while preserving one-shot behavior for other providers. |
| src/server.ts | Creates the runtime registry and shuts it down after queued local-agent work drains. |
| src/local-agent-runtime-pool.test.ts | Covers reuse and idle eviction but not recovery after the underlying harness fails. |
Flowchart
%%{init: {'theme': 'neutral'}}%%
flowchart TD
Request[Subagent request] --> Manager[LocalAgentManager]
Manager --> Registry[LocalAgentRuntimeRegistry]
Registry -->|OpenCode| Pool[HarnessRuntimePool]
Registry -->|Other provider| Adapter[One-shot adapter]
Pool -->|Acquire or create| Runtime[OpenCode harness runtime]
Runtime --> Result[Provider result]
Result --> Manager
Reaper[Idle reaper] -->|Close idle runtime| Runtime
Shutdown[Server shutdown] --> Manager
Shutdown -->|After manager drains| Pool
Reviews (1): Last reviewed commit: "test(agents): cover runtime reuse and ev..." | Re-trigger Greptile
67e1f7e to
e0d8d54
Compare
a72edee to
d256e42
Compare
Provider adapters currently create expensive runtime resources for individual turns. This adds a small server-owned runtime registry and pool, then proves the sharing model with OpenCode: compatible agents reuse one OpenCode server while active work prevents eviction and idle runtimes are reclaimed.\n\nThe pool only owns live resources; logical agent identity and durable continuation state remain outside it. Provider-specific sharing policy stays behind each driver runtime key. Stacked on #190.