Skip to content

Let a hosted launch name a Claude or Codex account - #1870

Open
alexeyzimarev wants to merge 47 commits into
mainfrom
capacitor/agent-c32568ac39a64e
Open

alexeyzimarev wants to merge 47 commits into
mainfrom
capacitor/agent-c32568ac39a64e

Conversation

@alexeyzimarev

Copy link
Copy Markdown
Member

Part of #1806 — AI-4194

What & why

A hosted Claude or Codex agent can now run under one of the accounts registered on its host (a vendor config directory), chosen at launch and carried into the resume ledger; kcap agent start --account and the app launcher share the path. The daemon publishes the host's registry, its own default directories and a per-account Codex model catalog to the server and over the local socket, so the app can list accounts and see which are wired. This is the daemon and CLI half of #1806; the server, app and limits readings follow in their own PRs.

Where to look

An explicit account id is honoured or refused, never replaced by the default, on launch and resume alike. A daemon whose CLAUDE_CONFIG_DIR is spelled ~/.claude treats it as the built-in directory and drops the variable for its default account, so hosted children keep reading ~/.claude.json. The accounts frames are 32 and 87; 86 is the agent-session reply.

Verification

dotnet test --solution Capacitor.slnx on the merged tree: 22,571 tests, 22,452 passed, 117 skipped, 2 failed. The WorkOS emulator image cannot be pulled from this machine, and the Cursor refresh test fails on any Mac with /opt/homebrew/bin/kcap present, independent of this branch. Both AOT publishes report no IL2026/IL3050 warnings. Still owed: the live check (install, restart the daemon, kcap accounts --json, kcap agent start claude --account <id> -d), which restarts the daemon hosting the session that produced this branch.

🤖 Generated with Claude Code

alexeyzimarev and others added 30 commits October 21, 2026 18:40
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
… host

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
An explicit account id is honoured or refused, never replaced by the default.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
…1806)

An id with no stored directory resolves against the registry like a fresh launch.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
The spawn frame's account follows the title byte, so a frame without a title now has that byte consumed before it is read.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
)

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
…1806)

A snapshot cached before the wiring could satisfy "at or past the revision",
so add and rewire now commit one after wiring and every verb reports it.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
…ed (#1806)

A partial unwire changes the account on disk, so a snapshot cached before it
must not read as current.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
accounts.json is polled by length and mtime and re-read once more on the tick
after a change: two same-length writes inside one timestamp tick stat alike.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
#1806)

A throwing Changed handler faulted the poll loop, and the host stops on that.
A failed read now leaves the stat untrusted, so a transient sharing violation
during the CLI's atomic replace is retried on the next tick.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A refusal ends the launch as launch_failed_cleaned rather than a rejection, so
its account_unavailable reason is never collapsed into a generic one. A vendor
with no default directory carries no account and is never refused.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
The Codex resolved-model report reads the account's config.toml as well, so a
default-model launch reports the model that account runs.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…1806)

The built-in directory is reached by removing the variable, not naming it:
CLAUDE_CONFIG_DIR=~/.claude moves .claude.json inside the directory.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A refused account interrupts the entry by name and skips kcap continue: the
continuation resolves the same recorded account and would be refused too.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Without a vendor session the lane never runs the native launch that checks the
account, so the check runs before the continuation instead.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A reconnect re-registers every agent and a launch still in its handshake
is reported before its agent exists, so both carry the account too.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
The accounts snapshot is built before the host starts so the startup probe and the
watcher's first watch set read the same accounts; start now announces a snapshot that
replaces it, so a registry change in that window still reaches both.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The watcher starts watching an added account on its next tick, up to 15 s after the
probe; priming from the files as they are then would absorb a write in between and
leave a stale catalog advertised.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The daemon's pre-start rebuild can fail, and the snapshot start then builds is the
first one any subscriber sees; an unchanged revision is still never announced.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
)

A change goes out one-way at most every 30 seconds, the last of a burst winning; a
dropped or failed send is not retried, since every DaemonConnect carries the current
snapshot.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A change landing between the DaemonConnect payload and readiness has its own send
dropped by the IsReady guard, so registration sends the current snapshot when its
host id or revision differs from the one it connected with.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
alexeyzimarev and others added 9 commits October 22, 2026 17:48
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
#1806)

kcap plugin install --codex wires the CLI shell's Codex directory, which need
not be the daemon's or the chosen account's.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The daemon is the last hop, so an id it cannot honour must not launch as if
none were sent. A resume still ignores the id, as it does for every vendor.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…1806)

On the local-spawn path a throw here escapes the handler, so the client
sees EOF instead of an error frame.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…1806)

The host stops the daemon when a background service throws. A failed read
must also leave the stat untrusted, or later ticks skip until the next write.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…1806)

kcap agent ls shows no account, and kcap daemon status --json reports the
service rather than agents.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Frame 86 went to AgentSessionReply on main, so AccountsSubscribe moves to 32, and the PTY factory takes the account home where the removed prompt root was.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Oct 23, 2026 •

Copy link
Copy Markdown

Important

Review skipped

Too many files!

This PR contains 129 files, which is 29 over the limit of 100.

To get a review, reduce the PR to 100 files or fewer by splitting it into smaller PRs or changing its base branch.

Upgrade to a paid plan to raise the limit.

This review couldn't start because sufficient usage credits or metered capacity aren't available. Add credits or update usage-based reviews in the billing tab, then retry.

Check out review usage here.

⚙️ Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: ASSERTIVE
  • Plan: Advanced
  • Run ID: b99f8a72-6753-4361-8f4d-50f18bd09e8d
📥 Commits

Reviewing files that changed from the base of the PR and between da586ec and 13bb89e.

📒 Files selected for processing: 129
  • README.md
  • docs/superpowers/plans/2026-10-22-vendor-accounts-launch-choice-daemon.md
  • docs/superpowers/specs/2026-10-21-vendor-accounts-launch-choice-design.md
  • src/Capacitor.Cli.Core/Accounts/AccountActionResultDto.cs
  • src/Capacitor.Cli.Core/Accounts/AccountActionResultJsonContext.cs
  • src/Capacitor.Cli.Core/Accounts/AccountDirectory.cs
  • src/Capacitor.Cli.Core/Accounts/AccountResolution.cs
  • src/Capacitor.Cli.Core/Accounts/AccountResolutionOutcome.cs
  • src/Capacitor.Cli.Core/Accounts/AccountSnapshotBuilder.cs
  • src/Capacitor.Cli.Core/Accounts/AccountStore.cs
  • src/Capacitor.Cli.Core/Accounts/AccountViewDto.cs
  • src/Capacitor.Cli.Core/Accounts/AccountWiring.cs
  • src/Capacitor.Cli.Core/Accounts/AccountsSnapshotDto.cs
  • src/Capacitor.Cli.Core/Accounts/AccountsSnapshotJsonContext.cs
  • src/Capacitor.Cli.Core/Accounts/DefaultDirectoryDto.cs
  • src/Capacitor.Cli.Core/Accounts/DirectoryKey.cs
  • src/Capacitor.Cli.Core/Accounts/RecordingStates.cs
  • src/Capacitor.Cli.Core/Accounts/ResolvedAccount.cs
  • src/Capacitor.Cli.Core/Accounts/VendorAccount.cs
  • src/Capacitor.Cli.Core/Accounts/VendorHomeVariable.cs
  • src/Capacitor.Cli.Core/Accounts/WiringStepDto.cs
  • src/Capacitor.Cli.Core/AgentStartArgs.cs
  • src/Capacitor.Cli.Core/LocalIpc/FrameCodec.cs
  • src/Capacitor.Cli.Core/LocalIpc/FrameType.cs
  • src/Capacitor.Cli.Core/LocalIpc/LocalFrame.cs
  • src/Capacitor.Cli.Core/LocalIpc/StatusIpc.cs
  • src/Capacitor.Cli.Core/Models.cs
  • src/Capacitor.Cli.Core/Resources/help-accounts.txt
  • src/Capacitor.Cli.Core/Resources/help-agent.txt
  • src/Capacitor.Cli.Core/Resume/ResumeLaunchDescriptor.cs
  • src/Capacitor.Cli.Core/ShellArgument.cs
  • src/Capacitor.Cli.Daemon/DaemonConfig.cs
  • src/Capacitor.Cli.Daemon/DaemonRunner.cs
  • src/Capacitor.Cli.Daemon/Harness/Claude/ClaudeCommandProbe.cs
  • src/Capacitor.Cli.Daemon/Harness/Claude/ClaudeLauncher.cs
  • src/Capacitor.Cli.Daemon/Harness/Codex/CodexConfigWriter.cs
  • src/Capacitor.Cli.Daemon/Harness/Codex/CodexHooksNotInstalledException.cs
  • src/Capacitor.Cli.Daemon/Harness/Codex/CodexHostedAgentRuntimeFactory.cs
  • src/Capacitor.Cli.Daemon/Harness/Codex/CodexLauncher.cs
  • src/Capacitor.Cli.Daemon/Harness/Codex/CodexModelCatalogProbe.cs
  • src/Capacitor.Cli.Daemon/Pty/IPtyProcessFactory.cs
  • src/Capacitor.Cli.Daemon/Pty/Unix/UnixPtyProcess.cs
  • src/Capacitor.Cli.Daemon/Pty/Windows/ConPtyProcess.cs
  • src/Capacitor.Cli.Daemon/Services/AccountsIpc.cs
  • src/Capacitor.Cli.Daemon/Services/AccountsPublisher.cs
  • src/Capacitor.Cli.Daemon/Services/AgentOrchestrator.LocalIpc.cs
  • src/Capacitor.Cli.Daemon/Services/AgentOrchestrator.Resume.cs
  • src/Capacitor.Cli.Daemon/Services/AgentOrchestrator.cs
  • src/Capacitor.Cli.Daemon/Services/DaemonStatusIpc.cs
  • src/Capacitor.Cli.Daemon/Services/IHostedAgentLauncher.cs
  • src/Capacitor.Cli.Daemon/Services/IHostedAgentRuntimeFactory.cs
  • src/Capacitor.Cli.Daemon/Services/LocalControlCapabilities.cs
  • src/Capacitor.Cli.Daemon/Services/LocalControlServer.cs
  • src/Capacitor.Cli.Daemon/Services/PtyHostedAgentRuntimeFactory.cs
  • src/Capacitor.Cli.Daemon/Services/ServerConnection.cs
  • src/Capacitor.Cli.Daemon/Services/VendorCliWatcher.cs
  • src/Capacitor.Cli.Daemon/Services/VendorHomeEnv.cs
  • src/Capacitor.Cli.Daemon/Services/VendorModelCatalogs.cs
  • src/Capacitor.Cli/Commands/AccountSetupStep.cs
  • src/Capacitor.Cli/Commands/AccountsCommand.cs
  • src/Capacitor.Cli/Commands/AgentCommand.cs
  • src/Capacitor.Cli/Services/HelloProbe.cs
  • test/Capacitor.Cli.Core.Tests.Unit/Accounts/AccountActionResultDtoTests.cs
  • test/Capacitor.Cli.Core.Tests.Unit/Accounts/AccountResolutionTests.cs
  • test/Capacitor.Cli.Core.Tests.Unit/Accounts/AccountSnapshotBuilderTests.cs
  • test/Capacitor.Cli.Core.Tests.Unit/Accounts/AccountStoreTests.cs
  • test/Capacitor.Cli.Core.Tests.Unit/Accounts/AccountsSnapshotDtoTests.cs
  • test/Capacitor.Cli.Core.Tests.Unit/Accounts/DirectoryKeyTests.cs
  • test/Capacitor.Cli.Core.Tests.Unit/Accounts/RecordingStatesTests.cs
  • test/Capacitor.Cli.Core.Tests.Unit/Accounts/VendorHomeVariableTests.cs
  • test/Capacitor.Cli.Core.Tests.Unit/AgentStartArgsTests.cs
  • test/Capacitor.Cli.Core.Tests.Unit/LaunchAgentCommandWireFormatTests.cs
  • test/Capacitor.Cli.Core.Tests.Unit/LocalIpc/DaemonStatusDtoTests.cs
  • test/Capacitor.Cli.Core.Tests.Unit/LocalIpc/FrameCodecAccountsTests.cs
  • test/Capacitor.Cli.Core.Tests.Unit/LocalIpc/FrameCodecTests.cs
  • test/Capacitor.Cli.Core.Tests.Unit/LocalIpc/StatusIpcJsonTests.cs
  • test/Capacitor.Cli.Core.Tests.Unit/Resume/ResumeLedgerStoreTests.cs
  • test/Capacitor.Cli.Core.Tests.Unit/ShellArgumentTests.cs
  • test/Capacitor.Cli.Daemon.Tests.Unit/DaemonRunnerCapabilityRefreshTests.cs
  • test/Capacitor.Cli.Daemon.Tests.Unit/Harness/Claude/ClaudeCommandProbeTests.cs
  • test/Capacitor.Cli.Daemon.Tests.Unit/Harness/Claude/ClaudeLauncherAccountTests.cs
  • test/Capacitor.Cli.Daemon.Tests.Unit/Harness/Codex/CodexHostedAgentRuntimeFactoryTests.cs
  • test/Capacitor.Cli.Daemon.Tests.Unit/Harness/Codex/CodexLauncherAccountTests.cs
  • test/Capacitor.Cli.Daemon.Tests.Unit/Harness/Codex/CodexLauncherTests.cs
  • test/Capacitor.Cli.Daemon.Tests.Unit/Pty/FixedPtyProcessFactory.cs
  • test/Capacitor.Cli.Daemon.Tests.Unit/Pty/PtyEnvScrubTests.cs
  • test/Capacitor.Cli.Daemon.Tests.Unit/Pty/SpyPtyProcessFactory.cs
  • test/Capacitor.Cli.Daemon.Tests.Unit/Pty/Unix/UnixPtyProcessEnvTests.cs
  • test/Capacitor.Cli.Daemon.Tests.Unit/Services/AccountsIpcTests.cs
  • test/Capacitor.Cli.Daemon.Tests.Unit/Services/AccountsPublisherServerTests.cs
  • test/Capacitor.Cli.Daemon.Tests.Unit/Services/AccountsPublisherTests.cs
  • test/Capacitor.Cli.Daemon.Tests.Unit/Services/AdmissionFenceIpcTests.cs
  • test/Capacitor.Cli.Daemon.Tests.Unit/Services/AgentOrchestratorAccountTests.cs
  • test/Capacitor.Cli.Daemon.Tests.Unit/Services/AgentOrchestratorHarness.cs
  • test/Capacitor.Cli.Daemon.Tests.Unit/Services/AgentOrchestratorLocalAttachTests.cs
  • test/Capacitor.Cli.Daemon.Tests.Unit/Services/AgentOrchestratorResumeAccountTests.cs
  • test/Capacitor.Cli.Daemon.Tests.Unit/Services/AgentResolvedTitleTests.cs
  • test/Capacitor.Cli.Daemon.Tests.Unit/Services/AgentStatusSnapshotTests.cs
  • test/Capacitor.Cli.Daemon.Tests.Unit/Services/CaptureServerConnection.cs
  • test/Capacitor.Cli.Daemon.Tests.Unit/Services/ConsentRulesPutV2Tests.cs
  • test/Capacitor.Cli.Daemon.Tests.Unit/Services/DaemonSettingsIpcTests.cs
  • test/Capacitor.Cli.Daemon.Tests.Unit/Services/DaemonStatusIpcTests.cs
  • test/Capacitor.Cli.Daemon.Tests.Unit/Services/DaemonStatusWiringTests.cs
  • test/Capacitor.Cli.Daemon.Tests.Unit/Services/LaunchConsentIpcTests.cs
  • test/Capacitor.Cli.Daemon.Tests.Unit/Services/LiveAgentsSnapshotTests.cs
  • test/Capacitor.Cli.Daemon.Tests.Unit/Services/LocalControlAgentResumeTests.cs
  • test/Capacitor.Cli.Daemon.Tests.Unit/Services/LocalControlCapabilitiesTests.cs
  • test/Capacitor.Cli.Daemon.Tests.Unit/Services/LocalControlHelloTests.cs
  • test/Capacitor.Cli.Daemon.Tests.Unit/Services/LocalControlOpsV2PutTests.cs
  • test/Capacitor.Cli.Daemon.Tests.Unit/Services/LocalControlProbeTests.cs
  • test/Capacitor.Cli.Daemon.Tests.Unit/Services/LocalControlShutdownTests.cs
  • test/Capacitor.Cli.Daemon.Tests.Unit/Services/PermissionWiringTests.cs
  • test/Capacitor.Cli.Daemon.Tests.Unit/Services/PtyHostedAgentRuntimeFactoryEnvTests.cs
  • test/Capacitor.Cli.Daemon.Tests.Unit/Services/PtyHostedAgentRuntimeFactoryTests.cs
  • test/Capacitor.Cli.Daemon.Tests.Unit/Services/SeededLaunchEnvironmentTests.cs
  • test/Capacitor.Cli.Daemon.Tests.Unit/Services/SeqCaptureServerConnection.cs
  • test/Capacitor.Cli.Daemon.Tests.Unit/Services/ServerConnectionAdvertisementTests.cs
  • test/Capacitor.Cli.Daemon.Tests.Unit/Services/ServerConnectionAgentRegisteredTests.cs
  • test/Capacitor.Cli.Daemon.Tests.Unit/Services/SpyHostedAgentLauncher.cs
  • test/Capacitor.Cli.Daemon.Tests.Unit/Services/StubCatalogFactory.cs
  • test/Capacitor.Cli.Daemon.Tests.Unit/Services/TestAccountsIpc.cs
  • test/Capacitor.Cli.Daemon.Tests.Unit/Services/VendorCliWatcherTests.cs
  • test/Capacitor.Cli.Daemon.Tests.Unit/Services/VendorModelCatalogsAccountTests.cs
  • test/Capacitor.Cli.Tests.Unit/Commands/AccountsCommandTests.cs
  • test/Capacitor.Cli.Tests.Unit/Commands/AgentCommandAccountTests.cs
  • test/Capacitor.Cli.Tests.Unit/Commands/AgentCommandRoutingTests.cs
  • test/Capacitor.Cli.Tests.Unit/Commands/ControlSocketTripwire.cs
  • test/Capacitor.Cli.Tests.Unit/Services/HelloProbeTests.cs
  • test/fixtures/daemon-connect.v2.json

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 23, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-23T08:51:57.075151Z 6b3afe3 PR opened
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@qodo-code-review

Copy link
Copy Markdown

PR Summary by Qodo

Support account-selected Claude and Codex launches in the daemon and CLI

✨ Enhancement 🧪 Tests 📝 Documentation 🕐 40+ Minutes

Grey Divider

AI Description

• Resolve selected Claude and Codex accounts before launch, and retain them across status reports
 and resumes.
• Publish host account snapshots and per-account Codex models to local clients and the server.
• Add CLI account selection, machine-readable account actions, and coverage for launch and
 compatibility paths.
Diagram

graph TD
  A["CLI or app"] --> B["Launch request"] --> C["Agent orchestrator"] --> D["Account registry"]
  D --> E["Vendor runtime"] --> F["Resume ledger"]
  D --> G["Accounts publisher"] --> H["Socket and server"]
  C --> E
Loading
High-Level Assessment

Resolve on the host immediately before launch and carry the resulting directory through runtime and resume paths. Relying solely on a client-side selection or the daemon’s inherited environment would allow an unavailable explicit account to silently become the default; keeping registry publication separate from launch resolution also preserves the CLI’s ownership of registry mutations.

Files changed (126) +5626 / -418

Enhancement (55) +1424 / -317
AccountActionResultDto.csDefine account mutation results +7/-0

Define account mutation results

• Adds a structured action verdict with wiring steps, committed revision, and error.

src/Capacitor.Cli.Core/Accounts/AccountActionResultDto.cs

AccountActionResultJsonContext.csGenerate action-result JSON metadata +8/-0

Generate action-result JSON metadata

• Provides source-generated serialization for machine-readable account actions.

src/Capacitor.Cli.Core/Accounts/AccountActionResultJsonContext.cs

AccountDirectory.csCentralize home expansion for account paths +7/-0

Centralize home expansion for account paths

• Adds shared expansion of a leading tilde for directory arguments.

src/Capacitor.Cli.Core/Accounts/AccountDirectory.cs

AccountResolution.csResolve requested and resumed accounts +92/-0

Resolve requested and resumed accounts

• Resolves IDs, CLI prefixes, and directories while refusing unknown, ambiguous, or missing explicit accounts.

src/Capacitor.Cli.Core/Accounts/AccountResolution.cs

AccountResolutionOutcome.csRepresent account resolution or refusal +6/-0

Represent account resolution or refusal

• Defines the result shared by launch and resume account checks.

src/Capacitor.Cli.Core/Accounts/AccountResolutionOutcome.cs

AccountSnapshotBuilder.csBuild host account snapshots +38/-0

Build host account snapshots

• Combines registered accounts, recording states, host ID, revision, and daemon-specific default directories.

src/Capacitor.Cli.Core/Accounts/AccountSnapshotBuilder.cs

AccountStore.csExpose registry path and committed revisions +11/-4

Expose registry path and committed revisions

• Makes the registry path available to the publisher and returns mutation revisions to CLI actions.

src/Capacitor.Cli.Core/Accounts/AccountStore.cs

AccountViewDto.csDefine published account rows +6/-0

Define published account rows

• Carries an account’s vendor, directory key, label, and recording state.

src/Capacitor.Cli.Core/Accounts/AccountViewDto.cs

AccountWiring.csInspect wiring by vendor and directory +6/-4

Inspect wiring by vendor and directory

• Lets snapshot construction inspect recording state without requiring a registry entry object.

src/Capacitor.Cli.Core/Accounts/AccountWiring.cs

AccountsSnapshotDto.csDefine versioned host account snapshots +5/-0

Define versioned host account snapshots

• Groups the host ID, registry revision, registered accounts, and daemon defaults.

src/Capacitor.Cli.Core/Accounts/AccountsSnapshotDto.cs

AccountsSnapshotJsonContext.csGenerate snapshot JSON metadata +8/-0

Generate snapshot JSON metadata

• Enables source-generated serialization of account snapshots for local IPC.

src/Capacitor.Cli.Core/Accounts/AccountsSnapshotJsonContext.cs

DefaultDirectoryDto.csDescribe daemon default directories +3/-0

Describe daemon default directories

• Publishes vendor defaults separately from registered account rows.

src/Capacitor.Cli.Core/Accounts/DefaultDirectoryDto.cs

DirectoryKey.csCompute host-normalized directory keys +10/-0

Compute host-normalized directory keys

• Normalizes physical directory identity and applies platform-appropriate case handling for matching defaults.

src/Capacitor.Cli.Core/Accounts/DirectoryKey.cs

RecordingStates.csDefine recording-state wire tokens +12/-0

Define recording-state wire tokens

• Maps wiring states to stable names used in account snapshots.

src/Capacitor.Cli.Core/Accounts/RecordingStates.cs

ResolvedAccount.csCarry the selected launch directory +5/-0

Carry the selected launch directory

• Represents the directory, optional registered ID, and display label retained by an agent.

src/Capacitor.Cli.Core/Accounts/ResolvedAccount.cs

VendorAccount.csRecord account wiring outcomes +10/-6

Record account wiring outcomes

• Adds optional successful-wiring time and latest wiring-failure fields to registry entries.

src/Capacitor.Cli.Core/Accounts/VendorAccount.cs

VendorHomeVariable.csPlan vendor config-home environment changes +21/-0

Plan vendor config-home environment changes

• Selects CLAUDE_CONFIG_DIR or CODEX_HOME and removes the override for built-in directories.

src/Capacitor.Cli.Core/Accounts/VendorHomeVariable.cs

WiringStepDto.csDescribe individual account wiring steps +3/-0

Describe individual account wiring steps

• Defines the JSON step name, success flag, and detail for mutation results.

src/Capacitor.Cli.Core/Accounts/WiringStepDto.cs

AgentStartArgs.csParse --account for local agent starts +32/-3

Parse --account for local agent starts

• Accepts separate or equals-form values and reports missing account arguments.

src/Capacitor.Cli.Core/AgentStartArgs.cs

FrameCodec.csExtend local frames with account data +33/-12

Extend local frames with account data

• Appends the optional account ID to Spawn and encodes account-subscription and snapshot frames.

src/Capacitor.Cli.Core/LocalIpc/FrameCodec.cs

FrameType.csReserve account IPC frame numbers +2/-0

Reserve account IPC frame numbers

• Adds account subscription frame 32 and snapshot frame 87.

src/Capacitor.Cli.Core/LocalIpc/FrameType.cs

LocalFrame.csConstruct account subscription frames +1/-0

Construct account subscription frames

• Adds a convenience constructor for the long-lived account subscription.

src/Capacitor.Cli.Core/LocalIpc/LocalFrame.cs

StatusIpc.csExpose account metadata in local status +8/-2

Expose account metadata in local status

• Adds per-account models to daemon information and resolved account fields to agent rows.

src/Capacitor.Cli.Core/LocalIpc/StatusIpc.cs

Models.csAppend account fields to shared contracts +19/-4

Append account fields to shared contracts

• Extends launch, connect, live-agent, and registration contracts with optional account information and capability advertisement.

src/Capacitor.Cli.Core/Models.cs

ResumeLaunchDescriptor.csPersist resolved account with a launch +4/-1

Persist resolved account with a launch

• Adds account directory, ID, and label to durable resume descriptors.

src/Capacitor.Cli.Core/Resume/ResumeLaunchDescriptor.cs

DaemonConfig.csHold account registry, defaults, and catalogs +17/-2

Hold account registry, defaults, and catalogs

• Adds host registry access, vendor default directories, and per-account model catalogs to daemon configuration.

src/Capacitor.Cli.Daemon/DaemonConfig.cs

DaemonRunner.csWire account services into daemon startup +45/-8

Wire account services into daemon startup

• Initializes default directories, builds the first snapshot, probes account catalogs, and connects publisher to server.

src/Capacitor.Cli.Daemon/DaemonRunner.cs

ClaudeCommandProbe.csProbe Claude commands under the agent account +33/-20

Probe Claude commands under the agent account

• Runs the command probe with the selected Claude home, removing the override for its built-in directory.

src/Capacitor.Cli.Daemon/Harness/Claude/ClaudeCommandProbe.cs

ClaudeLauncher.csUse per-launch Claude paths +25/-42

Use per-launch Claude paths

• Targets account-specific settings, trust, MCP, project links, and cleanup instead of a fixed daemon layout.

src/Capacitor.Cli.Daemon/Harness/Claude/ClaudeLauncher.cs

CodexConfigWriter.csAlign Codex config writing with selected paths +1/-1

Align Codex config writing with selected paths

• Adjusts configuration-writing support used by account-aware Codex launches.

src/Capacitor.Cli.Daemon/Harness/Codex/CodexConfigWriter.cs

CodexHooksNotInstalledException.csAlign Codex hook refusal messaging +3/-7

Align Codex hook refusal messaging

• Adjusts the exception used when the selected Codex directory lacks launchable hooks.

src/Capacitor.Cli.Daemon/Harness/Codex/CodexHooksNotInstalledException.cs

CodexHostedAgentRuntimeFactory.csMake Codex app-server launches account-aware +37/-14

Make Codex app-server launches account-aware

• Applies account-specific environment changes, probes catalogs per directory, and fingerprints each account’s catalog files.

src/Capacitor.Cli.Daemon/Harness/Codex/CodexHostedAgentRuntimeFactory.cs

CodexLauncher.csUse selected Codex configuration for preflight +27/-22

Use selected Codex configuration for preflight

• Checks account or project hooks and writes trust to the selected directory, with an account-specific remedy.

src/Capacitor.Cli.Daemon/Harness/Codex/CodexLauncher.cs

CodexModelCatalogProbe.csIsolate per-account Codex catalog probes +8/-0

Isolate per-account Codex catalog probes

• Adds directory selection for catalog probing under distinct account homes.

src/Capacitor.Cli.Daemon/Harness/Codex/CodexModelCatalogProbe.cs

IPtyProcessFactory.csAllow removal of inherited child variables +4/-1

Allow removal of inherited child variables

• Extends PTY spawning with an explicit environment-variable removal set.

src/Capacitor.Cli.Daemon/Pty/IPtyProcessFactory.cs

UnixPtyProcess.csRemove specified inherited variables on Unix +11/-5

Remove specified inherited variables on Unix

• Applies requested removals before environment overlays reach spawned PTY children.

src/Capacitor.Cli.Daemon/Pty/Unix/UnixPtyProcess.cs

ConPtyProcess.csRemove specified inherited variables on Windows +13/-5

Remove specified inherited variables on Windows

• Applies requested removals while assembling the ConPTY environment block.

src/Capacitor.Cli.Daemon/Pty/Windows/ConPtyProcess.cs

AccountsIpc.csStream account snapshots over local IPC +46/-0

Stream account snapshots over local IPC

• Sends the current snapshot and subsequent revisions to subscribers until disconnection.

src/Capacitor.Cli.Daemon/Services/AccountsIpc.cs

AccountsPublisher.csPublish revisioned host account snapshots +226/-0

Publish revisioned host account snapshots

• Polls the registry, retains the last good snapshot on read failure, notifies subscribers, and throttles server sends.

src/Capacitor.Cli.Daemon/Services/AccountsPublisher.cs

AgentOrchestrator.LocalIpc.csResolve accounts on local spawn +21/-6

Resolve accounts on local spawn

• Refuses unavailable local selections before spawn and includes resolved account data in local agent status.

src/Capacitor.Cli.Daemon/Services/AgentOrchestrator.LocalIpc.cs

AgentOrchestrator.Resume.csRetain and validate accounts on resume +31/-9

Retain and validate accounts on resume

• Writes account information to the ledger and refuses a resume whose recorded account can no longer be used.

src/Capacitor.Cli.Daemon/Services/AgentOrchestrator.Resume.cs

AgentOrchestrator.csCarry resolved accounts through hosted agents +122/-46

Carry resolved accounts through hosted agents

• Resolves accounts before server launches, passes them to runtimes, and reports them in status, registration, probes, and session discovery.

src/Capacitor.Cli.Daemon/Services/AgentOrchestrator.cs

DaemonStatusIpc.csReport account-specific daemon models +2/-1

Report account-specific daemon models

• Adds account catalogs to local daemon status information.

src/Capacitor.Cli.Daemon/Services/DaemonStatusIpc.cs

IHostedAgentLauncher.csPass resolved accounts into launch preparation +3/-1

Pass resolved accounts into launch preparation

• Extends launcher context so vendor preflight and setup can select per-agent paths.

src/Capacitor.Cli.Daemon/Services/IHostedAgentLauncher.cs

IHostedAgentRuntimeFactory.csExtend runtime context and catalog probes +14/-1

Extend runtime context and catalog probes

• Adds resolved account context and optional account-directory model and fingerprint methods.

src/Capacitor.Cli.Daemon/Services/IHostedAgentRuntimeFactory.cs

LocalControlCapabilities.csAdvertise accounts/1 on the local socket +1/-1

Advertise accounts/1 on the local socket

• Lets CLI clients gate account-bearing Spawn frames on daemon support.

src/Capacitor.Cli.Daemon/Services/LocalControlCapabilities.cs

LocalControlServer.csRoute account subscriptions +3/-2

Route account subscriptions

• Dispatches AccountsSubscribe frames to the snapshot streaming handler.

src/Capacitor.Cli.Daemon/Services/LocalControlServer.cs

PtyHostedAgentRuntimeFactory.csApply account homes to PTY agents +12/-3

Apply account homes to PTY agents

• Carries account context to launchers and applies or removes vendor-home overrides before PTY spawn.

src/Capacitor.Cli.Daemon/Services/PtyHostedAgentRuntimeFactory.cs

ServerConnection.csAdvertise and send account data to the server +51/-15

Advertise and send account data to the server

• Includes account snapshots and catalogs on connect, sends later changes, and registers agents with their account identity.

src/Capacitor.Cli.Daemon/Services/ServerConnection.cs

VendorCliWatcher.csWatch per-account Codex catalog files +57/-16

Watch per-account Codex catalog files

• Adds dynamic account fingerprint entries and requests capability refreshes after account changes.

src/Capacitor.Cli.Daemon/Services/VendorCliWatcher.cs

VendorHomeEnv.csApply account-specific child environments +33/-0

Apply account-specific child environments

• Sets vendor home overrides for selected directories or requests removal for built-in defaults.

src/Capacitor.Cli.Daemon/Services/VendorHomeEnv.cs

VendorModelCatalogs.csMerge and fingerprint per-account models +70/-2

Merge and fingerprint per-account models

• Probes registered Codex accounts and removes catalogs for accounts no longer in the current snapshot.

src/Capacitor.Cli.Daemon/Services/VendorModelCatalogs.cs

AccountsCommand.csEmit revisioned JSON account action results +94/-48

Emit revisioned JSON account action results

• Reports add, remove, rename, and rewire outcomes as JSON and commits wiring outcomes to registry revisions.

src/Capacitor.Cli/Commands/AccountsCommand.cs

AgentCommand.csValidate --account before local spawn +50/-2

Validate --account before local spawn

• Resolves registered Claude or Codex accounts, checks daemon capability, and sends the full ID in Spawn.

src/Capacitor.Cli/Commands/AgentCommand.cs

HelloProbe.csExpose daemon capabilities to CLI callers +7/-1

Expose daemon capabilities to CLI callers

• Makes Hello probe results available for the account-launch compatibility check.

src/Capacitor.Cli/Services/HelloProbe.cs

Tests (66) +3245 / -95
AccountActionResultDtoTests.csTest account action JSON shape +16/-0

Test account action JSON shape

• Checks structured mutation-result serialization.

test/Capacitor.Cli.Core.Tests.Unit/Accounts/AccountActionResultDtoTests.cs

AccountResolutionTests.csTest account selection and refusal rules +257/-0

Test account selection and refusal rules

• Covers defaults, explicit IDs, directory arguments, ambiguity, missing entries, and resume resolution.

test/Capacitor.Cli.Core.Tests.Unit/Accounts/AccountResolutionTests.cs

AccountSnapshotBuilderTests.csTest account snapshot construction +99/-0

Test account snapshot construction

• Checks defaults, normalized keys, account rows, and recording-state publication.

test/Capacitor.Cli.Core.Tests.Unit/Accounts/AccountSnapshotBuilderTests.cs

AccountStoreTests.csTest mutation revision results +14/-0

Test mutation revision results

• Verifies reported revisions for changed and unchanged registry mutations.

test/Capacitor.Cli.Core.Tests.Unit/Accounts/AccountStoreTests.cs

AccountsSnapshotDtoTests.csTest snapshot serialization +39/-0

Test snapshot serialization

• Checks the published account snapshot contract.

test/Capacitor.Cli.Core.Tests.Unit/Accounts/AccountsSnapshotDtoTests.cs

DirectoryKeyTests.csTest host directory keys +42/-0

Test host directory keys

• Covers equivalent path spellings and platform-sensitive key behavior.

test/Capacitor.Cli.Core.Tests.Unit/Accounts/DirectoryKeyTests.cs

RecordingStatesTests.csTest recording-state names +13/-0

Test recording-state names

• Checks stable snapshot tokens for wiring states.

test/Capacitor.Cli.Core.Tests.Unit/Accounts/RecordingStatesTests.cs

VendorHomeVariableTests.csTest vendor home-variable decisions +35/-0

Test vendor home-variable decisions

• Checks override names and removal for built-in directories.

test/Capacitor.Cli.Core.Tests.Unit/Accounts/VendorHomeVariableTests.cs

AgentStartArgsTests.csTest --account argument parsing +32/-0

Test --account argument parsing

• Covers both flag forms and invalid or absent values.

test/Capacitor.Cli.Core.Tests.Unit/AgentStartArgsTests.cs

LaunchAgentCommandWireFormatTests.csTest account launch wire compatibility +15/-0

Test account launch wire compatibility

• Checks optional account ID handling in the shared launch command.

test/Capacitor.Cli.Core.Tests.Unit/LaunchAgentCommandWireFormatTests.cs

DaemonStatusDtoTests.csTest account fields in local status +72/-1

Test account fields in local status

• Checks serialization and compatibility of daemon and agent account metadata.

test/Capacitor.Cli.Core.Tests.Unit/LocalIpc/DaemonStatusDtoTests.cs

FrameCodecAccountsTests.csTest account IPC frames +104/-0

Test account IPC frames

• Checks subscription, snapshot, and account-bearing Spawn encoding and decoding.

test/Capacitor.Cli.Core.Tests.Unit/LocalIpc/FrameCodecAccountsTests.cs

FrameCodecTests.csAdjust Spawn frame compatibility tests +11/-8

Adjust Spawn frame compatibility tests

• Accounts for the appended optional ID in existing frame tests.

test/Capacitor.Cli.Core.Tests.Unit/LocalIpc/FrameCodecTests.cs

StatusIpcJsonTests.csTest expanded status JSON contracts +34/-19

Test expanded status JSON contracts

• Updates local status serialization expectations for optional account fields.

test/Capacitor.Cli.Core.Tests.Unit/LocalIpc/StatusIpcJsonTests.cs

ResumeLedgerStoreTests.csTest persisted resume account fields +7/-2

Test persisted resume account fields

• Checks round-trip compatibility of account data in the resume ledger.

test/Capacitor.Cli.Core.Tests.Unit/Resume/ResumeLedgerStoreTests.cs

DaemonRunnerCapabilityRefreshTests.csAdapt capability refresh setup +1/-1

Adapt capability refresh setup

• Updates the existing test for account-aware daemon wiring.

test/Capacitor.Cli.Daemon.Tests.Unit/DaemonRunnerCapabilityRefreshTests.cs

ClaudeCommandProbeTests.csTest account-specific Claude command probes +21/-0

Test account-specific Claude command probes

• Checks the probe’s vendor-home environment for a selected account.

test/Capacitor.Cli.Daemon.Tests.Unit/Harness/Claude/ClaudeCommandProbeTests.cs

ClaudeLauncherAccountTests.csTest Claude launcher account paths +125/-0

Test Claude launcher account paths

• Checks that preparation and related filesystem operations use the selected Claude layout.

test/Capacitor.Cli.Daemon.Tests.Unit/Harness/Claude/ClaudeLauncherAccountTests.cs

CodexHostedAgentRuntimeFactoryTests.csExtend Codex app-server runtime tests +161/-9

Extend Codex app-server runtime tests

• Updates spawn seams and verifies account-specific runtime environment behavior.

test/Capacitor.Cli.Daemon.Tests.Unit/Harness/Codex/CodexHostedAgentRuntimeFactoryTests.cs

CodexLauncherAccountTests.csTest Codex launcher account preflight +97/-0

Test Codex launcher account preflight

• Checks hooks and configuration paths under the selected Codex account.

test/Capacitor.Cli.Daemon.Tests.Unit/Harness/Codex/CodexLauncherAccountTests.cs

CodexLauncherTests.csUpdate Codex launcher expectations +4/-1

Update Codex launcher expectations

• Adjusts existing tests for account-aware hooks guidance.

test/Capacitor.Cli.Daemon.Tests.Unit/Harness/Codex/CodexLauncherTests.cs

FixedPtyProcessFactory.csAccept PTY environment removals in fixture +2/-1

Accept PTY environment removals in fixture

• Updates the fixed process factory for the expanded spawn interface.

test/Capacitor.Cli.Daemon.Tests.Unit/Pty/FixedPtyProcessFactory.cs

PtyEnvScrubTests.csAdapt PTY environment scrub test +1/-1

Adapt PTY environment scrub test

• Passes the new removal argument through existing scrub coverage.

test/Capacitor.Cli.Daemon.Tests.Unit/Pty/PtyEnvScrubTests.cs

SpyPtyProcessFactory.csCapture PTY environment removals +7/-4

Capture PTY environment removals

• Extends the spy factory to observe requested child-environment changes.

test/Capacitor.Cli.Daemon.Tests.Unit/Pty/SpyPtyProcessFactory.cs

UnixPtyProcessEnvTests.csTest Unix child environment removal +35/-0

Test Unix child environment removal

• Verifies that requested inherited variables are absent from the spawned environment.

test/Capacitor.Cli.Daemon.Tests.Unit/Pty/Unix/UnixPtyProcessEnvTests.cs

AccountsIpcTests.csTest local account subscriptions +93/-0

Test local account subscriptions

• Checks initial snapshots, updates, and subscription lifecycle behavior.

test/Capacitor.Cli.Daemon.Tests.Unit/Services/AccountsIpcTests.cs

AccountsPublisherServerTests.csTest throttled account publication +161/-0

Test throttled account publication

• Checks server sends and snapshot behavior around connection changes.

test/Capacitor.Cli.Daemon.Tests.Unit/Services/AccountsPublisherServerTests.cs

AccountsPublisherTests.csTest registry polling and snapshot revisions +309/-0

Test registry polling and snapshot revisions

• Covers changed files, read failures, recovery, notifications, and retained snapshots.

test/Capacitor.Cli.Daemon.Tests.Unit/Services/AccountsPublisherTests.cs

AdmissionFenceIpcTests.csAdapt local-control test construction +1/-1

Adapt local-control test construction

• Supplies the new account IPC dependency to existing admission-fence coverage.

test/Capacitor.Cli.Daemon.Tests.Unit/Services/AdmissionFenceIpcTests.cs

AgentOrchestratorAccountTests.csTest hosted launch account resolution +411/-0

Test hosted launch account resolution

• Covers explicit-account acceptance and refusal, defaults, and account propagation through launch reporting.

test/Capacitor.Cli.Daemon.Tests.Unit/Services/AgentOrchestratorAccountTests.cs

AgentOrchestratorHarness.csAdapt orchestrator test harness +1/-1

Adapt orchestrator test harness

• Updates shared construction for account-aware runtime or launcher dependencies.

test/Capacitor.Cli.Daemon.Tests.Unit/Services/AgentOrchestratorHarness.cs

AgentOrchestratorLocalAttachTests.csAdapt local attach frame tests +5/-5

Adapt local attach frame tests

• Updates existing Spawn decoding expectations for the optional account ID.

test/Capacitor.Cli.Daemon.Tests.Unit/Services/AgentOrchestratorLocalAttachTests.cs

AgentOrchestratorResumeAccountTests.csTest account-aware agent resumes +221/-0

Test account-aware agent resumes

• Checks that resumes retain stored directories and refuse accounts that are no longer available.

test/Capacitor.Cli.Daemon.Tests.Unit/Services/AgentOrchestratorResumeAccountTests.cs

AgentResolvedTitleTests.csAdapt agent registration test double +2/-1

Adapt agent registration test double

• Accepts the expanded registration call carrying account metadata.

test/Capacitor.Cli.Daemon.Tests.Unit/Services/AgentResolvedTitleTests.cs

AgentStatusSnapshotTests.csAdapt agent status snapshot expectations +2/-1

Adapt agent status snapshot expectations

• Updates existing snapshots for the expanded agent account fields.

test/Capacitor.Cli.Daemon.Tests.Unit/Services/AgentStatusSnapshotTests.cs

CaptureServerConnection.csCapture account registration fields +6/-1

Capture account registration fields

• Extends the server test connection for account-aware agent registrations.

test/Capacitor.Cli.Daemon.Tests.Unit/Services/CaptureServerConnection.cs

ConsentRulesPutV2Tests.csAdapt consent local-control fixture +3/-2

Adapt consent local-control fixture

• Supplies account IPC when constructing the local control server.

test/Capacitor.Cli.Daemon.Tests.Unit/Services/ConsentRulesPutV2Tests.cs

DaemonSettingsIpcTests.csAdapt settings local-control fixture +1/-1

Adapt settings local-control fixture

• Supplies the new account IPC dependency.

test/Capacitor.Cli.Daemon.Tests.Unit/Services/DaemonSettingsIpcTests.cs

DaemonStatusIpcTests.csTest expanded daemon status wiring +3/-2

Test expanded daemon status wiring

• Updates status fixtures for per-account model metadata.

test/Capacitor.Cli.Daemon.Tests.Unit/Services/DaemonStatusIpcTests.cs

DaemonStatusWiringTests.csAdapt daemon status wiring checks +2/-1

Adapt daemon status wiring checks

• Accounts for the additional catalog field on local daemon information.

test/Capacitor.Cli.Daemon.Tests.Unit/Services/DaemonStatusWiringTests.cs

LaunchConsentIpcTests.csAdapt launch consent socket fixture +3/-2

Adapt launch consent socket fixture

• Supplies the new account IPC dependency to local-control construction.

test/Capacitor.Cli.Daemon.Tests.Unit/Services/LaunchConsentIpcTests.cs

LiveAgentsSnapshotTests.csTest live-agent account metadata +14/-0

Test live-agent account metadata

• Checks account identity in live-agent reporting.

test/Capacitor.Cli.Daemon.Tests.Unit/Services/LiveAgentsSnapshotTests.cs

LocalControlAgentResumeTests.csAdapt local resume socket tests +3/-2

Adapt local resume socket tests

• Supplies account IPC to the local control server fixture.

test/Capacitor.Cli.Daemon.Tests.Unit/Services/LocalControlAgentResumeTests.cs

LocalControlCapabilitiesTests.csAssert local account capability +1/-1

Assert local account capability

• Updates expected Hello capabilities to include accounts/1.

test/Capacitor.Cli.Daemon.Tests.Unit/Services/LocalControlCapabilitiesTests.cs

LocalControlHelloTests.csAdapt local Hello tests +3/-2

Adapt local Hello tests

• Updates local server construction for the new subscription handler.

test/Capacitor.Cli.Daemon.Tests.Unit/Services/LocalControlHelloTests.cs

LocalControlOpsV2PutTests.csAdapt local operations fixture +3/-2

Adapt local operations fixture

• Supplies account IPC to existing local-control tests.

test/Capacitor.Cli.Daemon.Tests.Unit/Services/LocalControlOpsV2PutTests.cs

LocalControlProbeTests.csAdapt local probe fixture +3/-2

Adapt local probe fixture

• Supplies account IPC to existing local-control tests.

test/Capacitor.Cli.Daemon.Tests.Unit/Services/LocalControlProbeTests.cs

LocalControlShutdownTests.csAdapt local shutdown fixture +3/-2

Adapt local shutdown fixture

• Supplies account IPC to existing local-control tests.

test/Capacitor.Cli.Daemon.Tests.Unit/Services/LocalControlShutdownTests.cs

PermissionWiringTests.csAdapt permission socket fixture +2/-1

Adapt permission socket fixture

• Supplies the account subscription dependency to local-control construction.

test/Capacitor.Cli.Daemon.Tests.Unit/Services/PermissionWiringTests.cs

PtyHostedAgentRuntimeFactoryEnvTests.csTest account-aware PTY environments +75/-0

Test account-aware PTY environments

• Checks selected vendor homes and removal of inherited overrides for built-in defaults.

test/Capacitor.Cli.Daemon.Tests.Unit/Services/PtyHostedAgentRuntimeFactoryEnvTests.cs

PtyHostedAgentRuntimeFactoryTests.csAdapt PTY runtime factory tests +14/-13

Adapt PTY runtime factory tests

• Updates factory setup and spawn expectations for account context and environment removals.

test/Capacitor.Cli.Daemon.Tests.Unit/Services/PtyHostedAgentRuntimeFactoryTests.cs

SeededLaunchEnvironmentTests.csAdapt seeded launch environment test +1/-1

Adapt seeded launch environment test

• Accounts for the expanded PTY spawn signature.

test/Capacitor.Cli.Daemon.Tests.Unit/Services/SeededLaunchEnvironmentTests.cs

SeqCaptureServerConnection.csCapture expanded registration calls +2/-1

Capture expanded registration calls

• Updates the sequenced server test double for optional account fields.

test/Capacitor.Cli.Daemon.Tests.Unit/Services/SeqCaptureServerConnection.cs

ServerConnectionAdvertisementTests.csTest account capability advertisement +20/-0

Test account capability advertisement

• Checks account-support and snapshot fields on daemon registration.

test/Capacitor.Cli.Daemon.Tests.Unit/Services/ServerConnectionAdvertisementTests.cs

ServerConnectionAgentRegisteredTests.csTest account-bearing agent registration +15/-0

Test account-bearing agent registration

• Checks optional account directory, ID, and label sent on registration.

test/Capacitor.Cli.Daemon.Tests.Unit/Services/ServerConnectionAgentRegisteredTests.cs

SpyHostedAgentLauncher.csObserve accounts in launcher test double +9/-0

Observe accounts in launcher test double

• Captures account context supplied to launcher preparation.

test/Capacitor.Cli.Daemon.Tests.Unit/Services/SpyHostedAgentLauncher.cs

StubCatalogFactory.csStub account-specific catalog probes +19/-0

Stub account-specific catalog probes

• Adds test support for catalog probing and fingerprints by directory.

test/Capacitor.Cli.Daemon.Tests.Unit/Services/StubCatalogFactory.cs

TestAccountsIpc.csProvide account IPC test fixture +12/-0

Provide account IPC test fixture

• Constructs the account subscription handler for local-control tests.

test/Capacitor.Cli.Daemon.Tests.Unit/Services/TestAccountsIpc.cs

VendorCliWatcherTests.csTest account catalog watching +69/-0

Test account catalog watching

• Checks watcher refresh behavior as account catalog fingerprints change.

test/Capacitor.Cli.Daemon.Tests.Unit/Services/VendorCliWatcherTests.cs

VendorModelCatalogsAccountTests.csTest per-account Codex catalog handling +143/-0

Test per-account Codex catalog handling

• Covers probing, merging, fingerprinting, and removal of stale account catalogs.

test/Capacitor.Cli.Daemon.Tests.Unit/Services/VendorModelCatalogsAccountTests.cs

AccountsCommandTests.csTest JSON account mutations +163/-0

Test JSON account mutations

• Checks action verdicts, committed revisions, wiring failures, and output behavior.

test/Capacitor.Cli.Tests.Unit/Commands/AccountsCommandTests.cs

AgentCommandAccountTests.csTest CLI account selection gates +163/-0

Test CLI account selection gates

• Checks account resolution, unsupported vendors, and refusal to send a choice to an older daemon.

test/Capacitor.Cli.Tests.Unit/Commands/AgentCommandAccountTests.cs

AgentCommandRoutingTests.csAdapt agent command construction +2/-1

Adapt agent command construction

• Supplies the new account store dependency in existing routing tests.

test/Capacitor.Cli.Tests.Unit/Commands/AgentCommandRoutingTests.cs

ControlSocketTripwire.csProvide control-socket test tripwire +35/-0

Provide control-socket test tripwire

• Detects unexpected local socket interactions during CLI account validation tests.

test/Capacitor.Cli.Tests.Unit/Commands/ControlSocketTripwire.cs

HelloProbeTests.csTest expanded Hello probe result +2/-1

Test expanded Hello probe result

• Updates capability-probe assertions for the account-launch gate.

test/Capacitor.Cli.Tests.Unit/Services/HelloProbeTests.cs

daemon-connect.v2.jsonExtend daemon-connect protocol fixture +1/-1

Extend daemon-connect protocol fixture

• Updates the wire fixture to include the additive account advertisement fields.

test/fixtures/daemon-connect.v2.json

Documentation (5) +957 / -6
README.mdDocument account-selected local launches +6/-2

Document account-selected local launches

• Explains --account selection, refusal cases, and JSON results for account mutations.

README.md

2026-10-22-vendor-accounts-launch-choice-daemon.mdPlan the daemon and CLI implementation +454/-0

Plan the daemon and CLI implementation

• Records implementation tasks, compatibility constraints, and verification goals for this portion of account selection.

docs/superpowers/plans/2026-10-22-vendor-accounts-launch-choice-daemon.md

2026-10-21-vendor-accounts-launch-choice-design.mdSpecify account choice across hosted launches +480/-0

Specify account choice across hosted launches

• Defines account defaults, support gates, publication, resume behavior, and later app and server responsibilities.

docs/superpowers/specs/2026-10-21-vendor-accounts-launch-choice-design.md

help-accounts.txtExplain account action JSON output +11/-4

Explain account action JSON output

• Updates account command help for machine-readable mutations and account use at launch.

src/Capacitor.Cli.Core/Resources/help-accounts.txt

help-agent.txtExplain agent --account usage +6/-0

Explain agent --account usage

• Documents supported vendors, account values, and local launch selection.

src/Capacitor.Cli.Core/Resources/help-agent.txt

The agent status row and the connect payload carry main's working_since and active_count fields ahead of the account fields, and the golden fixture follows that order.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>

@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: 6b3afe31d0

ℹ️ 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".

return new CommandOutcome(CommandOutcomeKind.LaunchRejected, agentId, RejectReason: CommandRejectedReason.Semantic);
}

var resolution = ResolveAccount(cmd.Vendor, cmd.AccountId, resume?.Entry.Launch);

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 Reject account IDs on review launches

When a LaunchKind.Review or LaunchKind.ReviewFlow command unexpectedly carries a non-null AccountId, this unconditional resolution honors that account and launches the reviewer with its credentials/configuration. The feature contract requires both review kinds to remain on the daemon's default account, so a stale or malformed server command can spend the wrong account and, for Codex review flows, make MCP isolation inspect the daemon-default configuration while the child inherits the selected account's configuration. Reject a supplied account ID for review kinds, or ignore it explicitly and resolve the default before creating the runtime.

Useful? React with 👍 / 👎.

@qodo-code-review

qodo-code-review Bot commented Oct 23, 2026 •

Copy link
Copy Markdown

Code Review by Qodo

🐞 Bugs (2) 📘 Rule violations (2) 📎 Requirement gaps (0) 🔗 Cross-repo conflicts (0) 📜 Skill insights (0)

Grey Divider


Remediation recommended

1. A missing title can discard account choice ✓ Resolved
Description
AgentStartArgs checks for exact flag names when consuming a --title value, so it accepts
--account=<id> as title text rather than parsing an account. With `kcap agent start claude --title
--account=<id>`, the subsequent launch has no account ID and uses the daemon’s default.
Code

src/Capacitor.Cli.Core/AgentStartArgs.cs[R92-93]

+    // A title or account may itself start with '-', so only these are taken as a missing value.
+    static readonly string[] KcapFlags = ["--", "--worktree", "--private", "--daemon", "-d", "--detach", "--title", "--account"];
Relevance

●●● Strong

Deterministic CLI parsing bug loses explicit account selections when --account uses equals syntax.

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The title parser consumes the next token unless it exactly matches KcapFlags; that list contains
--account but not its equals form. The CLI resolves and forwards an account only when the parsed
Account property is non-null.

src/Capacitor.Cli.Core/AgentStartArgs.cs[49-77]
src/Capacitor.Cli.Core/AgentStartArgs.cs[90-104]
src/Capacitor.Cli/Commands/AgentCommand.cs[97-117]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
A missing title value consumes the equals-form account option and permits a default-account launch.
## Fix Focus Areas
- src/Capacitor.Cli.Core/AgentStartArgs.cs[49-77]
- src/Capacitor.Cli.Core/AgentStartArgs.cs[90-104]
## Recommended Fix
Reject `--account=...` as the following value of `--title`, while retaining support for legitimate title text beginning with a hyphen. Add a parser test for the option ordering.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


2. Comments retain old-daemon history ✓ Resolved
Description
The new comments in the launch, frame, and capability-probe code explain behavior by referring to
what older daemons do rather than describing the current compatibility contract. That historical
wording will become stale as protocol support changes and appears in multiple readers of the
account-launch path.
Code

src/Capacitor.Cli/Commands/AgentCommand.cs[106]

+        // An older daemon never reads the account id and would start the agent under its default account.
Relevance

●●● Strong

Recent precedent favors replacing historical or time-sensitive comments with durable current
invariants.

PR-#1676
PR-#1845
PR-#1865

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The changed comments explicitly describe behavior in terms of an older daemon: the launch path says
it would ignore the account, the wire format says an older daemon ignores trailing bytes, and the
capability result says empty capabilities are what an older daemon sends.

Rule 2897915: Avoid time-sensitive or process-reference metadata in code comments
src/Capacitor.Cli/Commands/AgentCommand.cs[106-106]
src/Capacitor.Cli.Core/LocalIpc/FrameCodec.cs[107-108]
src/Capacitor.Cli/Services/HelloProbe.cs[19-19]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
Several added comments use historical references such as "older daemon" to explain compatibility behavior, violating the comment policy against process-history narration.

## Fix Focus Areas
- src/Capacitor.Cli/Commands/AgentCommand.cs[106-106]
- src/Capacitor.Cli.Core/LocalIpc/FrameCodec.cs[107-108]
- src/Capacitor.Cli/Services/HelloProbe.cs[19-19]

## Recommended Fix
Rewrite the comments to describe the current wire-compatibility or capability-gating invariant directly, without referring to older daemons or historical behavior.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


3. The server can retain a stale account list 🐞 Bug ☼ Reliability
Description
AccountsChangedAsync catches a failed send, while AccountsPublisher treats that snapshot as sent
and schedules no retry. If a send fails while the connection remains ready and no later registry
change or registration occurs, the server never receives the updated account list.
Code

src/Capacitor.Cli.Daemon/Services/ServerConnection.cs[R212-215]

+    public virtual async Task AccountsChangedAsync(AccountsSnapshotDto snapshot) {
+        if (!IsReady) return;
+        try { await SendAccountsChangedRawAsync(snapshot); }
+        catch (Exception ex) { _logger.LogDebug(ex, "AccountsChanged send failed (old server or transient)"); }
Relevance

●●● Strong

Swallowed send failures without retry can permanently stale server state; recent reliability fixes
favor retaining retryability.

PR-#1758

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The connection catches send exceptions without returning a failure indication. The publisher starts
the send without retaining a task or retry state, and its next send is triggered by another snapshot
change or a trailing timer already scheduled for one.

src/Capacitor.Cli.Daemon/Services/ServerConnection.cs[209-219]
src/Capacitor.Cli.Daemon/Services/AccountsPublisher.cs[148-185]
src/Capacitor.Cli.Daemon/Services/ServerConnection.cs[823-830]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
A transient account-snapshot send failure is swallowed, leaving the server stale until another change or registration.
## Fix Focus Areas
- src/Capacitor.Cli.Daemon/Services/ServerConnection.cs[209-219]
- src/Capacitor.Cli.Daemon/Services/AccountsPublisher.cs[148-185]
## Recommended Fix
Make send failure observable to the publisher and retry its latest snapshot with a bounded delay while the connection is ready. Preserve the connect snapshot as the reconnect recovery path.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

Dismiss ↗ | View ↗


View medium (3)
4. Older account data can overwrite newer data 🐞 Bug ☼ Reliability
Description
AccountsPublisher starts each snapshot send without awaiting or ordering earlier sends. If an
earlier send remains in flight when a trailing send or reconnect repair delivers a newer revision,
the older revision can subsequently reach the server last.
Code

src/Capacitor.Cli.Daemon/Services/AccountsPublisher.cs[R161-164]

+            _lastSentAt = time.GetTimestamp();
+        }
+
+        _ = SendAsync(snapshot);
Relevance

●● Moderate

Concurrent snapshot delivery can reorder revisions, but no close rejection precedent was found.

PR-#1758

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
Both immediate and trailing paths discard the task returned by SendAsync, which independently
awaits each sink call. The post-registration repair invokes the same connection send without sharing
an ordering mechanism.

src/Capacitor.Cli.Daemon/Services/AccountsPublisher.cs[148-185]
src/Capacitor.Cli.Daemon/Services/ServerConnection.cs[209-219]
src/Capacitor.Cli.Daemon/Services/ServerConnection.cs[823-830]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
Overlapping snapshot sends can leave the server with an older account revision than the daemon holds.
## Fix Focus Areas
- src/Capacitor.Cli.Daemon/Services/AccountsPublisher.cs[148-185]
- src/Capacitor.Cli.Daemon/Services/ServerConnection.cs[823-830]
## Recommended Fix
Use one ordered publication lane for publisher sends and post-registration repair. Coalesce pending updates to the latest snapshot, and do not transmit an older revision after a newer one.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

Dismiss ↗ | View ↗


5. Reviewers can escape MCP isolation on an account ✓ Resolved
Description
HandleAdmittedLaunchAsync resolves cmd.AccountId for every launch kind, so a review-flow or
PR-review command that names an account runs under that account's CODEX_HOME.
CodexMcpInventory.ListInheritedServers still runs codex mcp list --json with the daemon's own
environment, though. The recursion guard then disables the daemon directory's MCP servers rather
than the ones the reviewer actually inherits from the account's config.toml and plugins.
Code

src/Capacitor.Cli.Daemon/Services/AgentOrchestrator.cs[R2693-2701]

+            var resolution = ResolveAccount(cmd.Vendor, cmd.AccountId, resume?.Entry.Launch);
+
+            // A failure, not a rejection: the refusal reaches the caller by name, never as a generic rejection.
+            if (resolution.Refusal is { } refusal) {
+                if (resume is not null) resume.AccountRefusal = refusal;
+                await LaunchFailedUnlessPrivateAsync(isPrivate, agentId, refusal);
+
+                return new CommandOutcome(CommandOutcomeKind.LaunchFailedCleaned, agentId);
+            }
Relevance

●● Moderate

Potential review-flow isolation bypass is security-sensitive, but historical evidence does not
establish team treatment.

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The spec says reviewers keep the default account, but the daemon never enforces this:
ResolveAccount(cmd.Vendor, cmd.AccountId, ...) runs for every cmd.Kind. CodexLauncher builds
the reviewer's MCP disable list from CodexMcpInventory.ListInheritedServers(config.CodexPath),
which takes no account. That inventory inherits the daemon process's environment. The account's
CODEX_HOME is applied only later, by VendorHomeEnv.Apply in the runtime factories, after the
arguments are built. An explorer traced the same path and confirmed it.

src/Capacitor.Cli.Daemon/Harness/Codex/CodexLauncher.cs[60-75]
src/Capacitor.Cli.Daemon/Harness/Codex/CodexMcpInventory.cs[19-52]
src/Capacitor.Cli.Daemon/Harness/Codex/CodexHostedAgentRuntimeFactory.cs[175-200]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
A review-flow or PR-review launch that carries an `AccountId` runs under that account's `CODEX_HOME`. The Codex MCP isolation inventory (`codex mcp list --json`) still enumerates the daemon's own Codex home, so MCP servers from the account's config are not disabled for the reviewer.

## Fix Focus Areas
- src/Capacitor.Cli.Daemon/Services/AgentOrchestrator.cs[2693-2701]
- src/Capacitor.Cli.Daemon/Harness/Codex/CodexLauncher.cs[60-75]
- src/Capacitor.Cli.Daemon/Harness/Codex/CodexMcpInventory.cs[39-52]

## Recommended Fix
Pick one, or do both:
- In `HandleAdmittedLaunchAsync`, refuse a non-empty `cmd.AccountId` when `cmd.Kind != LaunchKind.Default` (or when `IsReview`/`IsReviewFlow`), so reviewers always use the default account, as the spec says.
- Pass the launch account into `ReadInheritedMcpServers` / `ListInheritedServers`, and set or remove `CODEX_HOME` on the `ProcessStartInfo.Environment` with `VendorHomeVariable.Plan`, so the enumeration reads the same home the reviewer uses.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


6. Wiring success can name a removed account ✓ Resolved
Description
WireAndReport releases the account lock before StampWiring reloads and updates the registry, and
the stamp reports a revision even when its account ID no longer exists. If another command removes
that account between wiring and stamping, the wiring command reports success and a committed
revision that contains no wiring result for it.
Code

src/Capacitor.Cli/Commands/AccountsCommand.cs[R147-150]

+        // The stamp's Mutate takes the lock held above, so it must come after that block. Committing after the
+        // wiring is what lets a snapshot at this revision vouch for it.
+        var fatal    = AccountWiring.HasFatalFailure(steps);
+        var revision = StampWiring(account, fatal ? AccountWiring.FailureSummary(steps) : null);
Relevance

●● Moderate

A plausible removal-and-stamping race exists, but no close precedent confirms acceptance of this
concurrency concern.

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The temporary lock ends before StampWiring; its projection leaves all entries unchanged when the
ID is absent but still constructs a new registry value. MutateWithRevision saves that value with
an incremented revision, while removal independently deletes the account.

src/Capacitor.Cli/Commands/AccountsCommand.cs[143-150]
src/Capacitor.Cli/Commands/AccountsCommand.cs[170-177]
src/Capacitor.Cli/Commands/AccountsCommand.cs[91-106]
src/Capacitor.Cli.Core/Accounts/AccountStore.cs[66-74]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
A concurrent removal can occur between wiring an account and recording its wiring result, causing a false success and revision.
## Fix Focus Areas
- src/Capacitor.Cli/Commands/AccountsCommand.cs[143-150]
- src/Capacitor.Cli/Commands/AccountsCommand.cs[170-177]
## Recommended Fix
Coordinate wiring and registry stamping under one account lock without reentering the store's locking mutation method, or detect a missing ID at stamp time and report a conflict instead of success.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools



Informational

7. Suggested hooks fix breaks on spaced paths ✓ Resolved
Description
The CodexHooksNotInstalledException message puts paths.Home into the suggested `kcap accounts
add codex {paths.Home}` command without shell-quoting it. If an account directory contains spaces or
shell metacharacters, the user's copy-paste either fails or registers the wrong directory, while
kcap accounts list output quotes the same kind of suggestion with ShellArgument.Quote.
Code

src/Capacitor.Cli.Daemon/Harness/Codex/CodexLauncher.cs[R135-137]

+                $"Codex hooks not installed in {paths.Home}. Run `kcap accounts add codex {paths.Home}` " +
+                "to wire that directory, or `kcap plugin install --codex --project` "                   +
+                "(project scope), and try again."
Relevance

●●● Strong

Unquoted filesystem paths break copy-pasted commands; repository precedent favors safe path
handling.

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
AccountsCommand.List builds the same kcap accounts add ... suggestion with
ShellArgument.Quote(c.Directory). The new launcher message interpolates the raw directory instead.

src/Capacitor.Cli/Commands/AccountsCommand.cs[68-74]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The hooks-missing error suggests `kcap accounts add codex <dir>` with the directory unquoted, so the command breaks for paths that contain spaces.

## Fix Focus Areas
- src/Capacitor.Cli.Daemon/Harness/Codex/CodexLauncher.cs[135-137]

## Recommended Fix
Wrap `paths.Home` in `ShellArgument.Quote(...)` (the helper `AccountsCommand.List` uses) inside the suggested command, or move that helper somewhere the daemon can reach.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


8. CLI tests can race on captured output 📘 Rule violation ▣ Testability
Description
AccountsCommandTests adds console-capturing test methods with ConsoleOutput.StartCapture() and
StartFullCapture() but no [NotInParallel] attribute. When TUnit runs these methods concurrently,
their process-global standard streams can overlap and make captured-output assertions
nondeterministic.
Code

test/Capacitor.Cli.Tests.Unit/Commands/AccountsCommandTests.cs[204]

+        using var capture = ConsoleOutput.StartCapture();
Relevance

● Weak

Recent console-capture findings lacking NotInParallel were rejected, providing a close convention
precedent.

PR-#1744
PR-#1531

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The changed test method starts a ConsoleOutput capture at line 204, while the surrounding added
test method has only [Test] and no [NotInParallel]. The checklist requires every
console-output-capturing test to use exactly a bare [NotInParallel] attribute.

Rule 2741710: Annotate console-output-capturing tests with bare [NotInParallel]
test/Capacitor.Cli.Tests.Unit/Commands/AccountsCommandTests.cs[197-204]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The added `AccountsCommandTests` methods capture process-global console output without a bare `[NotInParallel]` attribute, so concurrent execution can mix streams and produce flaky assertions.

## Fix Focus Areas
- test/Capacitor.Cli.Tests.Unit/Commands/AccountsCommandTests.cs[197-204]

## Recommended Fix
Add a bare `[NotInParallel]` attribute to each added test method that captures standard output or standard error, or apply the project’s supported class-level equivalent if it guarantees the same protection for every capturing test.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

Dismiss ↗ | View ↗


9. A test bypasses injected temporary storage 📘 Rule violation ▣ Testability
Description
AppServerChildEnvFor creates a temporary directory with new TempDir() inside the TUnit test
class instead of using an injected [TempDir] property. Each invocation therefore manages its own
temporary fixture outside the test framework’s required injection lifecycle, making the class
inconsistent with the suite’s test-resource management convention.
Code

test/Capacitor.Cli.Daemon.Tests.Unit/Harness/Codex/CodexHostedAgentRuntimeFactoryTests.cs[461]

+        using var wt = new TempDir();
Relevance

● Weak

A recent same-file TempDir injection suggestion was rejected, despite older accepted precedents.

PR-#1865

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The changed helper directly constructs new TempDir() at line 461 inside
CodexHostedAgentRuntimeFactoryTests. The checklist requires TUnit test classes to use an injected
public required [TempDir] property and forbids manually created TempDir instances in those
classes.

Rule 2808173: Use injected [TempDir] public required property in test classes instead of manual fields
test/Capacitor.Cli.Daemon.Tests.Unit/Harness/Codex/CodexHostedAgentRuntimeFactoryTests.cs[458-480]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
`AppServerChildEnvFor` calls `new TempDir()` inside a TUnit test class. Test classes must receive temporary directories through a public required `[TempDir]` property rather than constructing them manually.

## Fix Focus Areas
- test/Capacitor.Cli.Daemon.Tests.Unit/Harness/Codex/CodexHostedAgentRuntimeFactoryTests.cs[458-480]

## Recommended Fix
Add a public required `[TempDir]` property to the test class and use that injected directory for the worktree created by `AppServerChildEnvFor`; remove the local `new TempDir()` construction while preserving the existing cleanup and path setup behavior.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

Dismiss ↗ | View ↗


Grey Divider

Context sources
✅ Compliance rules (platform): 59 rules
✅ Cross-repo context — repo relationships
  Explored: repo: kurrent-io/kcap-server (sha: 2df43903) — View relationship
Review mode: Auto: 🧠 Deep: Large, logic-dense cross-cutting change spans launch, resume, IPC, environment, and CLI paths.

Grey Divider

Tip of the day
💡 Did you know, you can reply 'qodo' on any finding to push back, ask questions, or dig deeper

More tips ↗ | Customize Qodo ↗ | Qodo docs ↗

Grey Divider

Qodo Logo

Comment thread src/Capacitor.Cli/Commands/AgentCommand.cs Outdated
Comment on lines +212 to +215
public virtual async Task AccountsChangedAsync(AccountsSnapshotDto snapshot) {
if (!IsReady) return;
try { await SendAccountsChangedRawAsync(snapshot); }
catch (Exception ex) { _logger.LogDebug(ex, "AccountsChanged send failed (old server or transient)"); }

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Remediation recommended

2. The server can retain a stale account list 🐞 Bug ☼ Reliability

AccountsChangedAsync catches a failed send, while AccountsPublisher treats that snapshot as sent
and schedules no retry. If a send fails while the connection remains ready and no later registry
change or registration occurs, the server never receives the updated account list.
Agent Prompt
## Issue description
A transient account-snapshot send failure is swallowed, leaving the server stale until another change or registration.
## Fix Focus Areas
- src/Capacitor.Cli.Daemon/Services/ServerConnection.cs[209-219]
- src/Capacitor.Cli.Daemon/Services/AccountsPublisher.cs[148-185]
## Recommended Fix
Make send failure observable to the publisher and retry its latest snapshot with a bounded delay while the connection is ready. Preserve the connect snapshot as the reconnect recovery path.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

Dismiss ↗ | View ↗

Comment on lines +161 to +164
_lastSentAt = time.GetTimestamp();
}

_ = SendAsync(snapshot);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Remediation recommended

4. Older account data can overwrite newer data 🐞 Bug ☼ Reliability

AccountsPublisher starts each snapshot send without awaiting or ordering earlier sends. If an
earlier send remains in flight when a trailing send or reconnect repair delivers a newer revision,
the older revision can subsequently reach the server last.
Agent Prompt
## Issue description
Overlapping snapshot sends can leave the server with an older account revision than the daemon holds.
## Fix Focus Areas
- src/Capacitor.Cli.Daemon/Services/AccountsPublisher.cs[148-185]
- src/Capacitor.Cli.Daemon/Services/ServerConnection.cs[823-830]
## Recommended Fix
Use one ordered publication lane for publisher sends and post-registration repair. Coalesce pending updates to the latest snapshot, and do not transmit an older revision after a newer one.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

Dismiss ↗ | View ↗

Comment thread src/Capacitor.Cli.Core/AgentStartArgs.cs
Comment thread src/Capacitor.Cli/Commands/AccountsCommand.cs Outdated
Comment thread src/Capacitor.Cli.Daemon/Services/AgentOrchestrator.cs Outdated
Comment thread src/Capacitor.Cli.Daemon/Harness/Codex/CodexLauncher.cs Outdated
alexeyzimarev and others added 7 commits October 23, 2026 11:03
…#1806)

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
A reviewer's MCP inventory and hooks are read from the daemon's default account, so an id on a review or review-flow launch would run the child where the inventory never looked.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
…1806)

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
The wiring runs under the registry lock and the stamp takes it again, so a remove can land between them; the stamp now says whether it found the account.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
The quoting helper moves to Core, public, so the daemon can reach it.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
A default reached through a symlink used to be recorded as the link, so retargeting the link before a resume moved the continuation to another account while the ledger still named the first.

Co-Authored-By: Claude Fable 5.1 <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.

1 participant