Skip to content

🀯 LobeHub - Super-Agents on Your Team. Add super-agents to the chats your team already uses.They take on work by themselves and get better every week.

πŸ› fix(device-control): reject a failed remote git status instead of reporting it clean (#22595)

Arvin Xuc7af7f762b65
diff --git a/packages/device-control/src/__tests__/dispatch.test.ts b/packages/device-control/src/__tests__/dispatch.test.ts
index e444c47962b..075c54376a8 100644
--- a/packages/device-control/src/__tests__/dispatch.test.ts
+++ b/packages/device-control/src/__tests__/dispatch.test.ts
@@ -320,6 +320,14 @@ describe('executeDeviceRpc', () => {
expect(Array.isArray(result)).toBe(true);
});
+ it('rejects a failed git status instead of reporting a clean working tree', async () => {
+ // Not a git repo β†’ `git status` fails. The client persists this overlay, so
+ // an empty result would wipe every cached dirty marker as "clean".
+ await expect(
+ executeDeviceRpc('getGitWorkingTreeFiles', { path: root }, makeDeps()),
+ ).rejects.toThrow();
+ });
+
it('routes moveLocalFiles to the shared local-file-shell impl', async () => {
const oldPath = path.join(root, 'move-src.txt');
const newPath = path.join(root, 'move-dst.txt');
diff --git a/packages/device-control/src/dispatch.ts b/packages/device-control/src/dispatch.ts
index b41a6ade849..1063502ec66 100644
--- a/packages/device-control/src/dispatch.ts
+++ b/packages/device-control/src/dispatch.ts
@@ -392,7 +392,10 @@ export const executeDeviceRpc = async (
}
case 'getGitWorkingTreeFiles': {
- return getGitWorkingTreeFiles((params as { path: string }).path);
+ // The client persists this overlay. A failed or timed-out `git status`
+ // must reject (the gateway answers the client with nothing), not report
+ // a confirmed clean working tree β€” same contract as the desktop GitCtr.
+ return getGitWorkingTreeFiles((params as { path: string }).path, { throwOnError: true });
}
case 'getGitWorkingTreePatches': {