Skip to content

Reapi/worker fixes - #3224

Open
rajputdivyanshu81 wants to merge 7 commits into
TraceMachina:mainfrom
rajputdivyanshu81:reapi/worker-fixes
Open

rajputdivyanshu81 wants to merge 7 commits into
TraceMachina:mainfrom
rajputdivyanshu81:reapi/worker-fixes

Conversation

@rajputdivyanshu81

@rajputdivyanshu81 rajputdivyanshu81 commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

What and why

Two REAPI conformance fixes for the worker, grouped after the feedback about review cost on #3162. The do_not_cache part of this PR already landed separately as #3159, and the empty-executable change was dropped because #3191/#3242 handle empty files on main (macOS only, by design). The plan is in #3117.

  • Non-OK results are never cached. REAPI ExecuteResponse.status: "If the status code is other than OK, then the result MUST NOT be cached." Under success_only, a timed-out action that handled SIGTERM and exited 0 was cached with DEADLINE_EXCEEDED, and failures_only cached errored results. The Action Cache upload now also requires that the result has no error. The historical results store, which is not the Action Cache, is unchanged.
  • Parents of output_directories are created. REAPI: "Directories leading up to the output directories ... are created by the worker prior to execution". This was done for output_files and output_paths only, so v2.0 clients using output_directories could hit a missing parent.

Refs #3117

How was this verified?

New tests result_with_error_status_is_never_cached_in_action_cache and ensure_output_directories_parents_are_created_test each fail without their fix. At this branch's tip, on current main, these pass locally (Windows, cargo): running_actions_manager_test (57) and local_worker_test (26). cargo check --workspace --tests --bins is clean.

Risk

Low. Only results that carry an error stop being cached, which the spec requires; the worker also creates directories the spec says must exist.

AI assistance

Claude Code found these during a REAPI conformance audit, wrote the changes and tests, and ran them. I reviewed every line.

🤖 Generated with Claude Code

rajputdivyanshu81 and others added 4 commits November 18, 2026 16:38
REAPI Action.do_not_cache: "the Action's result cannot be cached". TraceMachina#3135
made the execution server skip the cache lookup and in-flight merging for
such actions, but the worker still uploaded their results to the Action
Cache. The worker already fetches the Action itself, so it now reads the
flag there, carries it on the running action, and skips the AC upload. No
worker API change is needed. The historical-results upload, a separate
debugging record, and the ExecuteResponse message are unchanged.

Refs TraceMachina#3110, TraceMachina#3117

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
REAPI ExecuteResponse.status: "If the status code is other than OK, then
the result MUST NOT be cached." The worker decided from the exit code
alone, so under success_only (the default) a timed-out action that handled
SIGTERM and exited 0 was cached with a DEADLINE_EXCEEDED status, and
failures_only cached errored results too. The Action Cache upload now also
requires that the result has no error. The historical results store, which
is not the Action Cache, is unchanged.

Refs TraceMachina#3117

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The directory cache wrote a zero-length input file and returned before the
executable handling, so an empty FileNode with is_executable (an empty stub
script or wrapper) was materialized without +x. REAPI FileNode.is_executable
says the file is executable; its size does not change that. The empty-file
shortcut now sets the same read-only mode as any other private copy, via a
helper shared with the non-empty path.

Refs TraceMachina#3117

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
REAPI Command.output_directories: "Directories leading up to the output
directories (but not the output directories themselves) are created by the
worker prior to execution". The worker did this for output_files and
output_paths only, so a v2.0 client using output_directories could hit a
missing parent directory.

Refs TraceMachina#3117

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@vercel

vercel Bot commented Nov 18, 2026 •

Copy link
Copy Markdown

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

Project Deployment Actions Updated
nativelink Ready Ready Preview Nov 22, 2026 1:38pm UTC
nativelink-aidm Ready Ready Preview Nov 22, 2026 1:38pm UTC

Request Review

Resolve conflicts in directory_cache.rs, running_actions_manager.rs and
protocol-api.mdx. Take upstream's macOS-gated empty-file mode (TraceMachina#3242) and
its do_not_cache docs (TraceMachina#3159); keep this branch's error-status rule for
the Action Cache and the shared set_input_file_mode helper.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
TraceMachina#3191 and TraceMachina#3242 now set the mode of empty input files in the directory
cache on macOS only, a deliberate choice to avoid a chmod per empty file
on Linux. Restore main's directory_cache.rs and its test, and remove the
docs paragraph that described the dropped behavior. This PR is now the
non-OK caching fix and the output_directories parents fix.

Refs TraceMachina#3117

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

This branch was successfully deployed

2 active deployments
Preview – nativelink — 282e24fe Deployed Nov 22, 2026 by vercel[bot]
Preview – nativelink-aidm — 282e24fe Deployed Nov 22, 2026 by vercel[bot]
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