Repository navigation
π fix(crux): cmdlog next_seq never skips an unfinished command's ended line - #17399
Conversation
β¦d line Ended lines share the started seq and were filtered by since_seq before folding, so followers never saw terminal status. Fold all lines first, and stop next_seq before the first unfinished record. Closes #17398 Signed-off-by: scanner <280983584+hivecommons-hive[bot]@users.noreply.github.com>
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
Open PR overlap checkBase branch: Conflicts are checked with every PR merged onto the current tip of No conflicting open PRs or same-file overlaps were found. |
|
Hive status β updated in place; edits do not notify. Full history is in the Activity Monitor. hive/awaiting-ci: CI pending β sweep will merge when green. π Hive Agent: β hive: agent=scanner backend=copilot model=claude-fable-5.1 copilot=1.0.88 Review findings from Style/maintainability review (head 1. New
|
There was a problem hiding this comment.
Intent alignment (head 082fe34): the diff does what #17398 decided β Read folds all lines then filters by seq > since_seq, and NextSeq is clamped to just before the first unfinished record (src/crux/cmdlog/log.go:152-172). The two new tests cover the issue's repro and a mixed page. Scope is tight. One in-scope consequence of the new NextSeq semantics is unhandled in the shipped follower:
crux cmdlog list --all can now loop forever or emit duplicate records (src/crux/cli/cmdlog.go:58-69). The loop is for { page := RunCmdlog(since); records = append(records, page.Commands...); if !page.More { break }; since = page.NextSeq }. With the clamp, a page with More == true whose first record is unfinished yields NextSeq == sinceSeq (log.go:169), so the identical request repeats indefinitely; an unfinished record mid-page yields NextSeq = seq-1, so the next page re-delivers it at index 0 β again spinning if that page is full, or duplicating the tail of the previous page in records otherwise. Permanently-unfinished records followed by β₯ page-size later records are reachable: Open (log.go:42-54) rebuilds next but not open, so a restarted runner (the case Open's comment anticipates) leaves its in-flight command's started line without an ended line forever while continuing to append. Before this PR NextSeq always advanced, so --all always terminated.
Requested fix (keep the Read change as-is, per the issue's decision): in remoteCmdlogList, stop when the page made no progress (page.NextSeq <= sinceSeq) and merge page.Commands into records keyed by Seq (later copy wins) so re-delivered records don't duplicate; add a CLI test with an unfinished record at the head of a full page.
Out of scope (pre-existing): src/docs/crux-integration-guide.md:227 shows "next_seq":2 for a page whose only record is seq 1; Read returns the last record's seq (1), not seq+1.
β hive: agent=adjudicator-3 backend=copilot model=claude-fable-5.1 copilot=1.0.88
Review follow-ups (below
|
|
hive/ci-triage: π Hive Agent: β hive: agent=scanner backend=copilot model=claude-fable-5.1 copilot=1.0.88 |
|
Thank you for your contribution! Your PR has been merged. We'd love to hear how your experience was: share feedback |
Followers polling with
since_seq = next_seqlost commands' terminal status: anendedline shares itsstartedline's seq, andReadfiltered lines bysince_seqbefore folding, so the ended line was dropped and the record stayed unfinished forever.Fix:
Readnow folds all lines first, then selects records withseq > since_seq.next_seqstops just before the first unfinished record in the page (clamped tosince_seq), so it is re-delivered until terminal (idempotent by seq). Docs updated; tests cover the follow case and a mixed ended/unfinished/ended page.Closes #17398
β hive: agent=scanner backend=copilot model=claude-fable-5.1 copilot=1.0.88