refactor(v1): simplify Prime Agent harness lifecycle - #2419
Conversation
| self.tool_calls[update.tool_call_id] = update.status or "pending" | ||
| elif isinstance(update, ToolCallUpdate): | ||
| if update.status and self._is_current_turn_event(event): | ||
| if update.status: |
There was a problem hiding this comment.
🟡 Medium acp/runner.py:58
With allow_empty_tool_reply enabled, a delayed ToolCallUpdate from the previous prompt can populate tool_calls after client.reset(), causing the current prompt to pass completed_tool_turn and return an empty reply as success. Correlate tool updates with the active prompt turn and ignore stale notifications when updating tool_calls.
🚀 Reply "fix it for me" or copy this AI Prompt for your agent:
In file @verifiers/v1/acp/runner.py around line 58:
With `allow_empty_tool_reply` enabled, a delayed `ToolCallUpdate` from the previous prompt can populate `tool_calls` after `client.reset()`, causing the current prompt to pass `completed_tool_turn` and return an empty reply as success. Correlate tool updates with the active prompt turn and ignore stale notifications when updating `tool_calls`.
| isinstance(update, AgentMessageChunk) | ||
| and isinstance(update.content, TextContentBlock) | ||
| and self._is_answer_chunk(event) | ||
| elif isinstance(update, AgentMessageChunk) and isinstance( |
There was a problem hiding this comment.
🟠 High acp/runner.py:60
session_update appends text from Prime lifecycle AgentMessageChunks marked compaction, refinement, or subagents to visible_reply, so the harness can return internal or child output instead of the agent's actual answer. Because a different message_id also clears the existing reply first, these chunks can replace the answer entirely; restore the lifecycle metadata filter before accumulating text.
🚀 Reply "fix it for me" or copy this AI Prompt for your agent:
In file @verifiers/v1/acp/runner.py around line 60:
`session_update` appends text from Prime lifecycle `AgentMessageChunk`s marked `compaction`, `refinement`, or `subagents` to `visible_reply`, so the harness can return internal or child output instead of the agent's actual answer. Because a different `message_id` also clears the existing reply first, these chunks can replace the answer entirely; restore the lifecycle metadata filter before accumulating text.
|
Superseded by #2420. The replacement keeps the same simplified Prime Agent harness, includes the |
Summary
ACPHarnessimplementationDependency
Depends on Prime Agent #1612, which makes
session/promptitself wait for terminal RLM/subagent quiescence and propagate terminal failure. Before merge, the pinned Prime Agent version should be updated to a release containing that change.Resulting stack
Relative to the current #2355 head, this removes 1,138 lines and adds 53. Relative to #2355's original base, the complete Prime Agent harness is 234 added lines across four files; generic ACP and scoring code are unchanged.
Validation
uv run ruff check --fix .: passeduv run pytest tests/: 914 passed, 76 skipped (fixture commits ran with signing disabled because the 1Password agent was unavailable)prime-agent-acp-in-prime-vmE2E using the configured Prime API key: passed in 75.58s, including native MCP tool use, session resume, intercepted model calls, scoring, and cleanuptypasseduv run pre-commit run --all-files: Python hooks passed; the repository-wide run is blocked only by 321 existing MD033 errors in untouchedverifiers/legacy/envs/experimental/composable/tasksets/swe/README.mdThe Prime Agent Chat Completions replay does not preserve provider-only response state, so the interception server correctly retains its calls as separate trace branches instead of inventing false lineage. The E2E still verifies that every model call and ACP tool event is captured.
Note
Remove lifecycle metadata tracking from ACP runner and Prime Agent harness
VerifiersACPClient,ACPConfig, andACPHarnessSession._run. Theprompt()function now returns a plain reply string instead of a dict with lifecycle fields.autonomousandrequire_terminal_quiescenceconfig options fromPrimeAgentHarnessConfigand stops passing autonomous CLI flags or a lifecycle namespace to the Prime Agent subprocess. Default version bumps to0.7.4-beta.533.1.848081e.trace.info['acp_answer_fallback']handling inread_answer_file_or_last_reply; the scorer now falls back directly totrace.last_reply.prime-agentin test_e2e.py.prompt()now raisesRuntimeErrorimmediately onRequestErrorinstead of correlating lifecycle state; callers that expected a dict return or a stop_reason field will break. Theserve_streamprotocol response no longer includesstop_reason,response_boundary, orlifecyclekeys.📊 Macroscope summarized 13445b8. 4 files reviewed, 2 issues evaluated, 0 issues filtered, 2 comments posted
🗂️ Filtered Issues