Add opt-in Buck2 capture lifecycle hooks and invocation isolation - #2791
Merged
MarcusSorealheis merged 2 commits intoSep 25, 2026
Merged
MarcusSorealheis merged 2 commits into
MarcusSorealheis merged 2 commits into
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
MarcusSorealheis
marked this pull request as ready for review
September 25, 2026 05:05
MarcusSorealheis
force-pushed
the
buck2-worker-file-explorer
branch
from
September 25, 2026 06:30
75b674f to
7958994
Compare
Keep overlapping Buck2 invocations on separate executions while sharing completed cache results. Hold action files through bounded collector finalization. Make Linux path validation portable and resolve test helpers through PATH for Nix coverage. Use Linux path semantics on all configuration-test hosts, resolve test helper tools from the test environment for Nix coverage, and correct the invocation-isolation lint and documentation link.
MarcusSorealheis
force-pushed
the
buck2-worker-file-explorer
branch
from
September 25, 2026 07:12
7958994 to
043c38a
Compare
modernmedici
approved these changes
Sep 25, 2026
| pub failure_message_template: String, | ||
| } | ||
|
|
||
| /// Opt-in file capture for the actual container executing a Buck2 action. |
This branch was successfully deployed
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.
What and why
Action wrappers cannot reliably save final worker files when cancellation or a timeout kills the wrapper before cleanup. Add opt-in Buck2 capture lifecycle hooks for single-use Linux workers: forward invocation metadata, start an operator-supplied collector, and wait for bounded finalization before deleting action files. File collection, authorization, storage, and retention remain the collector's responsibility. An opt-in Execution setting separates identical in-flight actions across Buck2 invocations while preserving completed action-cache hits.
How was this verified?
Ran the affected configuration, worker, scheduler, service, utility, and generated-protocol Bazel tests on macOS. The new overlap regressions pass for both memory and Redis scheduler storage, and completed-result cache hits remain shared. Corrected portable Linux-path validation for Windows and PATH-based helper lookup for Nix coverage; both affected unit-test suites pass locally, with cross-platform CI rerunning. The new regression runs real subprocesses through success, failure, cancellation, and timeout, holds the collector's acknowledgement open, and verifies that action files remain until final capture finishes. It also checks disconnect draining and confirms that Bazel never launches the collector. A separate test checks bounded shutdown of an unresponsive helper.
Regenerated the configuration reference and checked documentation anchors, configuration snippets, spelling, and prose. Linux integration with a real collector remains to be verified; this PR is a draft while that validation is pending.
Risk
Disabled by default. Enabling capture requires a fresh execution container per action; configuration rejects reusable workers, entrypoint wrappers, and separate action mount namespaces. Finalization can delay cleanup by the configured budget plus ten seconds. Capture failure is logged without changing the action's execution result.
The worker protocol gains an optional request-metadata field. Assignments without Buck2 invocation metadata skip capture. The helper and its ingest service must enforce access control and credential exclusions; this hook does not make action processes a security boundary.
AI assistance
I had help from several OpenAI models to draft and revise the implementation, tests, and documentation. I directed the feature scope and architecture, and the coding agent ran the checks described above.
This change is