feat: support RLM training over ACP - #2386
Closed
hallerite wants to merge 13 commits into
Closed
Conversation
hallerite
force-pushed
the
feat/rlm-acp-contract
branch
from
August 17, 2026 17:42
24a3788 to
fc90deb
Compare
hallerite
force-pushed
the
feat/rlm-acp-contract
branch
from
August 17, 2026 19:48
6cb8830 to
edbe71a
Compare
hallerite
force-pushed
the
feat/rlm-acp-contract
branch
from
August 17, 2026 20:41
edbe71a to
4ab0bdc
Compare
This was referenced Aug 18, 2026
hallerite
force-pushed
the
feat/rlm-acp-contract
branch
from
August 18, 2026 22:50
3f8ca38 to
4b4b1ac
Compare
hallerite
force-pushed
the
feat/rlm-acp-contract
branch
2 times, most recently
from
August 19, 2026 19:23
eb232a8 to
1b401b7
Compare
hallerite
force-pushed
the
feat/rlm-acp-contract
branch
from
August 19, 2026 21:20
1b401b7 to
dcadf55
Compare
This was referenced Aug 21, 2026
hallerite
force-pushed
the
feat/rlm-acp-contract
branch
from
August 21, 2026 23:34
dcadf55 to
63aeea1
Compare
hallerite
marked this pull request as ready for review
August 22, 2026 00:20
Contributor
ApprovabilityVerdict: Not approved Macroscope's review found this PR not approvable — This PR adds substantial RLM-over-ACP functionality while changing shared ACP lifecycle, close-time metric finalization, trace reply semantics, and model interception/idempotency behavior. The cross-process contract and broad runtime effects exceed the scope of a small isolated change and warrant human review. You can add or adjust custom eligibility rules. Learn more. |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit e4afc7b. Configure here.
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.

Summary
ai.prime.rlm/runtime-v1payload through ACPsession/newsession/closemetadata through the generic runner and let the RLM harness validate its finalai.prime.rlm/session-v1snapshot into training metricsmainVerifiers does not model RLM lineage, compaction, subagents, or agent-specific ACP lifecycle artifacts. Those semantics stay inside nano-rlm. Verifiers transports standard ACP metadata and records every intercepted parent and descendant model call in the trace graph.
Contract
This intentionally requires the nano-rlm contract merged in PrimeIntellect-ai/nano-rlm#134. No compatibility path or temporary commit pin remains; the harness default and CI both use nano-rlm
main.Validation
main(c27f8ea): 1 passed in 44.89s1.0, no errors, five sampled turns,sub_rlm_num_calls = 2,has_sub_rlm = 1Note
Add RLM training support over ACP with session metadata and close metrics
session_metafromRLMHarness._runtime_metadatainstead of environment variables;prepare_acponly forwards resolved env andRLM_HOME.ACPSession.closenow returns a metadata dict from the close-session response, andserve_streamincludes it in shutdown responses;ACPHarnessSession._stoprecords harness metrics on the trace viaacp_close_metricsand raisesHarnessFinalizationErroron shutdown/finalization failures.TraceandSegmentgain aprimary_replyfield;last_replyprefers it so child responses do not leak as the primary reply.Idempotency-Keyhandling for non-streaming calls: coalesces concurrent attempts, replays cached responses, rejects key reuse with different body/path, and applies TTL/size eviction via_prune_idempotent_requests.HarnessFinalizationErrorto the public verifier API and new tests for idempotency and the RLM Prime contract.RLMHarness.summarize_thresholdnow returnsint | Noneinstead ofstr; any consumer expecting a string threshold will need updating.RLMHarnessConfigadds new policy fields and validation (e.g.max_outputdisallows 0,max_concurrent_subagents >= max_depth) that may reject previously accepted configs.Macroscope summarized 762650a.
Note
High Risk
Changes the model interception path (idempotency coalescing) and RLM configuration transport; close-time metric finalization now fails rollouts when artifacts are missing.
Overview
Adds RLM training over ACP by sending typed
ai.prime.rlm/runtime-v1config through ACPsession_metainstead of RLM env vars, and reading training metrics from validatedsession/closemetadata (ai.prime.rlm/session-v1) rather than scrapingmeta.jsonon disk.RLMHarnessConfiggrows policy fields (limits, kernel env, SDK retries, etc.); default nano-rlm ref ismain, overridable in E2E viaNANO_RLM_E2E_VERSION.Introduces
Trace.primary_reply(andSegment/last_replybehavior) so ACP harnesses can expose the canonical user-visible answer when subagent branches pollute graph leaf order; ACP prompts set it from the session reply.ACP shutdown now returns close metadata to the host; harnesses implement
acp_close_metrics. Failures to finalize required close artifacts raiseHarnessFinalizationErrorand fail the rollout (not best-effort teardown).The interception server honors non-streaming
Idempotency-Key: coalesce in-flight duplicates, replay completed responses with TTL/size bounds, reject key/body mismatches, and rewrite upstream keys per rollout session.New tests cover idempotency, wire
primary_reply, ACP resumeprimary_reply, and a deterministic Prime VM RLM contract E2E.Reviewed by Cursor Bugbot for commit 762650a. Bugbot is set up for automated code reviews on this repo. Configure here.