Skip to content

Add Prime Harness reliability layer; fix RLM billing-failure retries and Windows console windows - #1593

Closed
cdimurro wants to merge 55 commits into
PrimeIntellect-ai:mainfrom
cdimurro:merge/prime-harness-world-class-to-main
Closed

Add Prime Harness reliability layer; fix RLM billing-failure retries and Windows console windows#1593
cdimurro wants to merge 55 commits into
PrimeIntellect-ai:mainfrom
cdimurro:merge/prime-harness-world-class-to-main

Conversation

@cdimurro

@cdimurro cdimurro commented Aug 20, 2026

Copy link
Copy Markdown

Summary

  • Adds Prime Harness (prime-harness/): a reliability-first workflow orchestration harness for Prime Agent — deterministic scientific oracles, persistent provenance (evidence ledger), delegation/budget discipline, an independent cross-harness critic, and bounded graph-ranked repo reconnaissance. See prime-harness/README.md.
  • Fixes RLM children retrying permanent provider billing failures (e.g. HTTP 402 insufficient balance) and reporting them as silent completion instead of surfacing the terminal error.
  • Fixes detached daemon/worker/shell child processes popping a visible console window on Windows by setting windowsHide on every relevant spawn() call.

Test plan

  • npm run check (biome, tsgo type-check, installer render check, browser smoke check) passes on the merged tree
  • vitest --run test/agent-session-recursion.test.ts test/suite/agent-session-retry-events.test.ts — new billing-failure regression tests pass; 2 pre-existing Windows-environment failures (temp-dir cleanup EPERM, an unrelated kernel-depth-cap probe) reproduce identically with and without these changes, confirmed via a baseline worktree comparison
  • Merge from agent/prime-harness-world-class into main completed with zero conflicts (git merge-tree verified before merging)

Note

Add Prime Harness layer; fix RLM billing retries and Windows console windows

  • Introduces the prime-harness reliability layer containing new Python skills (evidence_ledger, external_critic, harness_orchestrator, repo_map, sci_verify), CLI tools (verify.py, doctor.py, replay.py, scorecard.py), and comprehensive test suites.
  • Fixes AgentSession in agent-session.ts to throw on terminal provider errors and short-circuit retries via the new _isPermanentProviderBillingFailure helper when a 402 or billing error is detected.
  • Updates child process spawn options across daemon, kernel, and shell utilities to include windowsHide: process.platform === "win32", preventing console window flashes on Windows.
  • Adds the venvPythonPath helper in bootstrap.ts to correctly resolve venv Python executable paths on Windows.
  • Behavioral Change: AgentSession child-run completion now throws an error if the child ends with stopReason === "error" instead of proceeding silently.

Macroscope summarized 943213e.

Chris Dimurro added 30 commits August 7, 2026 19:19
Chris Dimurro and others added 25 commits August 8, 2026 16:32
RLM children whose provider stream ends in a terminal error (e.g. a 402
insufficient-balance response) were reported as silent completion instead
of failure, and permanent billing failures were retried like transient
ones. Surface the terminal assistant error and stop retrying billing
failures.
Detached daemon, worker, and shell child processes opened a visible
console window on Windows because spawn() defaults windowsHide to
false. Set windowsHide on every detached/background spawn call so
these processes launch hidden, matching behavior on other platforms.
Brings in two fixes carried on the branch:
- Surface permanent recursive child failures (RLM children no longer
  retry permanent provider billing failures or report them as silent
  completion).
- Hide spawned child process windows on Windows.
@github-actions

Copy link
Copy Markdown

Hi @cdimurro, thanks for your interest in contributing!

This project requires that pull request authors are vouched, and you are not in the list of vouched users.

This PR will be closed automatically. See https://github.com/PrimeIntellect-ai/prime-agent/blob/main/CONTRIBUTING.md for more details.

@github-actions github-actions Bot closed this Aug 20, 2026

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 943213e15b

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

shell: [bash, pwsh]
defaults:
run:
shell: ${{ matrix.shell }}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Move the matrix shell out of job defaults

The new standalone CI workflow places ${{ matrix.shell }} under jobs.full-suite.defaults.run.shell, but GitHub does not allow contexts or expressions in defaults.run, so the workflow is rejected before any matrix job runs. Set shell on each run step or split the shell variants into separate jobs. See GitHub's jobs.<job_id>.defaults.run syntax.

Useful? React with 👍 / 👎.


results_dir = harness_dir() / "results"
results_dir.mkdir(parents=True, exist_ok=True)
result_path = (results_dir / f"{child_name}.json").resolve()

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Confine custom child names before building result paths

When spawn(..., name=...) receives an absolute name or one containing ../, joining f"{child_name}.json" discards or escapes results_dir, and resolve() merely canonicalizes that escaped path. The child is then instructed to write its result outside artifacts/harness/results, potentially overwriting an unrelated repository or filesystem file; validate names as safe basenames and verify the resolved result remains under results_dir.

Useful? React with 👍 / 👎.

Comment on lines +10464 to +10465
if (this._isPermanentProviderBillingFailure(message)) {
return false;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Add a coding-agent changelog fragment

This commit changes user-visible coding-agent behavior for terminal RLM billing errors and Windows subprocess windows, but it adds no packages/coding-agent/.changes/*.md fragment. Because releases fold these fragments into the changelog, both fixes will be omitted from release notes unless a coding-agent fragment is added.

AGENTS.md reference: AGENTS.md:L119-L123

Useful? React with 👍 / 👎.

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