Skip to content

Autonomous Eval - #278

Merged
kevinjosethomas merged 89 commits into
mainfrom
feature/autonomous-eval
Jul 13, 2026
Merged

Autonomous Eval#278
kevinjosethomas merged 89 commits into
mainfrom
feature/autonomous-eval

Conversation

@sethkarten

@sethkarten sethkarten commented Jun 29, 2026

Copy link
Copy Markdown
Contributor

Summary

Combines the open Seth Karten draft/review PRs needed for the Autonomous Eval stack into one integration branch:

Also updates the single autonomous mode semantics for evaluator-controlled runs:

  • autonomous mode does not trust the model's prose or a git diff as terminal evidence
  • failed verifier/quality gates feed back into the agent so it keeps repairing while budget remains
  • passing verifier/quality gates are the host/evaluator completion condition for autonomous evals
  • repeated unchanged failing-gate feedback is compacted to avoid context blow-up

This is intended for EmulatorBench autonomous evals where the verifier/eval harness, not the model, decides when the run is complete.

Validation

  • npm install
  • npm --prefix packages/coding-agent test -- suite/agent-session-autonomous.test.ts args.test.ts print-mode.test.ts suite/agent-session-compaction.test.ts daemon-mode.test.ts model-resolver.test.ts refinement.test.ts agent-observe.test.ts agent-session-bus.test.ts agent-session-services.test.ts — 215 passed
  • ./node_modules/.bin/tsgo --noEmit
  • git diff --check
  • pre-commit full check passed: biome check --write --error-on-warnings . && tsgo --noEmit && npm run check:installer && npm run check:browser-smoke

Notes

The EmulatorBench verifier hardening (fixed feedback mode, no agent --mode override) lives in the research-environments-private side; this PR covers Prime Agent.


Note

High Risk
Changes the core agent turn/stop and compaction continuation paths (now async) and executes configurable shell gate commands with process-tree kills on timeout—security- and stability-sensitive for eval harnesses.

Overview
Autonomous eval mode lets a host or harness keep the agent running without human input until configured quality gates pass or budget limits (continuations, turns, tokens, wall time) are hit. Completion is driven by gate commands and limits—not assistant prose or a bare git diff.

New --autonomous and related CLI flags wire into session runtime config. A new autonomous.ts module runs gate commands (with timeouts, output caps, and git worktree snapshots to skip reruns when the workspace is unchanged), tracks usage (cache-read tokens excluded from the token budget), and builds continuation user messages.

AgentSession merges autonomous config, exposes /autonomous on|off|status, chains autonomous continuations after goal continuations via getContinuationMessages, and supports internalPrompt / suppressAutonomousContinuation so host-driven gate follow-ups are not double-injected. Threshold compaction can queue autonomous follow-ups before stopping the tool loop; bookkeeping restores or clears those queues when compaction is skipped or autonomous mode is turned off. _shouldStopAfterTurn is now async.

Print mode acts as the host loop: after idle, it may feed gate failures back as internal follow-up prompts, refresh gates, and exit 1 if gates still fail or limits are reached.

Autonomous mode is forced off when rlmDepth > 0. Docs now list defaultThinkingLevel default as xhigh; agent-observe documents get_agent returning { agent }; orchestration heartbeat sanitizes label fields.

waitForChildProcess normalizes signal exits and handles already-exited children—used by gate subprocess handling.

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

Note

Add autonomous eval mode with quality gates and continuation limits to the coding agent

  • Introduces a new autonomous mode (autonomous.ts) that injects follow-up user prompts when quality gates fail or terminal evidence is missing, with configurable limits on continuations, turns, tokens, and timeout.
  • Adds CLI flags (--autonomous, --autonomous-gate, --autonomous-max-turns, etc.) parsed in args.ts and wired through to session config via main.ts.
  • Extends AgentSession to track autonomous runtime state, handle /autonomous on|off|status slash commands, and suppress autonomous continuations for host-driven or internal prompts.
  • Integrates autonomous gate evaluation into print mode (print-mode.ts), exiting with code 1 when gates still fail after retries or autonomous limits are reached.
  • Autonomous mode is automatically disabled for recursive (subagent) sessions where rlmDepth > 0.
  • Risk: _shouldStopAfterTurn is now async, and threshold compaction may queue autonomous continuations that alter post-compaction session flow.

Changes since #278 opened

  • Refactored runChildProcess function to spawn child processes with detached=true on non-Windows platforms, track PIDs using trackDetachedChildPid and untrackDetachedChildPid, replace manual event handling with waitForChildProcess, and terminate entire process trees via killProcessTree on timeout instead of the previous SIGTERM-then-SIGKILL sequence [5ea8cdb]
  • Added test helper utilities isProcessRunning and waitForProcessExit and implemented test case 'terminates the autonomous gate process tree when the timeout expires' to verify process tree termination behavior on timeout [5ea8cdb]

Macroscope summarized 1705450.

# Conflicts:
#	packages/coding-agent/CHANGELOG.md
#	packages/coding-agent/src/core/prompts/rlm.ts
#	packages/coding-agent/test/system-prompt.test.ts
Comment thread packages/coding-agent/src/core/agent-session.ts
Comment thread packages/coding-agent/src/core/agent-session.ts Outdated
Comment thread packages/coding-agent/src/modes/print-mode.ts
Comment thread packages/coding-agent/src/core/agent-session.ts
Comment thread packages/coding-agent/src/core/autonomous.ts Outdated
Comment thread packages/coding-agent/src/modes/print-mode.ts Outdated
Comment thread packages/coding-agent/src/modes/print-mode.ts
# Conflicts:
#	packages/coding-agent/CHANGELOG.md
#	packages/coding-agent/src/core/agent-session.ts
@sethkarten

Copy link
Copy Markdown
Contributor Author

@kevinjosethomas PR 278 is rebased on current main. CI, Macroscope, and Cursor Bugbot are green, and all review threads are resolved. Remaining blocker is the required approval review.

sethkarten and others added 3 commits July 10, 2026 15:14
# Conflicts:
#	packages/coding-agent/CHANGELOG.md
# Conflicts:
#	packages/coding-agent/CHANGELOG.md
#	packages/coding-agent/src/core/agent-session.ts

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

Want reviews to match your repository better? Bugbot Learning can learn team-specific rules from PR activity. A team admin can enable Learning in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 3af140d. Configure here.

Comment thread packages/coding-agent/src/core/autonomous.ts Outdated
Comment thread packages/coding-agent/src/core/autonomous.ts Outdated
Comment thread packages/coding-agent/src/core/defaults.ts Outdated
Comment thread packages/coding-agent/src/modes/print-mode.ts
Comment thread packages/coding-agent/src/modes/print-mode.ts
Comment thread packages/coding-agent/CHANGELOG.md Outdated
Comment thread packages/coding-agent/src/main.ts Outdated
Comment thread packages/coding-agent/src/core/autonomous.ts
@kevinjosethomas
kevinjosethomas merged commit 461bae0 into main Jul 13, 2026
3 checks passed
kevinjosethomas added a commit that referenced this pull request Jul 14, 2026
@kevinjosethomas
kevinjosethomas deleted the feature/autonomous-eval branch July 16, 2026 23:51
zhengr pushed a commit to zhengr/prime-agent that referenced this pull request Aug 8, 2026
- Merge branch event into session with before_branch/branch reasons
- Add before_switch, before_clear, shutdown reasons
- before_* events can be cancelled with { cancel: true }
- Update RPC commands to return cancelled status
- Add shutdown event on process exit
- New example hooks: confirm-destructive, dirty-repo-guard, auto-commit-on-exit

fixes PrimeIntellect-ai#278
zhengr pushed a commit to zhengr/prime-agent that referenced this pull request Aug 8, 2026
* feat(coding-agent): add auto refine review hook

* fix(coding-agent): keep auto refine model stable

* fix(coding-agent): defer auto refine during compaction continuations

* fix(coding-agent): keep auto refine reviews pending safely

* Add user orchestrator agent messaging and observe

* Add orchestration heartbeat skill

* fix(coding-agent): guard pending auto refine application

* fix(coding-agent): clear auto refine state on branch navigation

* Address user orchestrator PR review comments

* Tighten agent message rate limiting

* Harden agent message queue safety

* Preserve agent message reservations on queue clear

* Serialize agent messages per target

* Handle queued agent message edge cases

* Preserve orchestration heartbeat schedule on refresh

* docs(coding-agent): guide refine scope decisions

* feat(coding-agent): split harness state into local and global scopes

* fix(coding-agent): target refine rollback scope from history

* fix(coding-agent): record auto refine cooldown after branch changes

* fix(coding-agent): harden auto refine scope handling

* feat: add autonomous continuation mode

* feat: require autonomous terminal evidence

* Clarify refine as continual harness state

* Strengthen continual harness refine language

* Balance continual harness and RLM wording

* Fix auto-refine review comments

* Fix refine scope status label

* Address follow-up auto-refine comments

* Preserve refine scope defaults across clients

* Preserve refine scope defaults in servers

* Normalize refine display ids by scope

* Use original local harness for refine rollback

* Harden auto-refine state routing

* Preserve explicit harness dir on cache hits

* Defer heartbeat cron jobs while sessions are active

* feat(coding-agent): default thinking to xhigh

* fix: keep print autonomous gates running

* fix: avoid autonomous gate rerun without workspace changes

* fix: ignore generated lockfile for autonomous gate rerun guard

* fix: keep autonomous evals under verifier control

* fix: let verifier gates complete autonomous evals

* test: update rlm prompt expectation

* fix: keep print-mode autonomous gates progressing

* fix: advance unchanged autonomous gate retries

* fix: keep print-mode gates alive on repeated status

* fix: report print-mode autonomous limit reasons

* fix: ignore failed turns in autonomous usage

* fix: clear queued autonomous continuations

* fix: preserve autonomous continuations on retry

* fix: verify gates before autonomous limits

* fix: keep queued continuations cancellable

* fix: stop print gate loop on assistant errors

* fix: clear autonomous queue on skipped compaction

* fix: restore autonomous state on skipped compaction

* fix: preserve queued autonomous continuations

* fix: keep autonomous print gates alive after transient errors

* fix: count print-mode autonomous gate continuations

* fix: wait for queued autonomous gate retries

* fix: bypass input handlers for autonomous gate retries

* fix(coding-agent): bypass input handlers for internal prompts

* fix(coding-agent): address autonomous review findings

* fix(coding-agent): respect autonomous prompt backpressure

* fix(coding-agent): suppress host gate auto continuations

* fix(coding-agent): preserve queued host gate suppression

* fix(coding-agent): refresh print-mode autonomous gates

* fix(coding-agent): address autonomous review blockers

* fix(coding-agent): harden autonomous gate verification

fixes PrimeIntellect-ai#278

* fix(coding-agent): kill autonomous gate process trees

fixes PrimeIntellect-ai#278

---------

Co-authored-by: Kevin Thomas <kevin.jt2007@gmail.com>
thomaswillner pushed a commit to thomaswillner/prime-agent that referenced this pull request Aug 29, 2026
Records, without editing the now-false text away, that sections 9 and 4 went
stale five hours after they were written. The correction matters more than the
content: this file exists to stop sessions trusting notes over GitHub, and it
caught its own author.

- main is 8d2139c. Between 16:12Z and 21:54Z the fleet merged PrimeIntellect-ai#279 (the PrimeIntellect-ai#58
  alert-bridge race, FIXED — stop carrying it as a standing exception), PrimeIntellect-ai#278
  (AGENTS.md invariants), PrimeIntellect-ai#283 (repo cleanup), and PrimeIntellect-ai#284, which delivered the
  last brief and closed PrimeIntellect-ai#165 with a keyword.
- Section 3's routing conclusion was confirmed by events: PrimeIntellect-ai#271 was delivered
  by the Mac maker fleet via auto-dispatch, exactly as argued, and the remote
  session correctly declined to open a second lane.
- Flags issue-state drift: PrimeIntellect-ai#271, PrimeIntellect-ai#276 and PrimeIntellect-ai#274 are delivered and merged yet
  still open, because a title reference is not a closing keyword. That is the
  mirror image of the hazard the V2 CLAUDE.md documents, and it leaves
  open-work disagreeing with main. Operator action, named as such.
- Records the residual PrimeIntellect-ai#284 deferred on stated grounds (PrimeIntellect-ai#286), which is a
  known open edge on the LIVE path.
- States the next slice: S4 / PrimeIntellect-ai#236, the first whose exit criteria need a real
  broker order. Certification stays 0/12; the system has never placed a trade.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01G5B7QM1QLQuWSBMCxiCzS6
thomaswillner added a commit to thomaswillner/prime-agent that referenced this pull request Aug 29, 2026
…e-notes lesson (#13)

* docs(spx-v2): verification pass, queue state, and self-refinement record

No code written this session — a verification pass over already-delivered
work plus the queue-state answer.

Records, so future sessions do not repeat them:

- The audit-challenge / V1-coverage / rag-tot-cot-challenge / corrected-input
  deliverable ALREADY EXISTS (AUDIT_CHALLENGE sections A-D and
  PRIME_AGENT_INPUT_SPX_V2). An operator prompt has now asked for it in at
  least two sessions; redoing it is inventing work.
- Verified queue state from GitHub: PrimeIntellect-ai#266/PR PrimeIntellect-ai#268 merged (and PrimeIntellect-ai#263 with it,
  now main f64029a); PrimeIntellect-ai#265/PR PrimeIntellect-ai#269 and PrimeIntellect-ai#264/PR PrimeIntellect-ai#270 open with CI in flight;
  PrimeIntellect-ai#272 and PrimeIntellect-ai#271 filed, unstarted, no lane.
- Errors and corrections: settle elapsed time from GitHub workflow-run
  timestamps, never the container clock; add_repo push access was
  classifier-denied so a remote session may hold read-only and cannot push;
  register_repo_root denial falls back to reading CLAUDE.md directly.
- MATS/superpowers/routing settled empirically with the exact commands used,
  so the search is not repeated: they are Mac-harness resident, and PrimeIntellect-ai#272/PrimeIntellect-ai#271
  already carry auto-dispatch, which is what routes them to the maker fleet.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01G5B7QM1QLQuWSBMCxiCzS6

* docs(spx-v2): implementation-session addendum — access, setup, CI outage, self-review

Appends the second half of the session to the notes: implementing PrimeIntellect-ai#272 after
the operator corrected two access assumptions.

The corrections matter more than the code:
- push DOES work; "I cannot push" was inferred from add_repo's access label
  rather than tested. A dry-run push proved it. Also: the refspec push form is
  classifier-denied while `git push -u origin <branch>` succeeds.
- this host is not the MacBook (uname, no /Users, no ~/.prime).

Also records the environment setup the Makefile assumes (venv before
v2-install, ruff 0.15.22 via python -m, seeding the gitignored account.yaml,
and proving PYTHONPATH beats editable installs in a worktree), the method that
diagnosed the repo-wide CI outage in two calls (zero recorded steps, then the
same workflow red on main), and two test defects self-review caught before
pushing.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01G5B7QM1QLQuWSBMCxiCzS6

* docs(spx-v2): final queue state — PrimeIntellect-ai#273 merged, only PrimeIntellect-ai#271 remains

Closes the record for this session.

- All five briefed PRs merged (PrimeIntellect-ai#268, PrimeIntellect-ai#263, PrimeIntellect-ai#270, PrimeIntellect-ai#269, PrimeIntellect-ai#273); main is c84855d.
  Issues PrimeIntellect-ai#266 and PrimeIntellect-ai#272 closed by their PRs. PrimeIntellect-ai#271 is the only open brief and
  was never authorised, so never started. Runtime testing is unblocked.
- The CI outage (13:51Z-15:47Z) was account-level and hit main identically;
  recovery was visible as `changes` taking 9s with real steps instead of 2s
  with none. Nothing in the diff ever needed changing.
- Records the scope misjudgement worth carrying forward: a Codex P1 mapped
  directly to an acceptance checkbox I had deferred as out of scope. When a
  finding maps to an acceptance criterion it is in scope by definition.
- Records the auto-merge hazard: squash composes the commit message from the
  PR body, so a body left stale after a review round writes false claims into
  main permanently. Rewrite the body before merge; keep corrections visible.
- Records a published test claim that had not been executed, and the rule
  that follows from it.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01G5B7QM1QLQuWSBMCxiCzS6

* docs(spx-v2): correct the queue state — the last brief landed while idle

Records, without editing the now-false text away, that sections 9 and 4 went
stale five hours after they were written. The correction matters more than the
content: this file exists to stop sessions trusting notes over GitHub, and it
caught its own author.

- main is 8d2139c. Between 16:12Z and 21:54Z the fleet merged PrimeIntellect-ai#279 (the PrimeIntellect-ai#58
  alert-bridge race, FIXED — stop carrying it as a standing exception), PrimeIntellect-ai#278
  (AGENTS.md invariants), PrimeIntellect-ai#283 (repo cleanup), and PrimeIntellect-ai#284, which delivered the
  last brief and closed PrimeIntellect-ai#165 with a keyword.
- Section 3's routing conclusion was confirmed by events: PrimeIntellect-ai#271 was delivered
  by the Mac maker fleet via auto-dispatch, exactly as argued, and the remote
  session correctly declined to open a second lane.
- Flags issue-state drift: PrimeIntellect-ai#271, PrimeIntellect-ai#276 and PrimeIntellect-ai#274 are delivered and merged yet
  still open, because a title reference is not a closing keyword. That is the
  mirror image of the hazard the V2 CLAUDE.md documents, and it leaves
  open-work disagreeing with main. Operator action, named as such.
- Records the residual PrimeIntellect-ai#284 deferred on stated grounds (PrimeIntellect-ai#286), which is a
  known open edge on the LIVE path.
- States the next slice: S4 / PrimeIntellect-ai#236, the first whose exit criteria need a real
  broker order. Certification stays 0/12; the system has never placed a trade.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01G5B7QM1QLQuWSBMCxiCzS6

---------

Co-authored-by: Claude <noreply@anthropic.com>
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.

2 participants