Repository navigation
fix(cli): honor channel resolve agent ownership - #125109
Conversation
Forward explicit channel owners through command-time secret collection and later workspace/channel resolution, preventing AGENT_SELECTION_REQUIRED in multi-agent configurations.
|
🦞👀 Pull request received. I will update this pull request when review starts. |
Use runtime string narrowing for the Commander option so agent-owner forwarding remains assertion-free and satisfies the assertion-safety ratchet.
|
Codex review: needs maintainer review before merge. Reviewed August 17, 2026, 2:46 AM ET / 06:46 UTC. ClawSweeper reviewWhat this changesThe PR lets operators pass Regression provenancePossible regression — suspected (reviewed change). No predecessor PR is attributed. Merge readinessKeep open for normal maintainer handling: current main still lacks the explicit owner path, while the PR cleanly carries that owner through the affected boundaries and resolves the prior documentation finding. Priority: P2 Review scores
Verification
How this fits togetherThe Channels CLI parses an operator command, prepares only relevant secrets, selects a plugin/workspace, then resolves provider target names. The chosen agent must remain consistent across those steps in multi-agent setups. flowchart LR
A[Operator command] --> B[Channels CLI parser]
B --> C[Explicit agent owner]
C --> D[Secret preflight]
C --> E[Workspace plugin lookup]
C --> F[Channel selection]
D --> G[Target resolution]
E --> G
F --> G
Before merge
Agent review detailsSecurityNone. PR surfaceSource +43, Tests +97, Docs +3. Total +143 across 14 files. View PR surface stats
Review metrics
Technical reviewBest possible solution: Land this as the single canonical explicit-owner path after the exact-head checks complete, preserving existing default-agent behavior when Do we have a high-confidence way to reproduce the issue? Yes, source-reproducible: current main has no parser-to-resolver agent path, and the supplied regression covers the prior secret-preflight selection failure. Is this the best way to solve the issue? Yes: propagating the already explicit owner through the producer boundaries is cleaner than handling AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 73ab74ecccdc. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (1 earlier review cycle)
|
Land-ready proofHead: The repair keeps one explicit agent owner from CLI parsing through command-time secret classification, workspace-scoped plugin lookup, and message-channel selection. Gateway protocol behavior is unchanged. Proof:
ClawSweeper moves: applied the Channels-reference Production LOC: +53/-10 (net +43). Tests: +101/-4. Docs: +5/-2. The positive production delta is direct optional owner passthrough across existing ownership boundaries. Proof gap: no live channel API credentials were needed or used. The failure occurs deterministically in parser/owner propagation before a channel API call, and the focused regression exercises the real command secret collector that previously raised the error. |
|
Merged via squash.
|
* fix(cli): honor channel resolve agent ownership Forward explicit channel owners through command-time secret collection and later workspace/channel resolution, preventing AGENT_SELECTION_REQUIRED in multi-agent configurations. * fix(cli): narrow explicit agent option value Use runtime string narrowing for the Commander option so agent-owner forwarding remains assertion-free and satisfies the assertion-safety ratchet. * docs(cli): document channel resolve agent owner
What Problem This Solves
Fixes an issue where operators resolving channel targets for an explicit agent could receive
AGENT_SELECTION_REQUIREDin multi-agent configurations before any Gateway call. Thechannels resolveparser did not declare or forward--agent, and command-time secret preflight could therefore try to select a default owner for unclaimed sandbox SSH defaults before channel/plugin selection ran.Why This Change Was Made
The CLI now declares
--agenton both thechannelsparent and theresolveleaf, inherits the parent value only when the leaf did not provide one, and carries that explicit owner through the existing command config/secret collection boundary. The same owner reaches plugin workspace resolution and message-channel selection, so ownership is recorded at the producers that need it; the Gateway protocol is intentionally unchanged.This is the best-fix owner boundary because it preserves one canonical resolution flow and passes the already-known optional owner through it. A downstream catch for
AGENT_SELECTION_REQUIREDwould leave command-time secret classification and later workspace/channel selection disagreeing about ownership.Production LOC: +53/-10 (net +43). Tests: +101/-4. Docs: +5/-2. The production growth is direct optional owner passthrough across the existing CLI, secret-collection, workspace, and channel-selection boundaries.
User Impact
Operators can use either
channels --agent <id> resolve ...orchannels resolve --agent <id> ...in multi-agent setups. Explicit agent ownership now consistently controls command-time secret collection, plugin workspace lookup, and channel selection instead of failing early while trying to infer a default agent.Evidence
AgentSelectionRequiredErrorthroughcollectAgentSandboxAssignments/classifyConfiguredTargetRefsbefore any Gateway call. The same case passes after the fix.node scripts/run-vitest.mjs src/cli/channels-cli.test.ts src/cli/command-config-resolution.test.ts src/cli/command-secret-gateway.test.ts src/commands/channel-setup/channel-plugin-resolution.test.ts src/commands/channels.resolve.test.ts— 87/87 passed.node scripts/run-tsgo.mjs -p tsconfig.core.json --incremental --tsBuildInfoFile .artifacts/tsgo-cache/core.tsbuildinfo— passed.node scripts/run-tsgo-core-test-shards.mjs— passed.node scripts/run-oxlint.mjsover all 13 touched files — passed.node_modules/.bin/oxfmtover all 13 touched files — clean;git diff --check— passed.node scripts/check-changed.mjs --dry-run -- <13 touched paths>— classified the change ascore/coreTests.channels --agent ops resolve room --helpandchannels resolve --agent ops room --helpwere both accepted;--agentxwas rejected.src/cli/channels-cli.ts: 8 > 7). The fix replaced the new Commander cast with runtime string narrowing; focused tests remained 87/87, max-lines and assertion-safety ratchets passed, typed lint passed, and a fresh autoreview of the repair was clean.--agentdocumentation move was applied in the Channels reference, including both parent and leaf placements.pnpm docs:list,pnpm docs:check-mdx(774 files),pnpm docs:check-links(6,498 internal links, zero broken), targeted formatting,git diff --check, and fresh autoreview all passed.Proof gap: no live channel API credentials were needed or used. The failure is deterministic parser/owner propagation before a channel API call, and the focused regression exercises the real command secret collector that previously raised the error.
AI-assisted: yes; understood and independently reviewed.