Machine create inherits profile default visibility; status surfaces machine auth - #522
Conversation
…venance labels kcap machine create no longer defaults its printed default_visibility to private; it resolves from the explicit --visibility flag, else the active profile's default_visibility (what kcap setup wrote), else org_public, each labeled with its provenance. A machine is never steered to private. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
When KCAP_CLIENT_ID/KCAP_CLIENT_SECRET are present the CLI records as the machine, bypassing the token store; kcap status now says so, naming the exact variable(s) set so the secret-only case is not mislabeled. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
PR Summary by QodoMachine create inherits profile visibility; status warns on machine auth
AI Description
Diagram
High-Level Assessment
Files changed (6)
|
Code Review by Qodo
1.
|
…te-credential status - ResolveCreateVisibility falls back to org_public when the profile default is a value a machine cannot record with (e.g. 'project'), instead of inheriting it and hitting the machine-only validation with a message that falsely blames --visibility. - DescribeDiversion distinguishes a complete credential (records as the machine) from an incomplete one (one var set: diverted but nothing records). - kcap status prints the machine line INSTEAD of the token-store line when a credential is present, so a runner never shows both 'records as the machine' and 'not authenticated (run: kcap login)'. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…te kcap status machine-auth line Addresses qodo rule violation: user-facing CLI changes must update README. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…fallback Codex round 2: the flag-default help implied it always inherits the profile default; note the fallback for a profile value a machine cannot record with. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
Codex code review: complete (findings fixed). Round 1 found three should-fix issues, all addressed:
Round 2 confirmed the three fixes and flagged one help-text nit (document the Qodo's two findings are resolved: the README rule violation (README updated) and the project-blocked bug (same as codex #1, fixed via the fallback — reply left on the thread explaining why the allowlist approach it suggested would be incorrect). |
|
Windows CI red is the known AI-1848 flake, not this change.
Evidence it's not this PR:
Reran the failed Windows job to confirm it's intermittent. It is not fixable from this PR (AI-1848 has its own owner). |
|
Rerun confirms AI-1848 (not this PR): the Windows lane failed again on a different telemetry test — |
CLI half of the machine-session-visibility work (Linear AI-1852; server half is kcap-server#1396). Companion to the server change that makes service-owned org-default sessions org-visible.
Problem
kcap machine createdefaulted its printeddefault_visibilitytoprivateand instructed the operator to runkcap config set default_visibility privateon the runner — contradicting the visibility they already chose atkcap setupand the product model that visibility lives in the recording profile. Separately, a developer who exportsKCAP_CLIENT_ID/KCAP_CLIENT_SECRETinto an interactive shell silently records every terminal session as the machine, with no indication anywhere.Changes
kcap machine createinherits the creator's configured visibility. New pureMachineCommand.ResolveCreateVisibility(flag, profileDefault)→(value, provenance): an explicit--visibilitywins (from --visibility), else the active profile'sdefault_visibility(your profile default— whatkcap setupwrote), elseorg_public(product default). The setup instructions print the resolved value labeled with its provenance and never introduceprivateon the command's own authority.help-machine.txtupdated to match.kcap statussurfaces machine-auth diversion. NewMachineAuth.DescribeDiversion(idSet, secretSet)prints a line naming whicheverKCAP_CLIENT_*variable(s) are present (the trigger is either-var, so a fixed "ID is set" text would be false in the secret-only case), above the token-store state.No wire/protocol change; independent of the server PR (either merge order works).
Tests
MachineCreateVisibilityTests(4 — flag wins, profile inherited, private-profile honored-and-labeled, no-profile product default);MachineAuthStatusLineTests(id-only / secret-only / both / silent-when-neither); existingMachineCommandTestshelp pins unchanged (20/20). All green locally.🤖 Generated with Claude Code