Skip to content

feat(agents): complete prime-agent title profiles and headless commit env - #13707

Open
jitsmaster wants to merge 4 commits into
stablyai:mainfrom
jitsmaster:feat/prime-agent-support
Open

jitsmaster wants to merge 4 commits into
stablyai:mainfrom
jitsmaster:feat/prime-agent-support

Conversation

@jitsmaster

@jitsmaster jitsmaster commented Aug 11, 2026 •

Copy link
Copy Markdown

Summary

Refs #12892.

Adds support for Prime Agent (github.com/PrimeIntellect-ai/prime-agent), the recently popular self-improving coding agent built as a fork of Pi. Most of the prime-agent integration is already on main (launch/detection config, pi-compatible extension machinery, session scanning, relay plumbing); this PR completes the two remaining surfaces so Prime Agent is fully first-class in Orca:

  1. Synthetic title profiles (src/shared/synthetic-agent-title.ts)
    Prime Agent panes now render working/idle status titles ("Prime Agent ready", "Prime Agent - action required") and join the pi-compatible title identity group, matching Pi and OMP. Previously a prime-agent pane had no synthesized title and missed pi-compatible title ownership.

  2. Headless commit env (src/main/text-generation/commit-message-agent-environment.ts)
    prepareShellConfigDirEnv now handles prime-agent: it hydrates PRIME_AGENT_CODING_AGENT_DIR (from shell startup files or inherited env) and strips a stale ORCA_PRIME_AGENT_SOURCE_AGENT_DIR overlay, mirroring the Pi/OMP handling. Previously a headless commit-message or SourceControl AI run ignored prime-agent entirely.

Screenshots

No visual change. This adds a synthetic title label set for Prime Agent panes, rendered through the existing terminal title bar path shared with Pi/OMP; no layout or rendering behavior changes.

Testing

  • pnpm lint
  • pnpm typecheck
  • pnpm test
  • pnpm build
  • Added or updated high-quality tests that would catch regressions, or explained why tests were not needed

Notes on the above:

  • pnpm lint (oxlint native + type-aware audits, reliability gates, localization checks) and pnpm typecheck pass locally.
  • pnpm test: the 21 tests in the touched suites (src/shared/synthetic-agent-title.test.ts, src/main/text-generation/commit-message-agent-environment.test.ts) all pass locally; the full ~50k-test suite runs in the PR CI matrix (node 24/26, 16 shards).
  • pnpm build: the desktop + native build runs in the PR CI package job on this fork PR; no build inputs were changed by this PR (source-only edits to two .ts files and their tests).
  • Tests added: synthetic-agent-title.test.ts covers title + identity-group behavior for prime-agent; commit-message-agent-environment.test.ts covers shell-startup hydration and overlay-restore for prime-agent, mirroring the existing Pi cases.

AI Review Report

Reviewed with an AI coding agent (CodeRabbit). The review checked: title-profile lookup and pi-compatible identity-group ownership for prime-agent vs Pi/OMP; env hydration precedence (inherited env vs shell startup files vs ORCA_*_SOURCE_* overlay); and overlay-restore behavior for nested Orca launches. CodeRabbit flagged that the shell-hydration test could inherit a stale ORCA_PRIME_AGENT_SOURCE_AGENT_DIR from the test process; fixed in b2cebaa by clearing the overlay in the shared makeHome() setup. A follow-up review flagged the docstring scope wording; corrected in 4d0bc72. No remaining actionable findings.

Cross-platform confirmation: the change is platform-neutral. The touched code is shared TypeScript that only reads/writes environment variables and title-label strings; no shortcuts, labels, paths, shell scripts, or Electron-specific APIs differ by platform. Shell-startup hydration reuses the existing readShellStartupEnvVar path already exercised on macOS, Linux, and Windows.

Security Audit

Reviewed for input handling, command execution, path handling, auth, secrets, dependency, and IPC risks. This PR adds no new input surfaces, command execution, dependencies, auth flows, or IPC channels. The only runtime effect is env hydration for a headless commit-message child process: values come from the user's own shell startup files or inherited env (the same trusted sources Pi/OMP already use), and overlay stripping only removes an Orca-owned variable. No secrets are logged or transmitted; the pre-existing console.error in prepareLocalCommitMessageAgentEnv logs only a static message. No follow-up needed.

Notes

  • PRIME_AGENT_CODING_AGENT_DIR is hydrated only when resolvable; runs without a shell-startup export or inherited value fall back to the agent's default config lookup, matching Pi behavior.
  • Prime Agent title labels join the pi-compatible identity group, so title ownership and session scanning treat Prime Agent and Pi panes consistently; the group remains per-agent if a future Pi-family agent needs its own.
  • Completes the remaining prime-agent surfaces tracked by [Feature]: Add Prime Agent (PrimeIntellect-ai/prime-agent) to supported agents #12892; the launch/detection, extension machinery, session scanning, and relay work already landed on main.

… env

prime-agent support on main covers launch, detection, extensions, and
session scanning, but two surfaces were left out:

- SYNTHETIC_AGENT_TITLE_PROFILES had no prime-agent entry, so Prime Agent
  panes rendered no working/idle status titles and missed the
  pi-compatible title identity group.
- prepareShellConfigDirEnv ignored prime-agent, so headless commit-message
  and SourceControl AI runs never hydrated PRIME_AGENT_CODING_AGENT_DIR
  (and never stripped a stale ORCA_PRIME_AGENT_SOURCE_AGENT_DIR overlay).

Adds the title profile (working/idle labels + pi-compatible group),
the PRIME_AGENT_CODING_AGENT_DIR / ORCA_PRIME_AGENT_SOURCE_AGENT_DIR
env handling, and tests for both.
@coderabbitai

coderabbitai Bot commented Aug 11, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

The change adds Prime Agent environment handling for configuration directory hydration and inherited source-directory precedence. It also adds a Prime Agent synthetic title profile with working, permission, and idle labels. Tests cover shell-based directory expansion, overlay precedence, terminal titles, and hook-driven working-state updates.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely summarizes the Prime Agent title-profile and headless commit-environment changes.
Description check ✅ Passed The description thoroughly covers the changes, rationale, issue, testing, security, compatibility, and review, despite omitting several template headings and checklist confirmations.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

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.

Actionable comments posted: 1


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: a7be3bfb-cefa-451e-869f-a31e11c0df05

📥 Commits

Reviewing files that changed from the base of the PR and between 2084816 and 70eff66.

📒 Files selected for processing (4)
  • src/main/text-generation/commit-message-agent-environment.test.ts
  • src/main/text-generation/commit-message-agent-environment.ts
  • src/shared/synthetic-agent-title.test.ts
  • src/shared/synthetic-agent-title.ts

CodeRabbit: makeHome() cleared the OpenCode and Pi overlay vars but not
ORCA_PRIME_AGENT_SOURCE_AGENT_DIR, so the shell-hydration test could
resolve an inherited overlay instead of the .zshrc value.

@coderabbitai coderabbitai Bot left a comment

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.

Actionable comments posted: 1


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 99364bc9-4266-49aa-8b4d-0b2283522a64

📥 Commits

Reviewing files that changed from the base of the PR and between b2cebaa and 4d0bc72.

📒 Files selected for processing (2)
  • src/main/text-generation/commit-message-agent-environment.ts
  • src/shared/synthetic-agent-title.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/shared/synthetic-agent-title.ts

@jitsmaster

Copy link
Copy Markdown
Author

@coderabbitai full review

@coderabbitai

coderabbitai Bot commented Aug 12, 2026 •

Copy link
Copy Markdown
Contributor
✅ Action performed

Full review finished.

@jitsmaster

Copy link
Copy Markdown
Author

@coderabbitai full review

@coderabbitai

coderabbitai Bot commented Aug 12, 2026 •

Copy link
Copy Markdown
Contributor
✅ Action performed

Full review finished.

@coderabbitai coderabbitai Bot left a comment

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.

🧹 Nitpick comments (1)
src/shared/synthetic-agent-title.test.ts (1)

44-50: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Assert the pi-compatible identity group.

This test name claims to verify group membership, but it only checks labels and hook behavior. Add an assertion for getSyntheticAgentTitleProfile('prime-agent')?.titleIdentityGroup; otherwise the identity-group contract can regress without failing this test.

Proposed test assertion
 import {
   getSyntheticAgentTerminalTitle,
+  getSyntheticAgentTitleProfile,
   shouldDriveSyntheticAgentTitleFromHook
 } from './synthetic-agent-title'
 
   it('provides Prime Agent titles within the pi-compatible identity group', () => {
+    expect(getSyntheticAgentTitleProfile('prime-agent')?.titleIdentityGroup).toBe(
+      'pi-compatible'
+    )
     expect(getSyntheticAgentTerminalTitle('prime-agent', 'done')).toBe('Prime Agent ready')

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 06f49167-2f8f-4135-aeb7-19821b52f086

📥 Commits

Reviewing files that changed from the base of the PR and between 2084816 and 82a25f8.

📒 Files selected for processing (4)
  • src/main/text-generation/commit-message-agent-environment.test.ts
  • src/main/text-generation/commit-message-agent-environment.ts
  • src/shared/synthetic-agent-title.test.ts
  • src/shared/synthetic-agent-title.ts

@coderabbitai coderabbitai Bot left a comment

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.

Actionable comments posted: 1


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 6f1a3e6a-d5d3-4d89-abcd-262b18762aa8

📥 Commits

Reviewing files that changed from the base of the PR and between 2084816 and 82a25f8.

📒 Files selected for processing (4)
  • src/main/text-generation/commit-message-agent-environment.test.ts
  • src/main/text-generation/commit-message-agent-environment.ts
  • src/shared/synthetic-agent-title.test.ts
  • src/shared/synthetic-agent-title.ts

Comment on lines +43 to +50

it('provides Prime Agent titles within the pi-compatible identity group', () => {
expect(getSyntheticAgentTerminalTitle('prime-agent', 'done')).toBe('Prime Agent ready')
expect(getSyntheticAgentTerminalTitle('prime-agent', 'waiting')).toBe(
'Prime Agent - action required'
)
expect(shouldDriveSyntheticAgentTitleFromHook('prime-agent', 'working')).toBe(true)
})

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.

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Assert the identity group directly.

The test name claims that Prime Agent belongs to pi-compatible, but the assertions cover only titles and hook behavior. If titleIdentityGroup changes or is removed, this test still passes. Assert getSyntheticAgentTitleProfile('prime-agent')?.titleIdentityGroup equals 'pi-compatible'.

This branch has not been deployed

No deployments
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.

4 participants