Skip to content

Fix Windows agent startup - #4762

Open
noise64 wants to merge 7 commits into
mainfrom
fix-windows-startup
Open

noise64 wants to merge 7 commits into
mainfrom
fix-windows-startup

Conversation

@noise64

@noise64 noise64 commented Nov 30, 2026 •

Copy link
Copy Markdown
Contributor
  • resolves GOL-2217
  • resolves GOL-2220
  • resolves GOL-2222
  • resolves GOL-2221
  • The agent stream sends a close frame and drains within a bounded wait, including after the trigger listener times out. The local-close drain logs the peer's reply code and reason. Expected peer disconnects use INFO.
  • Open sandbox directories through directory capabilities. On Windows, skip unsupported directory flushes and set directory capture times before read-only permissions. Regular files set their capture time through an already-open handle. Sync the CLI checkpoint's parent directory only on Unix.
  • Persist a cached file before setting its read-only attribute. Keep the cache entry locked until protection and sync finish. Attempt removal if either step fails. If removal also fails, return Unavailable with both causes instead of aborting. The loader's cache directory owns the leftover until shutdown cleanup. Keep the existing deletion policy for initialized entries.
  • Keep sandbox creation failures recoverable after host repair, including failures with permanent storage causes. Preserve cleanup-failure reporting. Keep the existing outcome table for permanent errors during seeding and metadata observation, including failures of a pending update.
  • Clear the destination before every restore, including an empty destination. On Windows, validate and enumerate the same opened root. Pin ancestor directories against renames. Delete files and emptied directories by handle without changing attributes shared with outside hard links. Accept only symlink and mount-point reparse tags on opened entries.
  • Windows restore cleanup supports only canonical local drive paths. Reject UNC, mapped network paths and other root forms as permanent failures before enumeration. A failed final-path query preserves the OS error. Filesystems without the required handle-delete operation fail closed; there is no attribute-changing fallback or UNC support.
  • Pin the rustic_core change in golemcloud/rustic_core#7 by revision. It captures Windows read-only modes, sets timestamps through an attribute-only handle, and clears read-only before writing changed contents. Restore saved permissions after contents and timestamps. Leave symlink permissions unchanged and propagate metadata errors. The Windows snapshots were regenerated from the changed mapper. The native fork regression restores A, A again, then writable B into the same destination without clearing or permission resets; its byte, timestamp and permission assertions pass. This does not establish a Golem build with the new pin.
  • Hold built-in compilation requests until the registry has its gRPC port. Flush the queued batch after setting that port. Startup waits for the batch; each request keeps its enqueue timeout. Treat duplicate plugin registration as an expected conflict without a database error log.
  • Keep the pending compilation requests and the ready port in one mutex-protected state. Keep the failed-seed policy in effects.rs; runtime writes still return EffectDecision, while seed failures retain terminal usage-observation errors through classify_startup_error.
  • New coverage includes trigger_stream_timeout_sends_a_close_handshake and the Windows-only an_empty_unsupported_windows_root_fails_restore_permanently. The latter substitutes an unsupported final path on an opened empty directory and checks the permanent run failure before repository loading. Its native Windows run is pending. Actual UNC and mapped-drive root probes also remain pending; this test does not establish network-root support.
  • Main could not run a_failed_protection_and_cleanup_returns_unavailable_and_keeps_cache_ownership, capture_and_seed_preserve_readonly_nested_contents_and_times or a_run_after_a_clear_that_failed_partway_clears_before_it_loads because the unchanged public-oplog test calls block its executor test target. These caller checks ran on the maintenance counterpart with the new pin; they do not qualify main.
  • Caller coverage includes enqueue_is_best_effort_and_bounds_the_entire_attempt, test_component_stage on SQLite/Postgres/Postgres TLS, and the CLI stream tests, including peer_initiated_close_is_acknowledged. The actual-source destination harness covers cleanup and local-path validation. Main's executor test target remains blocked by two unchanged public-oplog calls that omit pinned_plugins; keep-going workspace lint reports the same baseline errors.
  • The maintenance counterpart supplies runtime coverage for sandbox_creation_failures_require_host_recovery_and_keep_cleanup_failures, an_unwritable_sandbox_root_retries_creation_after_host_repair, the recovery-classification and pending-update permanent-storage controls, the portable permissions test, typed disk-full/quota errors, restore retry, cache leases, and capture_and_seed_preserve_readonly_nested_contents_and_times. Main's new creation-recovery tests remain blocked by the public-oplog compile errors. The permission-denial test returns early as root, like existing permission tests.
  • Earlier native Windows release server and CLI builds and Rust/TypeScript invocation/restart smoke tests passed on the maintenance branch. The later executor runs passed the selected local-root validation, read-only and hard-link cleanup, cache-lease, partial-restore retry, capture/seed and symlink checks with the pinned fork. These broader results predate the creation-recovery change and do not validate main or either current head. See the per-test table and provenance. Separately, the current maintenance counterpart passed focused native release library checks for cache rollback, read-only capture/seed and invocation-error close; these do not qualify main or repeat the release application smoke test. Native Windows verification of main remains pending. The fork's backup, listing, VFS and rewrite snapshot tests passed after regeneration with snapshot updates disabled.
  • The maintenance Golem symlink cleanup test passed with a non-elevated token during Dávid's approved temporary Developer Mode window. The original absent registry value was restored afterward; an independent non-elevated probe again failed with OS error 1314. Real UNC, mapped-drive and unsupported-reparse-tag runtime cases remain untested. No CI workflows change.

@netlify

netlify Bot commented Nov 30, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for golemcloud canceled.

Name Link
🔨 Latest commit 11a4114
🔍 Latest deploy log https://app.netlify.com/projects/golemcloud/deploys/6b129ec61e19839fc358a0f7

@noise64
noise64 marked this pull request as ready for review December 1, 2026 15:47
@noise64
noise64 requested a review from a team December 1, 2026 15:47

@vigoo vigoo left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed the main-branch delta at 08bc5d8. No confirmed introduced defects found. Native Windows cleanup tests and compilation of this main head remain unverified in this review; the reported Windows build and smoke evidence is from the backport. Approval posted at the maintainer’s explicit request with that validation limitation recorded.

@runtologist runtologist left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adversarial review of the head commit, with one finding and a reproducer in the inline comment. I checked that this PR and its counterpart make the same fix, adapted to the branch. The fix covers the stream close, the directory capabilities, the Windows restore clear, cache leases, registry port gating and plugin conflicts. Both heads reproduce this finding the same way.

let protected = set_initial_file_read_only(&file).and_then(|()| file.sync_all());
drop(file);
if protected.is_err() {
platform::remove_initial_file(path).expect("Failed to remove cached component file — executor filesystem is in an inconsistent state");

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Medium — Return the cache cleanup failure instead of aborting the executor.

This new expect runs when setting the persisted file read-only or syncing it has already failed. If removal fails too, it panics. Both the dev and release profiles use panic = "abort", so this terminates the executor rather than returning InitialFileLoadError.

A concrete failure sequence is the cache filesystem becoming read-only after persist_noclobber: setting permissions fails, then unlink fails, and this branch aborts. Before this change, protection/sync failures returned through map_err while NamedTempFile still owned cleanup. This is a new failure path, separate from the existing initialized-entry destructor panic.

Please propagate an error retaining both the original failure and the cleanup failure, and keep ownership of the leftover file explicit rather than panicking. This also follows CS-007 (no reachable panics in executor code).

Evidence: static tracing of this branch and the Cargo profiles; I have not runtime-reproduced the double failure.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 11a4114.

This branch has not been deployed

No deployments
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.

3 participants