Repository navigation
fix(runtime): stop chat-usage test stranding active tasks that flip sweeper tests (CHE-1810) - #278
Merged
Merged
Conversation
added 2 commits
October 16, 2026 04:32
This was referenced Oct 16, 2026
congvc-bot-x99 Bot
pushed a commit
that referenced
this pull request
Oct 16, 2026
Brings the CHE-1810 runtime sweeper fix (PR #278).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Status
Ready for Cheese's review and merge. Test cleanup fix only. No product code.
Conditions
Change
TestChatSessionUsageRefusesCrossWorkspaceLikeSessionGetregisters a cleanup that deletes thechat_sessionbefore the seed's own cleanup runs.agent_task_queue.chat_session_idisON DELETE SET NULL, so the seededrunninganddispatchedtasks keep their rows with no chat session. The seed cleanupDELETE ... WHERE chat_session_id = $1then matches nothing.RefreshAgentStatusFromTasksreportsworkingwhen an agent has anydispatchedorrunningtask. The sweeper testsTestRefreshAgentStatusFromTasks,TestSweepStaleTasksReconcileAgentStatusandTestSweepDispatchedStaleTaskpick the integration agent withLIMIT 1and noORDER BY, so they hit the leaked agent only on some runs.server/cmd/server/chat_usage_test.go.Evidence
44e3cf529is tests only. It addsTestChatSessionUsageCrossWorkspaceCleanupLeavesNoActiveTasks. Against its parent it fails on the stated behavior:758c5cecdis the fix. The same test passes.go test -race -run TestChatSessionUsage ./cmd/server: 8 PASS.f37d08ba1, full package./cmd/serverwith-race, default order, my disposable database: 6 of 12 runs failed. Each failing run listed one to three of the sweeper tests above, with the messages in CHE-1810. 9 of those 12 runs used a binary with extra logging in the failure path only, which does not change test behavior.758c5cecd, same command, 6 runs: 6 PASS, 0 failures.runningordispatchedtask with no issue and no chat session. TheDELETE FROM chat_sessionrows were the stranded tasks. The other writers were cleaned by their own tests.pgvector/pgvector:pg17in a throwaway container on a loopback port, migrated withgo run ./cmd/migrate up. No live profile and no production database was used./tmpfiles are removed, and the port is closed.Verification update — 2026-10-16
f37d08ba1f61610d2266a05ee3ee4a353bf94157, head758c5cecd0e33dd9cf111e1e658e3f2ffd96e140.backend-testspassed.8ac3f457-31c1-4640-8d1a-ad0d36b55e2bwas unavailable. Both selected files failed before review with provider HTTP 401/503/403 errors and 0 tokens. This is not a clean OCR result. The signed reviewer records the non-OCR fallback and all P0/P1 dispositions.server/cmd/server/chat_usage_cleanup_test.go:36does not checkrows.Err(). No correction is included at this reviewed head.Review report and OCR receipt: CHE-1810 comment
01a14221-4696-7135-a049-c9abeb802bba.Reviewer: x99-agy-gemini (gemini-3.8-flash-high, Google; independent non-author, different-lab from x99-claude-sonnet/Anthropic).
Signed: 2026-10-16 07:35 ICT — PASS, non-OCR fallback.
STE advisory receipt: passive-voice warnings=true positives (9). Synonym-rotation=false positive (cleanup terms).
Changelog: none
Refs CHE-1810