Skip to content

The all-in-one local AI studio for your desktop: chat, image and video generation and a coding agent in one free, open source app. Windows and Linux. No Docker, no terminal, no cloud required.

v2.5.0 polish: fix 6 coding-agent tools broken by a flat-vs-wrapped bridge arg mismatch

purpledf769c57b805
diff --git a/src/api/agents/__tests__/bg-tasks.test.ts b/src/api/agents/__tests__/bg-tasks.test.ts
index 352945b7..cdba0e59 100644
--- a/src/api/agents/__tests__/bg-tasks.test.ts
+++ b/src/api/agents/__tests__/bg-tasks.test.ts
@@ -27,9 +27,13 @@ describe('bgStart', () => {
backendCall.mockResolvedValueOnce({ id: 'abc' })
await bgStart({ command: 'sleep 5', cwd: '/tmp', shell: 'bash' })
expect(backendCall).toHaveBeenCalledOnce()
+ // Payload MUST be wrapped in `{ args: … }` — the Rust shell_task_start
+ // command takes a single `args: Value` param (StartArgs). A flat payload is
+ // rejected at the bridge ("missing required key args"). Regression guard for
+ // the 2026-06-02 fix that revived the background-shell tools.
expect(backendCall.mock.calls[0]).toEqual([
'shell_task_start',
- { command: 'sleep 5', cwd: '/tmp', shell: 'bash' },
+ { args: { command: 'sleep 5', cwd: '/tmp', shell: 'bash' } },
])
})
})
@@ -49,7 +53,9 @@ describe('bgStatus / bgKill / bgList — JSON shape pass-through', () => {
}
backendCall.mockResolvedValueOnce(payload)
expect(await bgStatus('abc')).toEqual(payload)
- expect(backendCall.mock.calls[0]).toEqual(['shell_task_status', { id: 'abc' }])
+ // Wrapped in `{ args: … }` — shell_task_status takes a single `args: Value`
+ // (IdArgs). Flat `{ id }` is rejected by the bridge.
+ expect(backendCall.mock.calls[0]).toEqual(['shell_task_status', { args: { id: 'abc' } }])
})
it('bgKill returns the cancelled flag', async () => {
diff --git a/src/api/agents/__tests__/repo-map.test.ts b/src/api/agents/__tests__/repo-map.test.ts
index 588e62fa..46561ab4 100644
--- a/src/api/agents/__tests__/repo-map.test.ts
+++ b/src/api/agents/__tests__/repo-map.test.ts
@@ -30,17 +30,21 @@ describe('fetchRepoMap', () => {
limit: 50,
})
expect(backendCall).toHaveBeenCalledOnce()
+ // Payload MUST be wrapped in `{ args: … }` — the Rust `repo_map` command
+ // takes a single `args: Value` param. A flat payload is rejected at the
+ // bridge ("missing required key args"). Regression guard for the 2026-06-02
+ // fix that revived codexRepoMapEnabled.
expect(backendCall.mock.calls[0]).toEqual([
'repo_map',
- { workingDirectory: '/Users/me/repo', query: 'auth', limit: 50 },
+ { args: { workingDirectory: '/Users/me/repo', query: 'auth', limit: 50 } },
])
})
it('defaults the limit to 20 when caller omits it', async () => {
backendCall.mockResolvedValueOnce({ files: [], count: 0 })
await fetchRepoMap({ workingDirectory: '/r' })
- const args = backendCall.mock.calls[0][1] as Record<string, unknown>
- expect(args.limit).toBe(20)
+ const payload = backendCall.mock.calls[0][1] as { args: Record<string, unknown> }
+ expect(payload.args.limit).toBe(20)
})
it('coerces a non-array files field into an empty array', async () => {
diff --git a/src/api/agents/bg-tasks.ts b/src/api/agents/bg-tasks.ts
index 9554fb3c..e5860329 100644
--- a/src/api/agents/bg-tasks.ts
+++ b/src/api/agents/bg-tasks.ts
@@ -23,23 +23,32 @@ export async function bgStart(input: {
shell?: string
}): Promise<{ id: string }> {
if (!input.command?.trim()) throw new Error('command is required')
+ // The Rust bg_tasks commands take a SINGLE `args: serde_json::Value` param
+ // (manually deserialized into StartArgs/IdArgs) — unlike `shell_execute`,
+ // which uses flat params. So every payload MUST be wrapped in `{ args: … }`.
+ // Sending the fields top-level (as the flat convention does) makes Tauri
+ // reject the call with "missing required key args" — which silently broke
+ // shell_execute_background / shell_task_status / _kill / _list for every
+ // model (confirmed live 2026-06-02 via the Tauri bridge).
return backendCall<{ id: string }>('shell_task_start', {
- command: input.command,
- cwd: input.cwd,
- shell: input.shell,
+ args: {
+ command: input.command,
+ cwd: input.cwd,
+ shell: input.shell,
+ },
})
}
export async function bgStatus(id: string): Promise<BgTaskStatus> {
- return backendCall<BgTaskStatus>('shell_task_status', { id })
+ return backendCall<BgTaskStatus>('shell_task_status', { args: { id } })
}
export async function bgKill(id: string): Promise<{ ok: boolean; cancelled: boolean }> {
- return backendCall<{ ok: boolean; cancelled: boolean }>('shell_task_kill', { id })
+ return backendCall<{ ok: boolean; cancelled: boolean }>('shell_task_kill', { args: { id } })
}
export async function bgList(): Promise<BgTaskListResult> {
- return backendCall<BgTaskListResult>('shell_task_list', {})
+ return backendCall<BgTaskListResult>('shell_task_list', { args: {} })
}
/** Renders a status payload as a one-line summary for the model / UI. */
diff --git a/src/api/agents/repo-map.ts b/src/api/agents/repo-map.ts
index 7684c47c..ddd3ffe8 100644
--- a/src/api/agents/repo-map.ts
+++ b/src/api/agents/repo-map.ts
@@ -27,10 +27,18 @@ export async function fetchRepoMap(input: FetchRepoMapInput): Promise<RepoMapRes
if (!input.workingDirectory) {
return { files: [], count: 0 }
}
+ // The Rust `repo_map` command takes a SINGLE `args: serde_json::Value` param
+ // (deserialized into RepoMapArgs) — so the payload MUST be wrapped in
+ // `{ args: … }`. Sending the fields top-level makes Tauri reject the call
+ // with "missing required key args", which silently disabled the whole
+ // codexRepoMapEnabled pre-fetch (the failure is swallowed by a try/catch in
+ // useCodex → log.warn → no repo map). Confirmed live 2026-06-02.
const out = await backendCall<RepoMapResult>('repo_map', {
- workingDirectory: input.workingDirectory,
- query: input.query,
- limit: input.limit ?? 20,
+ args: {
+ workingDirectory: input.workingDirectory,
+ query: input.query,
+ limit: input.limit ?? 20,
+ },
})
return {
files: Array.isArray(out.files) ? out.files : [],