From 8cdccb7fd44c6ebc9480a66147806e43aed9802a Mon Sep 17 00:00:00 2001 From: Claude Date: Tue, 1 Dec 2026 07:18:40 +0000 Subject: [PATCH] fix(cli): vx why names a group asked for bare from the root A bare group name asked outside its project, at the workspace root, read "no recorded runs for task", pointing at vx last --stats, as if it could have run. It now says it is a group that records no run. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01W6xuYbTejZJFBPnwJ9zFrV --- packages/vx/src/cli/why.ts | 4 ++++ packages/vx/tests/why.test.ts | 3 +++ 2 files changed, 7 insertions(+) diff --git a/packages/vx/src/cli/why.ts b/packages/vx/src/cli/why.ts index 1024737713..0337bec05e 100644 --- a/packages/vx/src/cli/why.ts +++ b/packages/vx/src/cli/why.ts @@ -264,6 +264,10 @@ async function resolveTarget( if (matches.length > 1) { throw ambiguousTask('why', target, matches) } + // Asked outside the one project declaring it, a group read as a task + // that never ran, pointed at `vx last --stats`. + const kind = await declared() + if (kind === 'group' || kind === 'no-op task') throw groupRefusal(target, kind) } const ids = new LocalHistoryProvider(db).recentTaskIds() const invoked = ids.length === 0 && db.query('SELECT 1 FROM invocations LIMIT 1').get() !== null diff --git a/packages/vx/tests/why.test.ts b/packages/vx/tests/why.test.ts index 4740f2aa98..0a596c94ad 100644 --- a/packages/vx/tests/why.test.ts +++ b/packages/vx/tests/why.test.ts @@ -973,6 +973,9 @@ describe('vx why of a declared task that never ran', () => { for (const [cwd, target, id] of [ [app, 'all', 'app#all'], [root, 'app#all', 'app#all'], + // Bare from the root it read "no recorded runs for task", as if it + // could have run. + [root, 'all', 'all'], ] as const) { const r = await vx(cwd, ['why', target]) expect({ code: r.code, err: r.err }).toEqual({