Skip to content

Custom agents - #8337

Closed
AmethystLiang wants to merge 33 commits into
mainfrom
custom-agents
Closed

AmethystLiang wants to merge 33 commits into
mainfrom
custom-agents

Conversation

@AmethystLiang

@AmethystLiang AmethystLiang commented Jul 12, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 416 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​51530 $\color{#cf222e}{\Huge{\mathbf{−}}}$​6136 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​45394
Prod 661 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​105632 $\color{#cf222e}{\Huge{\mathbf{−}}}$​8792 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​96840

Summary

Describe the user-visible change.

Screenshots

  • Add screenshots or a screen recording for any new or changed UI behavior.
  • If there is no visual change, say No visual change.

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

AI Review Report

Summarize the code review you ran with your AI coding agent. Include the main risks it checked, what it flagged, and what you changed or verified as a result.
Confirm that the review explicitly checked cross-platform compatibility for macOS, Linux, and Windows, including shortcuts, labels, paths, shell behavior, and any Electron-specific platform differences touched by this PR.

Security Audit

Provide a basic security audit summary from your AI coding agent. Call out any input handling, command execution, path handling, auth, secrets, dependency, or IPC risks that were reviewed, plus any follow-up needed.

Notes

Call out any platform-specific behavior, risks, or follow-up work.

@AmethystLiang
AmethystLiang marked this pull request as draft July 12, 2026 01:18
@AmethystLiang
AmethystLiang force-pushed the custom-agents branch 4 times, most recently from 10e9be0 to 861c578 Compare July 14, 2026 02:38
@coderabbitai

coderabbitai Bot commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

Caution

Review failed

An error occurred during the review process. Please try again later.


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.

@AmethystLiang
AmethystLiang force-pushed the custom-agents branch 10 times, most recently from 38077b6 to c754481 Compare July 22, 2026 01:55
@AmethystLiang
AmethystLiang force-pushed the custom-agents branch 3 times, most recently from 9865313 to 4e01c9b Compare July 30, 2026 01:39
@AmethystLiang
AmethystLiang force-pushed the custom-agents branch 3 times, most recently from 0d19c3c to ae74f14 Compare August 5, 2026 22:25
jacobycwang added a commit to inlineapps/orca that referenced this pull request Aug 8, 2026
jacobycwang added a commit to inlineapps/orca that referenced this pull request Aug 8, 2026
@AmethystLiang
AmethystLiang force-pushed the custom-agents branch 2 times, most recently from bde48bb to 09c8a5a Compare August 9, 2026 21:48
- Fail-closed catalog/reference mutations while a pre-v1 profile backup is pending, and settle stranded orchestration dispatches with parity to worktree/background forgets.
- Harden env/argv handling against prototype pollution, reserved-name spoofing, and cmd-shell metachar injection; validate rehydrated session/operation records before use.
- Fix admission accounting (per-worktree cap on reservation commit, bounded retained launch records), reconciliation host-authority scoping to actually re-listed connections, and CLI wire-shape negotiation for pre-identity remote hosts.
- Recover terminal panes more precisely on undeliverable input (re-validate liveness before retrying/remounting) and keep the agent catalog search box usable in read-only mode.
Introduces a shared decision function that enforces the stale-reference
write rule across quick commands, commit-message, and Source Control
recipe mutations: unrelated edits preserve stale references untouched,
while any actual agent change must resolve to a currently enabled,
live built-in or custom agent identity.
- Handle pre-spawn agentLaunch failures (disabled agents, capacity exceeded) with
  typed failure codes in mobile and worktree-create paths, not generic errors
- Track worktreeId and principal through admission so per-worktree caps count
  correctly; rebuild capacity on boot from durable pending snapshots
- Add background-agent-launch store persistence for unattended failure survival
- Validate catalog mutations (malformed payloads, tombstone prunes) and reference
  writes (repo action overrides, quick commands) against live agent identities
- Fix spawn-in-flight detection to skip tokens mid-spawn during reconcile passes
- Improve locked-keychain recovery for session resume records via deferred merge
- Add accessibility tooltips for disabled catalog actions (no native title attr)
- Fix cmd metacharacter escaping for env-only variable references
- Improve orchestration dispatch forget idempotency and settlement ordering
- Custom agents appear in mobile new-worktree agent picker with catalog snapshot
- Add tombstone GC that strips suppressed same-id rows during prune
- Echo launchToken through daemon, relay, and orchestration PTY layers
- invalid_launch_snapshot keeps pending for recovery when conflicting terminal exits
- Lock form inputs during edit seed and on failed seeds to prevent overwrites
- Save source control agent recipe before launch so host resolves current args
- Add stranded gate for orchestration dispatchForget (parity with automation)
- Validate commandOverride is a string instead of throwing in draftToDefinition
- Refetch catalog on custom agent mutations in all mount points
space-y margins use :where() (zero specificity), so m-0 on nested
fieldsets collapses the gap. flex flex-col with gap-8 maintains
proper spacing between sections.
Add recovery-point inventory and atomic restore, data-recovery IPC surface,
and app-level migration-blocked notice that persists until retry succeeds or
a pre-v1 backup is restored. Offline CLI writes are schema-transparent: they
refuse pre-v1 file downgrades and never stamp v1 fields without the pinned
backup contract. Mobile surfaces the blocked state in the agent picker.
Web clients probe host identity-launch capability and degrade to legacy paths
on pre-identity hosts, failing fast for custom agents or stored defaults that
cannot resolve.
Why: CLI's offline settings writes need AGENT_CATALOG_SCHEMA_VERSION but
cannot import from out/main (electron-vite removes it during rebuild).
Extract pure schema logic to src/shared, FS-bound backup operations to
src/main. Add CLI require-resolution verification to catch MODULE_NOT_FOUND
at build time instead of runtime. Fix hydration-time purge to defer
incomplete repos: was deleting all local owners on remote-only hydration
(incident 2026-07-19).
Persist cleaned config (trimmed args, env-stripped) instead of raw handoff to
avoid subtle bugs on resume. Whitelist failure record fields to prevent forged
payloads from storing secrets. Add post-migration exit guidance UI and disable
silent-no-op recovery actions. Expand e2e surface coverage.
- Rename custom-agent-platform job to custom_agent_platform (snake_case) to
  fix env var generation and property access in workflow gates, since env vars
  cannot contain `-` and `needs.<job>.result` with kebab-case parses as
  subtraction

- Distinguish between absent and unreadable persisted state in launch stores
  to prevent data loss: a file that exists but cannot be read (locked keychain,
  EACCES/EBUSY) is not empty, so treating it as such and writing back would
  overwrite intact bytes. Write-back is skipped until recovery merge runs.

- Extract shared test render harness and host-state helpers to focused modules
  (new-workspace-composer-card-test-render, quick-commands-pane-host-state)
  to reduce file size and improve reusability

- Move orchestration and AI vault scanning logic into dedicated files to reduce
  coupling and improve discoverability

- Various bug fixes: vault resume now carries transcript paths for Pi/Prime-Agent,
  tilde expansion defers to remote shell when home is unavailable, agent launch
  identity is negotiated on remote runtimes, and background worktree creation
  no longer auto-activates.
- Distinguish unreachable relay (null) from absent agents ([]) to prevent launch gates from misreading connectivity loss as "base agent unavailable"
- Fix data recovery dismissal to persist for both null and known timestamps
- Guard against blank host names in destructive dialogs
- Add fallback messages for unknown error codes in mixed client/host versions
- Catch dismissal rejections to prevent unhandled promise rejections
- Resolve and seed native chat session options for agent launches
- Add per-device admission slots for paired mobile clients
- Implement launch token echo protocol negotiation across daemon versions
- Make critical persistence writes durable (tokens, sessions, attempts)
- Add retention bounds and eviction for historical records
- Add security probes for identity-based terminal creation
- Refactor availability mutations to separate module
Detect when persisted agent catalog schema exceeds what this build supports and mark the profile as read-only. Add previewSettingsUpdate for safe settings inspection and updateSettingsDurable for checked mutations with rollback.
Replace separate restore dialog with inline collapsible section. Show multiple custom agent examples in the picker. Update i18n to support the new disclosure pattern. Remove unused imports and make quick-open-filter.ts browser-compatible by replacing node:path with pure JS path calculation.
- v36 daemon properly echoes launch tokens from listSessions/listProcesses; v34/v35 accepted but never stored/echoed them
- Worktree creates and PTY spawns now accept host-owned `agentLaunch` request, superseding client-determined command/config
- Custom agent catalog support expanded throughout agent launch, native chat, and telemetry paths
- Settings.get opts-out of 512 KiB catalog projection for CLI preflights
- Windows shell override now beats global terminalWindowsShell at agent spawn for proper quoting (#12320)
- Database schema bumped to v30 for dispatch termination reasons
- Enable resume of sleeping agent sessions with captured configuration
- Fix platform-specific command quoting for WSL, SSH, and Windows shells
- Ensure proper account selection in vault-backed agent launches
- Coordinate session identity across host creation and reconnection
- Add infrastructure for launch token echo and identity migration
Custom agent IDs (custom-agent:base:uuid) must resolve to their base harness
for identity comparisons against built-in-keyed registries. Without this,
custom agents were silently excluded from session continuation, usage tracking,
account-switch restart logic, source-control actions, and agent availability
checks. Unified resolution through new agent-base-identity accessors and added
a ratchet test to prevent raw identity comparisons from drifting. Custom
agents now work throughout the app with proper labeling and icons.
- Resolve custom agents to their base agent (e.g., command-code) when
  determining prompt seeding behavior, while preserving the custom id.
- Add persistHostSessionBinding option for headless sessions to persist
  session bindings server-side.
- When contact with the execution host breaks during spawn, loss of contact is
  not evidence the spawn failed; the host may have spawned the agent. Retain
  the pending operation and admission reservation for reconciliation to settle on
  real host evidence instead of settling the operation failed, which would let
  plain Retry cold-start a duplicate beside a live remote agent.

- Rename availabilityCheck from 'host-preflight' to 'launch-reported': no
  executable-existence preflight runs anywhere; availability is established only
  by the launch itself on the execution host. Clients must not gate such rows on
  baseline detection.

- Fix custom agent ID resolution in terminal pane operations (paste bracketing,
  ctrl-enter input encoding): these can be owned by custom IDs, but TUI_AGENT_CONFIG
  is keyed by built-in IDs. Resolve to base agent before indexing, falling back
  to baseline behavior when the catalog is orphaned.
- Custom agents route through agentLaunch contract for dynamic args/env instead of legacy fields
- Mobile UI projects available custom agents based on detected base harnesses
- SSH Windows hosts resolve default shell for correct startup command quoting
- Capability probe errors now distinguish permanent (old relay method-not-found) from transient (connection) failures
- Background launch recovery routes to the execution host where the attempt occurred, not the repo owner
- Kimi agent removed from resumable agent list
Custom agents now work across launch, display, recovery, and mobile paths:
- Resolve to base harness for execution; preserve requested identity for display
- Headless automation dispatches agent launches after worktree creation (so
  variables can resolve), not at create time
- Vault deletion forgets all correlated session records when transcripts are
  removed
- Mobile UI displays custom agent labels and icons via base harness
- Resume and recovery paths track pending launches with sleeping records
- Orchestration federation and worker topology route custom ids through the
  host agentLaunch boundary
- Optimize display lookups with O(1) settings index instead of per-render scans
@AmethystLiang

Copy link
Copy Markdown
Contributor Author

Closing this stale draft (untouched since September and conflicting throughout). If user-defined agents are picked up again, it'll start from a fresh design scoped against current main.

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