Skip to content

Feat/task memory evidence pipeline - #75

Merged
AnzoBenjamin merged 8 commits into
mainfrom
feat/task-memory-evidence-pipeline
Sep 7, 2026
Merged

Feat/task memory evidence pipeline#75
AnzoBenjamin merged 8 commits into
mainfrom
feat/task-memory-evidence-pipeline

Conversation

@AnzoBenjamin

@AnzoBenjamin AnzoBenjamin commented Sep 7, 2026

Copy link
Copy Markdown
Owner

This change is Reviewable

…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.
@vercel

vercel Bot commented Sep 7, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
openbuff Ready Ready Preview, v0 Sep 7, 2026 7:01am UTC

@AnzoBenjamin
AnzoBenjamin merged commit 3953380 into main Sep 7, 2026
16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant