From e259e06c755f8a449607f72f9f1c22e910481b34 Mon Sep 17 00:00:00 2001 From: haelyra <49814733+haelyra@users.noreply.github.com> Date: Sat, 10 Oct 2026 19:19:30 -0400 Subject: [PATCH] fix(plan-canvas): reconcile profile resolver and retain invalid feedback queues --- scripts/hooks/plan-canvas-pending.js | 18 ------------------ tests/hooks/plan-canvas-pending-hook.test.js | 2 +- 2 files changed, 1 insertion(+), 19 deletions(-) diff --git a/scripts/hooks/plan-canvas-pending.js b/scripts/hooks/plan-canvas-pending.js index 63727e436..e0c0ad38d 100644 --- a/scripts/hooks/plan-canvas-pending.js +++ b/scripts/hooks/plan-canvas-pending.js @@ -62,24 +62,6 @@ function claudeConfigDir() { return path.resolve(trimmed); } -// Resolve the Claude profile directory the same way everywhere. -// -// Duplicated rather than imported on purpose: hooks ship in managed installs -// that carry top-level `scripts/` without `scripts/lib/` (see #3259), so a -// require into lib/ would make the hook unloadable there. `~` is expanded the -// way `scripts/lib/agent-data-home.js` expands it, so a profile written as -// `~/.claude-work` resolves to one place rather than two. -function claudeConfigDir() { - const configured = process.env.CLAUDE_CONFIG_DIR; - const trimmed = configured ? String(configured).trim() : ''; - if (!trimmed) return path.join(os.homedir(), '.claude'); - if (trimmed.startsWith('~')) { - const remainder = trimmed.slice(1).replace(/^[/\\]+/, ''); - return remainder ? path.join(os.homedir(), remainder) : os.homedir(); - } - return path.resolve(trimmed); -} - function stateDir() { const override = process.env.ECC_PLAN_CANVAS_STATE_DIR; if (override && override.trim()) return path.resolve(override.trim()); diff --git a/tests/hooks/plan-canvas-pending-hook.test.js b/tests/hooks/plan-canvas-pending-hook.test.js index ddf4b3977..0a3d82688 100644 --- a/tests/hooks/plan-canvas-pending-hook.test.js +++ b/tests/hooks/plan-canvas-pending-hook.test.js @@ -278,7 +278,7 @@ async function runTests() { assert.strictEqual(await hook.drainViaServer(port, 'aaaaaaaaaaaa'), null); } fs.writeFileSync(path.join(stateDir, 'server.json'), JSON.stringify({ port: 4321 })); - for (const key of ['bad?key=SECRET&other=1', 'A'.repeat(12), 'a'.repeat(13), 'a'.repeat(100000), {}, null]) { + for (const key of ['bad?key=SECRET&other=1', 'A'.repeat(12), 'a'.repeat(13), 'a'.repeat(12) + '\n', 'a'.repeat(12) + '\r\n', 'a'.repeat(100000), {}, null]) { writeState(stateDir, { aaaaaaaaaaaa: sessionRecord(key, artifact, [{ kind: 'chat', text: 'KEEP' }]) }); const raw = JSON.stringify({ cwd: root }); assert.strictEqual((await hook.run(raw)).stdout, raw);