Skip to content

Leave aborted-turn rows out of the pending count - #5

Open
uzayer wants to merge 1 commit into
tryatlas:mainfrom
uzayer:uzayer/pending-excludes-aborted-turns
Open

uzayer wants to merge 1 commit into
tryatlas:mainfrom
uzayer:uzayer/pending-excludes-aborted-turns

Conversation

@uzayer

@uzayer uzayer commented Oct 26, 2026

Copy link
Copy Markdown
Collaborator

Summary

 OutboxCounts
-  count every row by sync_state
+  count every row by sync_state, but for agent_message / tool_call
+  leave pending rows of aborted turns out (notAborted, same as Pending)

Pending never reads rows of an aborted turn (the desktop marks a turn aborted when the process died inside it), but OutboxCounts counted them. So atlas-cli status, serve and settings reported work as waiting to sync that never would, and the pending count could not reach zero. The desktop's health count has the same fix in pacifio/atlas#502.

Evidence

  • Before: atlas-cli status on a real store showed Sync: ok · 36295 sent, 99 pending, 0 failed. All 99 rows came from aborted turns, with sync_attempts = 0.
    After: the same store shows Sync: ok · 36390 sent, 0 pending, 0 failed.
  • TestAbortedTurnRowsAreNotCountedAsPending marks the fixture's turn aborted and asserts the pending count equals Pending().Len() (2). Without the fix it fails: pending count 4, outbox holds 2.
  • go vet is clean, and go test ./internal/capture/... ./cmd/... passes.

Merge Danger

Door: two-way

A read-only count change, with no writes and no schema change.

Blast Radius: small

The pending number in status, settings and serve's idle check.

Pending never reads rows of an aborted turn, but OutboxCounts counted them,
so `atlas-cli status` (and serve, settings) reported work as waiting to sync
that never would, and the pending count could not reach zero.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant