Repository navigation
perf(core): tail-read the journal for the latest outcome - #157
Merged
Merged
Conversation
Listing artifact runs parsed every line of every lab run's actions.jsonl to find the last outcome record. Scan the journal backwards in bounded chunks instead, through the verified run directory, keeping the torn-tail, corrupt journal and non-evidence rules of a full read. The write path and the journal format are unchanged. Refs #147
Open the journal with O_NONBLOCK so a FIFO left in its place cannot make the open wait for a writer and hang every listing; the descriptor type check still rejects it. Validate every line of each scanned window instead of returning at the first match, so corruption before an outcome inside the byte budget keeps reporting nothing, as a full read does. Open the run directory through a new catalog operation that checks the root and run identities recorded at listing time, so a directory replaced afterwards cannot attach its outcome to another run's manifest. Tests cover a writerless FIFO, corruption before the outcome, the byte budget as a deterministic bound on how far the scan reads, and the outcome lookup in the existing directory-replacement regression. The wall-clock assertion in the near-cap test is gone in favour of that byte bound. Refs #147
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.
Listing artifact runs parsed every line of every lab run's actions.jsonl to
find the last outcome record. Scan the journal backwards in bounded chunks
instead, through the verified run directory, keeping the torn-tail, corrupt
journal and non-evidence rules of a full read. The write path and the journal
format are unchanged.
Run listings (
artifacts list,artifact_list, thepickforge://runsresource) no longer parse each run's wholeactions.jsonlto find the latest outcome.findLastActionInwalks the journal backwards in 64 KiB chunks through the run's path-confinedDirHandle, reusingparseJournalSegmentfor validation, with a 1 MiB budget (16 times the per-record cap). A torn last line is ignored as before; a complete invalid line stops the scan and the listing reports no outcome, preserving the corrupt-journal rule; runs without evidence still return null. Documented divergence: an outcome more than 1 MiB before the end of the journal is not seen by listings (the journal stays authoritative for reports).Validation on this branch: targeted vitest files (core evidence and outcome, mcp-server, cli commands: 370 tests), oxlint, complexity-gate, typecheck; the near-cap test asserts the lookup finishes under 500 ms.
Author: Opus worker. Reviewer: separate Astra review.
Closes #147