937a1c8216
Adds source-attribution rendering to `ctask info` for the two Phase 1
settings whose effective value depends on user-level defaults: the
agent recorded in task.yaml and the configured launch session mode.
cmd/info.go:
- runInfo loads the resolver once (config.LoadResolver) and reuses
it across the rendering — matches the user's correction that "new
doctor/info code should load the resolver once and reuse it".
- Agent line now reads `Agent: <value> (workspace)` when task.yaml
has a non-empty agent (the common case), or `Agent: <value>
(default)` / `Agent: <value> (default — <source label>)` when the
field is empty and the value comes from the resolver fallback
chain. The fallback path is informational only: every workspace
created by recent ctask versions writes the resolved default into
task.yaml at Create time, so the (workspace) branch is what users
normally see.
- New "Launch session mode:" line lives immediately after Agent and
before Created — outside the v0.5.4 Session block per the user's
placement decision ("Keep it outside the Session block because it
represents the configured launch default, not the current session
lease mode"). Format: `Launch session mode: <value> (<source>)`.
- Two small helpers added: agentLineWithSource composes the agent
payload + label; infoSourceLabel renders a single-row source
string (CTASK_X env var / config file / built-in default /
platform override). infoSourceLabel intentionally omits the
override-chain suffix used by doctor — info's row layout has no
room for the extra parenthetical.
cmd/info_attribution_test.go (5 cases):
- TestInfoAgentSourceWorkspace — task.yaml with agent set → "(workspace)"
- TestInfoAgentSourceDefaultForLegacy — empty agent → "(default)"
- TestInfoLaunchSessionModeFromConfig — config session_mode value +
"config file" source label
- TestInfoLaunchSessionModeBuiltinDefault — no config, no env →
"direct (built-in default)"
- TestInfoLaunchSessionModeAfterAgentBeforeCreated — placement check:
Agent < Launch session mode < Created in the rendered output
Smoke-verified against an existing v0.5.x workspace on the installed
binary; render order and source labels match the spec example.