Repository navigation
ARS audit: fix stuck parents and late-response race; cut redundant merge work - #264
Merged
Merged
Conversation
…rge work Bugs: - A Done merged version only counted toward completion with results > 0, so a merge whose results the blocklist removed entirely left the parent (watchdog-exempt) Running forever. Every Done merged version now counts. - /submit answered 400 on a query-store or fanout-enqueue failure but left the inserted parent Running forever, and as a cache leader held identical submits WAITING on it. It is now ended E/500 via lifecycle.fail_parent, which the fanout's no-children failure path now shares. - A child the watchdog timed out while premerge was processing its response was flipped back to Done and merged, possibly under a parent that had already completed. Premerge re-reads the child and rejects the late response; intake's terminal flips are conditional on Running (a child already handed to the merge is still flipped Done, so its merged version balances). Performance (merge path, behavior-preserving): - The fold no longer deep-copies both freshly decoded messages before merging (~2x faster fold on a 31 MB pair); goldens checked both ways. - Each merged version is encoded and written once instead of twice; the single save is retried before it is E/422. - Premerge saves a compact ranking (node bindings) per validated child, so ranker fusion stops decoding whole ARA responses on every fold; finished children with no results are skipped outright. - Query parameters are read once per drain, not once per fold. Documented in docs/ARS_PARITY_REGISTER.md (deviation 23 and three stuck-state rows). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01S2yuREkLYdATjDz3Goze6d
Codecov Report❌ Patch coverage is
Continue to review full report in Codecov by Harness.
🚀 New features to boost your workflow:
|
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.
An audit of the ARS from submit through fanout, premerge, merge and post-process. Three bugs fixed, four performance changes that leave the output the same.
Bugs
result_count > 0), so the counts never matched. Parents are exempt from the watchdog, so nothing ever ended the query. A finishedars-ars-agentchild now always counts, since every merged version folds exactly one result-bearing ARA child (completion.evaluate_completion). This was pinned upstream behaviour; the test is updated./submitleft an orphan parent Running forever. If storing the query or queuing the fanout failed, the client got a 400 but the parent row already inserted stayed Running. As a cache leader it also left identical submits WAITING on it. Submit now ends that parent E/500 through a newlifecycle.fail_parent, which the fanout's no-children failure path now shares.Performance (same output)
mergeMessages(..., copy_inputs=False)merges the freshly decoded inputs in place. On a synthetic 31 MB pair one fold went from 3.7s to 1.7s. A new test checks the goldens with the copy turned off.FINAL_SAVE_ATTEMPTS) before the version ends E/422.ars:ranking:<pk>, deleted when the tree completes. The fusion reads it, falls back to the full response when it is missing, and skips finished children with no results without loading anything.parametersare read once per drain, not once per fold.All of this is recorded in
docs/ARS_PARITY_REGISTER.md: deviation 23 for the performance work, and three rows under "Stuck or unbounded state" for the bugs.Tests
New tests cover:
fail_parentitselfcopy_inputs=FalseThe full unit suite passed locally (2,659 passed, 246 skipped). One test failed in that run because it stubbed
merge_onewith the old signature; I fixed it and re-ran the ARS and merge-lock tests, which passed. Skipped tests include those that need a live Postgres (SHEPHERD_TEST_PG_DSN).Noticed but not changed
?trace=1loads a message's full stored data just to show its query graph.query_event_subscribe,query_event_unsubscribeandget_statusdon't check thatpksis a list.Generated by Claude Code