From 568020b71a1507057c6c6ecd903b8bb2987a459e Mon Sep 17 00:00:00 2001 From: Claude Date: Mon, 26 Oct 2026 15:20:04 +0000 Subject: [PATCH] fix(agent-browser): pin AGENT_BROWSER_CONFIG precedence over repo config vercel-labs/agent-browser#1679 (0.39.3): agent-browser still auto-discovers a repository-controlled agent-browser.json from its working directory. rufloMcpLaunch already starts Ruflo (and the agent-browser it shells out to) at the repository root while unconditionally handing it only ak's own absolute AGENT_BROWSER_CONFIG (ADR-0043), so this adds a regression test that proves that precedence even when a repository-controlled agent-browser.json sits in that launch cwd, and dispatches the registry's tracked adjustment. Co-Authored-By: Claude Sonnet 5 Claude-Session: https://claude.ai/code/session_01Cx7P2HxDFUW3mtoqn5cqnv --- .../agentic-dependency-constraints.json | 5 ++-- tests/kit/ruflo-memory.test.mjs | 25 +++++++++++++++++++ 2 files changed, 28 insertions(+), 2 deletions(-) diff --git a/src/lib/hook-audit/agentic-dependency-constraints.json b/src/lib/hook-audit/agentic-dependency-constraints.json index bb7c2fd9..45f24535 100644 --- a/src/lib/hook-audit/agentic-dependency-constraints.json +++ b/src/lib/hook-audit/agentic-dependency-constraints.json @@ -1991,10 +1991,11 @@ "files": ["docs/adr/0043-managed-ruflo-browser-executor.md"] }, "adjustment": "Keep AGENT_BROWSER_CONFIG pointed at an ak-owned config on managed Ruflo MCP children until a released agent-browser stops launching repository-controlled executables from auto-discovered configuration.", - "status": "watching", + "status": "dispatched", "constraintIds": ["ruflo-agent-browser-compatibility-layer"], "history": [ - { "date": "2026-09-26", "event": "registered" } + { "date": "2026-09-26", "event": "registered" }, + { "date": "2026-10-26", "event": "dispatched", "note": "agent-browser 0.39.3 still auto-discovers repository config; ak dispatches the adjustment (a regression test pinning rufloMcpLaunch's AGENT_BROWSER_CONFIG precedence over a repository-controlled agent-browser.json at the launch cwd) on branch upstream/vercel-labs-agent-browser-1679. removalProof unmet: no released Ruflo artifact selects a replacement backend yet." } ] }, { diff --git a/tests/kit/ruflo-memory.test.mjs b/tests/kit/ruflo-memory.test.mjs index c9390e4b..ea992141 100644 --- a/tests/kit/ruflo-memory.test.mjs +++ b/tests/kit/ruflo-memory.test.mjs @@ -60,3 +60,28 @@ test('Claude mode keeps inherited component keys, sets ak\'s agent-browser confi test('an unknown launcher host is refused', () => { assert.throws(() => rufloMcpLaunch(os.tmpdir(), {}, { cfg: { agentBrowser: false }, host: 'cursor' }), /host/); }); + +// vercel-labs/agent-browser#1679: agent-browser auto-discovers a repository +// `agent-browser.json` from its working directory. Ruflo (and the +// agent-browser it shells out to) is started with cwd pinned at the +// repository root, so a repository-controlled config lives exactly where +// that discovery would find it. The launcher must still hand it only ak's +// own absolute AGENT_BROWSER_CONFIG, never the repository's file. +test('a repository-controlled agent-browser.json at the launch cwd is never trusted', (t) => { + const root = fs.mkdtempSync(path.join(os.tmpdir(), 'ak-ruflo-repo-browser-config-')); + t.after(() => fs.rmSync(root, { recursive: true, force: true })); + fs.mkdirSync(path.join(root, '.git')); + const repoConfig = path.join(root, 'agent-browser.json'); + fs.writeFileSync(repoConfig, JSON.stringify({ executablePath: '/tmp/attacker-controlled' })); + const canonical = fs.realpathSync(root); + + const launch = rufloMcpLaunch(root, {}, { cfg: { agentBrowser: true } }); + + assert.equal(launch.cwd, canonical, 'Ruflo still starts where the repository config file lives'); + assert.ok(path.isAbsolute(launch.env.AGENT_BROWSER_CONFIG)); + assert.notEqual( + path.resolve(launch.env.AGENT_BROWSER_CONFIG), + path.resolve(repoConfig), + 'ak\'s trusted config is handed to the MCP child, never the repository-controlled file', + ); +});