Repository navigation
fix(desktop): inbox persistence order, desktop-only overdue sweep, and ungated pickup windows - #8685
Conversation
…ed pickup windows - The overdue listing and the per-call deadline read only consider desktop tool calls, and the settlement checks the call is one the desktop runs, so a bound run's workflow call or Sim-files VFS read is never failed with the desktop's not-started result. - The cron scans only runs inside the inbox's horizon, oldest calls first, within its batch limit. - Recording a decision clears the pickup deadline only for a call that was gated; a call that was never gated keeps the window it was offered with.
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
|
@cubic-dev-ai review this PR |
@waleedlatif1 I have started the AI code review. It will take a few minutes to complete. |
There was a problem hiding this comment.
All reported issues were addressed across 5 files
Reply with feedback, questions, or to request a fix.
Fix all with cubic | Turn on auto-fix | Re-trigger cubic
There was a problem hiding this comment.
All reported issues were addressed across 5 files
Requires human review: Auto-approval blocked because this review re-detected 1 unresolved issue already reported by Cubic.
Turn on auto-fix | Re-trigger cubic
|
…und it by deadline The sweep's tool-name filter admitted read, grep and glob calls on Sim's own files, which the settlement then skipped, so enough of them could fill every batch and starve real desktop calls. Queries now use the SQL form of isDesktopToolCall (a desktop tool by name, or a VFS read of a granted local folder) before their limit. The sweep's horizon is now on the deadline that lapsed, not on the run's start: Sim does not enforce a run's wall clock, so a long-lived run's recently overdue call is still settled.
|
@cubic-dev-ai review this PR |
@waleedlatif1 I have started the AI code review. It will take a few minutes to complete. |
The inbox ordered calls by created_at, then tool_call_id. Calls of one turn can be persisted in the same millisecond, and then the tie broke on random ids: a device could run a click before the type the model emitted first. Calls now carry persist_seq, a strictly increasing number assigned on insert (pre-persist writes them in emission order), and the inbox and the overdue sweep order by it. The migration adds the column without a default and then sets the default, so existing rows are not rewritten; rows persisted before it have no position and sort first, as the oldest.
|
@cubic-dev-ai review this PR |
@waleedlatif1 I have started the AI code review. It will take a few minutes to complete. |
…op tool names as const A 24 h horizon on the lapsed deadline meant a call the backstop missed for a day was never settled. The sweep starts from the few unsettled (pending or running) calls in persistence order, so it needs no horizon to stay small. The desktop tool names are a literal array declared as const, and the lookup set is derived from it.
|
@cubic-dev-ai review this PR |
@waleedlatif1 I have started the AI code review. It will take a few minutes to complete. |
There was a problem hiding this comment.
No issues found across 12 files
Confidence score: 5/5
- Automated review surfaced no issues in the provided summaries.
- No files require special attention.
You've manually re-run cubic several times on this PR. Each manual re-review checks the full PR again and counts toward your usage quota. To preserve your usage limits, we recommend letting cubic automatically review new commits.
Turn on auto-fix | Re-trigger cubic
|
@cubic-dev-ai review this PR |
@waleedlatif1 I have started the AI code review. It will take a few minutes to complete. |
There was a problem hiding this comment.
No issues found across 13 files
Confidence score: 5/5
- Automated review surfaced no issues in the provided summaries.
- No files require special attention.
You've manually re-run cubic several times on this PR. Each manual re-review checks the full PR again and counts toward your usage quota. To preserve your usage limits, we recommend letting cubic automatically review new commits.
Turn on auto-fix | Re-trigger cubic
Summary
Follow-up to #8650: three findings from its final review, plus an ordering bug in the desktop inbox.
isDesktopToolCallbefore their limits: a desktop tool by name, or aread/grep/globunderuser-local/. A pending workflow call, or a VFS read of Sim's own files, on a device-bound run is never failed with the desktop's "did not pick it up" result, and such rows can't fill a sweep batch.settleOverdueDesktopToolCallalso checksisDesktopToolCallon the call itself.created_at, thentool_call_id. Calls of one turn can be persisted in the same millisecond, and then the tie broke on random ids, so a device could run a click before the type the model emitted first. Calls now carrypersist_seq, a strictly increasing number assigned on insert; pre-persist writes calls in emission order. The inbox and the overdue sweep order by it.check:migrationspasses.created_at, with ids that sort in reverse, so the timestamp and the id both give the wrong order.recordToolPermissionDecisionclearedpickup_deadline_atfor any call. It now clears it only whenpermission_requested_atis set, so a call that was never gated keeps the window it was offered with. A decision posted for an ungated call is still recorded, as before; only the deadline is left alone. This avoids refusing decisions for calls gated before the marker existed, which fix(mothership): refuse desktop claims for unapproved or stopped calls #8643's predicate also accepts.Test plan
bound-turn.integration.ts:run_workflowcall and its Sim-filesreadcall both survive the stale-execution cron;isDesktopToolCallcheck fails the Sim-files test, clearing the deadline unconditionally fails the ungated-call test, and the batch-starvation and old-run tests fail on the previous head.executor.integration.ts: three calls persisted in the same millisecond are listed in persistence order. Red when the inbox orders by timestamp, then id.lib/desktop,lib/mothership/tools/clientandlib/mothership/async-runspass (101 tests).lint,type-check,check:audits,check:migrations,docs-manifest:check, block registry anddrizzle-kit generatepass. Inbun run test, the one failure was the route-inventory test timing out under machine load; it passes run on its own.