Repository navigation
Retry finished-session uploads from desktop and terminal activity - #129
Conversation
|
The herd is fixed, 8 agents ticking at once now send each queued session once, and latency stays bounded. One thing left: if a session's upload always takes longer than the 1.2s hook budget, the drain stops on it every time, so sessions behind it never go out and it gets resent on every tick. Could the drain try the least recently attempted session first, or move on to the next one after a timeout? |
…not starve the queue
|
Good point. Went with least recently attempted first in fe5a4ee. The drain records when it last tried each queued session (in |
Finished sessions could stay local indefinitely after an interrupted process or a failed upload. The reaper finalized sessions without sending them, and live activity only submitted the current session when it had new shipped work. Conversations and terminal tools can stay open for days, leaving real work off the leaderboard.
This combines #124 and #125, covers terminal wrappers, and fixes the concurrency issues found during review:
submit.lock, without holding the database lock over network requests. Busy contenders return immediately. Dead owners recover through a separate breaker gate with a holder recheck; live owners are never evicted by age.Validation: the complete local suite passes 169/169. Tests cover six synchronized agents uploading each queued session once, same-process overlap, database writes during network waits, 200/400 responses to snapshots corrected in flight, reopening a later queued session, 429 retry, dead/live/pidless owners, legacy duplicate rows, and a child exiting during a background flush. Nine concurrency regressions fail against the previous PR head.
Combined validation: all three revised branches merge cleanly in the order below and pass 192/192 local tests together.
Merge order: 1. #127 (storage) → 2. #129 (this PR) → 3. #128 (ZCode). This replaces the closed #124 and #125. Retries remain opportunistic and need a later session event, wrapper poll or CLI command; no daemon is introduced.