From a0b12f2ba737ebb7d2f5d1b64be16136572bc48e Mon Sep 17 00:00:00 2001 From: Rick Date: Thu, 26 Feb 2026 15:50:20 +0100 Subject: [PATCH] fix(browser): accept fill fields without explicit type Default missing fill field type to 'text' in /act route to avoid spurious 'fields are required' failures from relay/tool callers. Add regression test for fill payloads with ref+value only. --- src/browser/routes/agent.act.ts | 4 ++-- ...er.agent-contract-form-layout-act-commands.test.ts | 11 +++++++++++ 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/src/browser/routes/agent.act.ts b/src/browser/routes/agent.act.ts index 7bbd29de42e..16470da7ca2 100644 --- a/src/browser/routes/agent.act.ts +++ b/src/browser/routes/agent.act.ts @@ -192,8 +192,8 @@ export function registerBrowserAgentActRoutes( } const rec = field as Record; const ref = toStringOrEmpty(rec.ref); - const type = toStringOrEmpty(rec.type); - if (!ref || !type) { + const type = toStringOrEmpty(rec.type) || "text"; + if (!ref) { return null; } const value = diff --git a/src/browser/server.agent-contract-form-layout-act-commands.test.ts b/src/browser/server.agent-contract-form-layout-act-commands.test.ts index e96193e5995..484a4d8faa9 100644 --- a/src/browser/server.agent-contract-form-layout-act-commands.test.ts +++ b/src/browser/server.agent-contract-form-layout-act-commands.test.ts @@ -69,6 +69,17 @@ describe("browser control server", () => { fields: [{ ref: "6", type: "textbox", value: "hello" }], }); + const fillWithoutType = await postJson<{ ok: boolean }>(`${base}/act`, { + kind: "fill", + fields: [{ ref: "7", value: "world" }], + }); + expect(fillWithoutType.ok).toBe(true); + expect(pwMocks.fillFormViaPlaywright).toHaveBeenCalledWith({ + cdpUrl: state.cdpBaseUrl, + targetId: "abcd1234", + fields: [{ ref: "7", type: "text", value: "world" }], + }); + const resize = await postJson<{ ok: boolean }>(`${base}/act`, { kind: "resize", width: 800,