Skip to content

refactor(v1): simplify Prime Agent harness lifecycle - #2419

Closed
hallerite wants to merge 2 commits into
codex/prime-agent-harnessfrom
codex/simplify-prime-agent-harness
Closed

refactor(v1): simplify Prime Agent harness lifecycle#2419
hallerite wants to merge 2 commits into
codex/prime-agent-harnessfrom
codex/simplify-prime-agent-harness

Conversation

@hallerite

@hallerite hallerite commented Aug 21, 2026

Copy link
Copy Markdown
Member

Summary

  • remove the Prime-specific lifecycle protocol from the generic ACP runner
  • remove lifecycle-derived shared scoring behavior and the mocked lifecycle unit suite
  • keep Prime Agent as a normal, 212-line ACPHarness implementation
  • add Prime Agent to the standard ACP resume/MCP E2E matrix on a Prime VM

Dependency

Depends on Prime Agent #1612, which makes session/prompt itself 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 .: passed
  • uv run pytest tests/: 914 passed, 76 skipped (fixture commits ran with signing disabled because the 1Password agent was unavailable)
  • live prime-agent-acp-in-prime-vm E2E using the configured Prime API key: passed in 75.58s, including native MCP tool use, session resume, intercepted model calls, scoring, and cleanup
  • commit/push hooks: markdownlint, Ruff check/format, and ty passed
  • uv run pre-commit run --all-files: Python hooks passed; the repository-wide run is blocked only by 321 existing MD033 errors in untouched verifiers/legacy/envs/experimental/composable/tasksets/swe/README.md

The 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

  • Strips lifecycle status recording, stop_reason tracking, and terminal quiescence parsing from VerifiersACPClient, ACPConfig, and ACPHarnessSession._run. The prompt() function now returns a plain reply string instead of a dict with lifecycle fields.
  • Removes autonomous and require_terminal_quiescence config options from PrimeAgentHarnessConfig and stops passing autonomous CLI flags or a lifecycle namespace to the Prime Agent subprocess. Default version bumps to 0.7.4-beta.533.1.848081e.
  • Drops trace.info['acp_answer_fallback'] handling in read_answer_file_or_last_reply; the scorer now falls back directly to trace.last_reply.
  • Deletes test_prime_agent_acp_lifecycle.py and relaxes the single-branch lineage assertion for prime-agent in test_e2e.py.
  • Risk: prompt() now raises RuntimeError immediately on RequestError instead of correlating lifecycle state; callers that expected a dict return or a stop_reason field will break. The serve_stream protocol response no longer includes stop_reason, response_boundary, or lifecycle keys.
📊 Macroscope summarized 13445b8. 4 files reviewed, 2 issues evaluated, 0 issues filtered, 2 comments posted

🗂️ Filtered Issues

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:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 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(

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

@hallerite

Copy link
Copy Markdown
Member Author

Superseded by #2420.

The replacement keeps the same simplified Prime Agent harness, includes the
one-branch lineage assertion enabled by PrimeIntellect-ai/prime-agent#1612, and is
stacked directly on #2386 so Prime Agent and nano-RLM share one generic ACP
contract. This avoids retaining a review branch whose base still contains the
Prime-specific lifecycle machinery that this PR removes.

@hallerite hallerite closed this Aug 21, 2026
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.

1 participant