An agentic browser harness: an AI side panel & orb in your own logged-in Chrome, Edge, Arc, Brave or even Firefox run by the agent/subscription you already use (Claude Code, Codex, Antigravity). Free, open source, no API key. Also an MCP server.
TypeScript agentic-browseragentic-browsingagy-cliaiai-agentai-browser-extensionai-toolsbrave-extensionbrowser-agentbrowser-automationbrowser-extensionbrowser-usebrowserskillchrome-extensionclaude-codecodexfirefox-addonmcp-servernanobrowserweb-automation
fix(agents): answer a Codex tool call the daemon cannot be reached for as failed, in the CODE: message shape every tool failure takes
Shahriarb6eb8b5c05d2
diff --git a/src/daemon/agent/runners/codex-app-server.test.ts b/src/daemon/agent/runners/codex-app-server.test.tsindex c9e8edc..f61c7a1 100644--- a/src/daemon/agent/runners/codex-app-server.test.ts+++ b/src/daemon/agent/runners/codex-app-server.test.ts@@ -166,6 +166,17 @@ describe('a recorded turn', () => {expect([calls.filter(([signal]) => signal === 'text'), vi.mocked(tools.call).mock.calls.length]).toEqual([[], 1]);});+ test('a call the daemon cannot be reached for is answered as failed, not left waiting', async () => {+ const { written, tools, feed } = hold({ bin: 'codex-unreachable' });+ vi.mocked(tools.call).mockRejectedValueOnce(new Error('socket closed'));+ await feed({ id: 5, method: 'item/tool/call', params: { tool: 'page_echo', arguments: {} } });+ expect(written.at(-1)).toEqual({+ jsonrpc: '2.0',+ id: 5,+ result: { contentItems: [{ type: 'inputText', text: 'DAEMON_UNREACHABLE: Error: socket closed' }], success: false },+ });+ });+test('a web search opens a row when it starts and closes it when it ends', async () => {const { calls, feed } = hold({ bin: 'codex-search' });await feed(response(1), response(2), response(3));diff --git a/src/daemon/agent/runners/codex-app-server.ts b/src/daemon/agent/runners/codex-app-server.tsindex 4322e68..bf6e6e3 100644--- a/src/daemon/agent/runners/codex-app-server.ts+++ b/src/daemon/agent/runners/codex-app-server.ts@@ -98,17 +98,18 @@ export function appServerTurn(context: StreamContext, turn: AppServerTurn): Conv.catch((error: unknown) => sink.fail('AGENT_FAILED', `Browsentic could not list its browser tools for Codex: ${String(error)}`));};- const answerToolCall = (io: ConversationIO, sink: StreamSink, id: Message['id'], params: Message['params']) => {+ // A call the daemon cannot be reached for is answered as failed, in the `CODE: message` shape every tool failure takes.+ const answerToolCall = (io: ConversationIO, id: Message['id'], params: Message['params']) => {const tool = String(params?.tool ?? '');const args = (params?.arguments ?? {}) as Record<string, unknown>;context.tools().then((host) => host.call(tool, args))- .then((reply) => io.write({ jsonrpc: '2.0', id, result: toolResult(reply) }))- .catch((error: unknown) => {- io.write({ jsonrpc: '2.0', id, result: { contentItems: [{ type: 'inputText', text: `TOOL_FAILED: ${String(error)}` }], success: false } });- if (!holding) sink.fail('AGENT_FAILED', String(error));- });+ .then(+ (reply) => io.write({ jsonrpc: '2.0', id, result: toolResult(reply) }),+ (error: unknown) =>+ io.write({ jsonrpc: '2.0', id, result: { contentItems: [{ type: 'inputText', text: `DAEMON_UNREACHABLE: ${String(error)}` }], success: false } }),+ );};const onResponse = (message: Message, io: ConversationIO, sink: StreamSink) => {@@ -227,7 +228,7 @@ export function appServerTurn(context: StreamContext, turn: AppServerTurn): Conv} catch {return;}- if (message.method === 'item/tool/call' && message.id !== undefined) return answerToolCall(io, sink, message.id, message.params);+ if (message.method === 'item/tool/call' && message.id !== undefined) return answerToolCall(io, message.id, message.params);// Anything else it asks of the client — an approval, a question for the user — has no one to answer it.if (message.method && message.id !== undefined) {return io.write({ jsonrpc: '2.0', id: message.id, error: { code: -32601, message: `Browsentic does not answer ${message.method}` } });