Skip to content

[v0.8 replacement 2/5] preserve ACP metadata - #2325

Open
sethkarten wants to merge 2 commits into
v080/main-replacement-prime-harnessfrom
v080/main-replacement-acp-meta
Open

[v0.8 replacement 2/5] preserve ACP metadata#2325
sethkarten wants to merge 2 commits into
v080/main-replacement-prime-harnessfrom
v080/main-replacement-acp-meta

Conversation

@sethkarten

@sethkarten sethkarten commented Aug 11, 2026

Copy link
Copy Markdown

Replacement stack

Node 2/5 in a fresh append-only v0.8 replacement chain rooted at authoritative main commit c2820d3679e6318f9c3d0155c823d6908b4e1faa.

  • Base branch: v080/main-replacement-prime-harness
  • Head branch: v080/main-replacement-acp-meta
  • Exact head: 2d0f15ce63529c30e7a8b3ae7ebffc7d96d722b0

Scope

Exact coherent #2286 ACP metadata preservation delta: 21 paths; patch-id preserved.

The old contributor PR branches remain untouched. This branch was published non-force from a fresh owned repository. Independent Luna semantic review APPROVED the full N1→N5 chain and found no structural scope leakage; authoritative-main renderer provenance is retained and pyproject.toml / uv.lock are unchanged across replacement nodes.

Warning

TEST BLOCKED — do not merge or mark ready. Authoritative c2820d has a stale uv.lock relative to pyproject.toml. A disposable uv sync --locked correctly refused before tests, without changing repository files. The only previously approved interpreter also cannot import current main because pydantic_config is absent. Testing/remediation continues on GitHub; this draft does not claim green.

No live, hosted, Docker, sandbox, model, or paid evaluation was run.

Note

Preserve ACP metadata into rollout traces across all agent harnesses

  • Adds _record_acp_meta in acp/init.py to accumulate per-namespace ACP SessionInfoUpdate metadata event lists onto trace.info['acp_meta'] without flattening or overwriting history.
  • Updates ACP.run and ACP._run to accept a trace argument; after a one-shot run, reads meta.json from disk and records it via _record_acp_meta.
  • Extends runner.py to capture field_meta events into global and per-turn metadata buckets; adds wait_for_late_metadata to collect updates arriving after a prompt reply; returns per-turn metadata in streamed responses.
  • Passes trace=trace in all agent harnesses (claude-code, codex, hermes, kimi, openclaw, pi, pool, prime-agent, rlm) to enable metadata recording.
  • Adds guard helpers in prime_agent_meta_guards.py and new fixture tasksets for testing subagent lifecycle, autonomous gate, harness state, and negative scenarios; all raise MissingAcpMeta when expected metadata is absent rather than silently scoring zero.

Macroscope summarized c7a1bde.


Note

Medium Risk
Touches core ACP turn completion timing (up to ~1s grace on metadata-less turns) and rollout trace shape; harness wiring is broad but mostly additive opt-in via trace.

Overview
Rollout traces now accumulate ordered, namespaced ACP extension metadata from SessionInfoUpdate.field_meta, exposed as trace.info["acp_meta"] via _record_acp_meta (append-only per namespace, no flattening).

The ACP runner captures metadata into session-wide and per-turn buckets, waits for late metadata after each prompt (grace window vs. short settle so stragglers are not dropped or attributed to the wrong turn), writes meta.json on one-shot runs, and returns per-turn meta on live session responses. ACP.run / _run and session prompts accept trace and record metadata; all major ACP harnesses pass trace=trace.

Prime Agent eval coverage adds shared prime_agent_meta_guards (raise MissingAcpMeta when required _meta is missing), fixture tasksets, unit tests, and Docker e2e tests for subagents, autonomous gates, harness state, and killed-child failures.

Reviewed by Cursor Bugbot for commit c7a1bde. Bugbot is set up for automated code reviews on this repo. Configure here.

@sethkarten
sethkarten marked this pull request as ready for review August 12, 2026 06:18
@macroscopeapp

macroscopeapp Bot commented Aug 12, 2026

Copy link
Copy Markdown

Approvability

Verdict: Needs human review

This PR enables ACP metadata preservation across all harnesses, introducing new runtime behavior with timing-sensitive async logic for collecting late metadata updates. The cross-cutting nature of changes and new feature enablement warrants human verification.

No code changes detected at c7a1bde. Prior analysis still applies.

You can customize Macroscope's approvability policy. Learn more.

# Conflicts:
#	verifiers/v1/acp/__init__.py

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit c7a1bde. Configure here.

# Keep those in acp_meta history, but start a fresh live-response bucket at the
# prompt boundary so pre-prompt metadata neither leaks into this response nor
# shortens the first-event grace period below.
client.turn_acp_meta = {}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Live path drops pre-prompt meta

Medium Severity

prompt clears turn_acp_meta at the prompt boundary while comments claim pre-prompt SessionInfoUpdate events stay in acp_meta, but the live stream only returns turn_acp_meta. Cumulative acp_meta is written only on the one-shot path via write_meta, so session-start and resume metadata never reaches the host trace for live ACP sessions.

Additional Locations (2)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit c7a1bde. Configure here.

@sethkarten
sethkarten requested a review from hallerite August 13, 2026 01:25
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