Feat/task memory evidence pipeline - #75
Merged
Merged
Conversation
…d force-emit carry on wait_for match Two bug fixes for background job log handling: (1) Log-quota truncation now keeps the TAIL (newest output) instead of the head. The newest output is the most diagnostically useful for a job terminated due to log quota — errors, build failures, and recent status messages live there. Adds truncateLogToTail() which opens the file safely (O_NOFOLLOW) and rewrites the tail in place to avoid leaving a sparse/holey file behind (truncating a live append-only fd below its write offset is undefined per POSIX). (2) wait_for match consistency: when the needle is found in the pending partial line (lineCarry) that has not yet been emitted as a registry output event, force-emit the carry via flushJobLineCarry() so the returned events are consistent with matched: true. Without this, a needle in an unterminated partial line could be reported as matched while being absent from the returned events/outputText.
…it boundary Hoist the resolveSettlementTouchedPaths closure into a module-level helper with a typed job parameter, removing the duplicate definition inside checkJob. Correct the wait_for carry force-emit guard from 'needle fully inside carry' to 'needle depends on carry' so a needle spanning the chunk/carry boundary is still flushed and matched:true stays consistent with the returned events. Add two tests covering the boundary-span flush and the no-flush-when-fully-in-chunk cases.
Relocate the registryJobId field to right after jobId at the top of the BackgroundJob interface so the two id fields sit together, and trim the multi-line comment to a single concise line.
…p indirection Cross-session recovery and __registerJobForTest previously fell back to a fresh registry-allocated id on a collision, desyncing the adapter from the on-disk log/metadata filenames and making the caller's requested id unresolvable. Recovery now returns undefined and test registration now throws so the registry id, adapter Map key, jobId, and on-disk file names stay one and the same (single-id invariant); list-jobs accordingly emits entry.jobId directly instead of the adapter remap indirection.
…ish list-jobs startBackgroundJob's failed-spawn cleanup now unlinks the temp log only when this spawn created it (fail-closed removeFileIfPresent), so O_EXCL EEXIST or symlink-thrown errors leave another owner's openbuff-job-*.log untouched. Also renames listJobs' shadowing owner local to scopeOwner and merges its duplicate background-jobs imports.
Force a registry-issued jobId whose openbuff-<id>.log already exists so the O_EXCL create in startBackgroundJob throws EEXIST; asserts the failed-spawn cleanup preserves the foreign file (logFileCreatedByThisSpawn guard), locking in the reviewer-cleared security fix.
The background-job tests now kill their detached sleep 30 children in finally blocks guarded on jobId, so an assertion failure no longer leaks the process; the identical initTempGitRepo helpers in the SYNC and BACKGROUND dirty-delta describes are consolidated into one shared prefix-parameterized helper. Behavior asserted by every test is unchanged.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
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.
This change is