fabro/lib/apps/fabro-cli/src
Bryan Helmkamp cb54a0df90 Stop a surviving worker before ending its lease from outside
A worker leads a process group of its own, so it outlives a server
crash. The restarted server released the run's lease from outside and
launched a resume while that worker could still be running: a worker
whose lease is released keeps acting until its next write, beside its
successor. A delete likewise dropped the lease without knowing the
worker was gone.

Now each worker holds a lock on `worker.lock` in its run's scratch
directory for its whole life, taken before anything else. It is a POSIX
record lock: the kernel frees it only when the worker exits, and names
the process that holds it. Before the server ends a lease from outside
(the relaunch after a restart or a store interruption, and a delete), it
kills whatever process still holds the lock, with its process group, and
waits until the lock is free. A worker that finds the lock held does not
start.

- fabro-proc: ProcessLock::try_hold and stop_lock_holder, tested with
  this test binary as the holding process.
- fabro-config: RunScratch::worker_lock_path.
- New scenario: a worker that outlives the server is gone before the
  resume's worker launches, and the run succeeds once. It fails without
  the server-side stop.

A host stage process runs in a process group of its own and still
outlives its killed worker, as it did at a worker crash.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-06 12:29:34 -04:00
..
commands Stop a surviving worker before ending its lease from outside 2026-10-06 12:29:34 -04:00
shared Delete the checkpoint endpoint, fabro parse, and the fabro-workflow shims 2026-09-19 09:31:09 -04:00
sleep_inhibitor refactor: organize crates into three layers 2026-07-23 17:59:34 -04:00
args.rs Retry a finished run from the start 2026-10-01 11:14:45 -04:00
command_context.rs Implement the lithos CredentialProvider trait directly 2026-09-10 09:16:39 -06:00
gh.rs refactor: organize crates into three layers 2026-07-23 17:59:34 -04:00
landing.rs Create CLI runs from immutable workflow intents 2026-09-01 16:14:34 -04:00
local_server.rs refactor: organize crates into three layers 2026-07-23 17:59:34 -04:00
logging.rs refactor: organize crates into three layers 2026-07-23 17:59:34 -04:00
main.rs Publish a successful run from its run_finished hook 2026-10-01 13:00:26 -04:00
manifest_args.rs Simplify the CLI run-intent create path 2026-09-01 16:14:34 -04:00
mcp_servers.rs Move fabro-mcp's pebble mapping and test client into fabro-cli 2026-09-18 10:57:07 -04:00
server_client.rs Remove the [server.slatedb] settings and the SlateDB prefix probe 2026-09-18 16:00:24 -04:00
server_runs.rs Carry usage as lithos-llm's Usage and rename billing to usage 2026-09-14 12:31:34 -06:00
user_config.rs Use async reads during CLI intent preparation 2026-09-02 13:44:33 -04:00