Commit graph

241 commits

Author SHA1 Message Date
Bryan Helmkamp
7b18a11c40 test(run): remove legacy file absence assertions
Keep the coverage focused on current store-backed behavior instead of
asserting that old run_dir debug files are missing.
2026-04-03 11:24:30 -07:00
Bryan Helmkamp
a65941e418 refactor(run): remove file-backed attach fallback
Require attach to use SlateDB-backed run state and events instead of
falling back to progress.jsonl, status.json, and conclusion.json.
Also remove the unused disk progress logger and keep PR body plan text
store-backed so the remaining run_dir file writes can continue shrinking.
2026-04-03 11:19:23 -07:00
Bryan Helmkamp
32ce949d8f Merge remote-tracking branch 'origin/main' 2026-04-03 10:34:48 -07:00
Bryan Helmkamp
563a9eeb49 Remove server feature flag from fabro-cli, always compile server in
The server subcommand and related code were gated behind
cfg(feature = "server"). This removes the feature flag entirely,
making fabro-server a required dependency so the server command
is always available.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-03 10:09:56 -07:00
Bryan Helmkamp
8d935603a8 Fix clippy warnings: remove useless .into(), unnecessary async, large futures, and style lints
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-03 08:47:16 -07:00
Bryan Helmkamp
6874d0c76e Merge remote-tracking branch 'origin/main' into feat/event-sourced-run-state 2026-04-03 06:44:58 -07:00
Bryan Helmkamp
180cca046c Collapse store handles onto Slate 2026-04-02 23:16:05 -07:00
Bryan Helmkamp
031d4cdbb6 Require a durable run store throughout execution
Make run lookup fail with RunNotFound instead of returning Option, thread a required RunStore through workflow and retro paths, and update CLI, server, and test callers to match. Also treat null optional event properties as absent during store-backed replay so event-sourced state stays robust.
2026-04-02 15:08:21 -07:00
Bryan Helmkamp
9410ed8fda Merge remote-tracking branch 'origin/main' 2026-04-02 14:29:31 -07:00
Bryan Helmkamp
e0ac11f1d5 Remove unnecessary comments, use bail! consistently in server start
- Delete WHAT comments that restate the code
- Replace eprintln! + process::exit(1) with bail! in daemon "already running" path for consistency with foreground mode

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-02 10:45:37 -07:00
Bryan Helmkamp
af2a1e4f6d Add server daemon management with Unix socket support
Transform `fabro server` from foreground-only TCP into a proper daemon:
- `server start` launches background daemon with flock-based locking
- `server start --foreground` retains current blocking behavior
- `server stop` sends SIGTERM, waits, escalates to SIGKILL
- `server status` reports running/stopped with PID, bind, uptime (--json)
- `--bind` replaces `--host`/`--port`, supporting Unix sockets and TCP
- Default bind is `{storage_dir}/fabro.sock` (Unix socket)
- Hidden `__serve` subcommand for daemon child process lifecycle
- Graceful shutdown via SIGTERM/SIGINT signal handlers

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-02 10:40:19 -07:00
Bryan Helmkamp
f786f91fe7 Make provider metadata event-derived and rewind append-only 2026-04-02 10:26:12 -07:00
Bryan Helmkamp
12e316b785 Finish events-as-source-of-truth follow-ups 2026-04-02 10:02:31 -07:00
Bryan Helmkamp
bf6ed3957b Align event tests and snapshots with stage responses
Update CLI progress test fixtures and log snapshots for the new
stage.completed response field, and add a narrow clippy allow/type alias
cleanup needed to keep the workspace warning-free.
2026-04-02 09:02:06 -07:00
Bryan Helmkamp
7235414e6a Rename FabroSettings to Settings, eliminate FabroSettingsExt
Move storage_dir() from FabroSettingsExt trait in fabro-config into an
inherent method on Settings in fabro-types. Remove the re-export from
fabro-config so callers import directly from fabro_types. Drop the
redundant Fabro prefix since the type already lives in the fabro_types
crate.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-02 07:36:44 -07:00
Bryan Helmkamp
45ddb0b70a Merge remote-tracking branch 'origin/main'
# Conflicts:
#	lib/crates/fabro-server/src/server.rs
#	lib/crates/fabro-server/src/web_auth.rs
2026-04-02 06:48:22 -07:00
Bryan Helmkamp
ddc57d458c Rename SessionConfig to SessionOptions and McpServerConfig to McpServerSettings
Aligns naming with the convention that "Config" is for file-level configuration
while "Options" and "Settings" describe runtime parameters. Also applies
rustfmt formatting fixes in web_auth.rs.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-02 06:47:42 -07:00
Bryan Helmkamp
7f0f014bfb Reduce slatedb timers 2026-04-02 06:43:58 -07:00
Bryan Helmkamp
345d6cd357 Stabilize workspace tests and clean warnings
Make the full workspace nextest run reliable after the run-store migration,
restore legacy test-harness projections needed by workflow integration tests,
and clear the remaining fmt/clippy issues in the touched paths.
2026-04-02 06:33:22 -07:00
Bryan Helmkamp
7464d3e385 Remove legacy run file projection layer 2026-04-01 22:57:27 -07:00
Bryan Helmkamp
9e7005c435 Require store-backed state for run diffs 2026-04-01 22:57:27 -07:00
Bryan Helmkamp
ea4cf7033b Restore rewound run metadata from the store 2026-04-01 22:57:27 -07:00
Bryan Helmkamp
14464776f2 Infer attach store context without run records 2026-04-01 22:57:27 -07:00
Bryan Helmkamp
335bafea47 Recover launcher state without run records 2026-04-01 22:57:27 -07:00
Bryan Helmkamp
c4d1910479 Reuse store-backed run cleanup in system prune 2026-04-01 22:57:27 -07:00
Bryan Helmkamp
656b2a79ea Pass run IDs directly into detached start services 2026-04-01 22:57:27 -07:00
Bryan Helmkamp
f2f187cfbe Load sandbox cleanup metadata from the run store 2026-04-01 22:57:27 -07:00
Bryan Helmkamp
c162f9048c Stop requiring progress files for attach fallback 2026-04-01 22:57:27 -07:00
Bryan Helmkamp
ba525dbfaa Stop writing rewind status files 2026-04-01 22:57:27 -07:00
Bryan Helmkamp
fc329beb7c Restore start metadata when rehydrating rewound runs 2026-04-01 22:57:27 -07:00
Bryan Helmkamp
d2e117d23f Stop writing legacy pull request files 2026-04-01 22:57:27 -07:00
Bryan Helmkamp
cb7d83e118 Cut operational run readers over to store-only state 2026-04-01 22:57:27 -07:00
Bryan Helmkamp
adf7807619 Use store-backed run summaries and attach replay 2026-04-01 22:57:27 -07:00
Bryan Helmkamp
50ca4e4498 Use store-backed run discovery for asset commands 2026-04-01 22:57:27 -07:00
Bryan Helmkamp
157f805117 Persist command and diff artifacts in the run store 2026-04-01 22:57:27 -07:00
Bryan Helmkamp
9049ac606b Require store persistence for pull request records 2026-04-01 22:57:27 -07:00
Bryan Helmkamp
1f631498c1 Use store-backed status for attach and run lookup 2026-04-01 22:57:27 -07:00
Bryan Helmkamp
d0a3a0a092 Remove run hydration from production paths 2026-04-01 22:57:27 -07:00
Bryan Helmkamp
156e211bd4 Persist run creation directly into the store 2026-04-01 22:57:27 -07:00
Bryan Helmkamp
4f73aac043 Cut more CLI control-plane reads over to the store 2026-04-01 22:57:27 -07:00
Bryan Helmkamp
1db1387469 Rehydrate rewound runs before resume 2026-04-01 22:57:27 -07:00
Bryan Helmkamp
aa1e955b47 Move attach and logs to store-backed event history 2026-04-01 22:57:27 -07:00
Bryan Helmkamp
b127c025c2 Cut PR and diff readers over to the run store 2026-04-01 22:57:27 -07:00
Bryan Helmkamp
c83cf3a577 Expand store-backed run metadata and detached startup
Add the missing run-store records for node metadata, final patches, and pull
request state, and extend the store snapshots/backends to round-trip them.

Also cut the detached startup path over to explicit run IDs and store-backed
status loading so start and detached execution no longer require run.json for
bootstrap.
2026-04-01 22:57:26 -07:00
Bryan Helmkamp
b56b82d34b Cut over Fabro web app to a server-backed SPA
Replace the old React Router SSR setup with a static SPA build served by
fabro-server, move setup and GitHub auth handling into Rust, and update the
default local web URL and stale Arc-era references to match the Fabro name.
2026-04-01 21:36:01 -07:00
Bryan Helmkamp
70bfa53255 Simplify: fix buggy JSON sorting, deduplicate event filtering, clean up wait loop
- Replace no-op sort_json_value (IndexMap→IndexMap) in create.rs with
  normalize_json_value (IndexMap→BTreeMap→Map) from event.rs, fixing
  RunCreated events having non-deterministic key order
- Add AgentEvent::is_streaming_noise() to centralize the 6-variant
  streaming filter used in api.rs, retro.rs, and subagent.rs
- Extract load_file_status closure and merge Ok(None)|Err(_) arms in
  wait.rs to remove triple-repeated RunStatusRecord::load expression

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-01 20:13:15 -04:00
Bryan Helmkamp
d8b07add7b Expand workflow event payloads and stabilize CLI logs
Add richer run, stage, prompt, command, retro, and agent session event
metadata so progress output and stored workflow events carry the context
needed by the new plan. Normalize event serialization and update CLI log
handling to prefer progress.jsonl with consistent redaction, and fix the
detached wait/log race covered by the updated integration and snapshot
tests.
2026-04-01 20:13:14 -04:00
Bryan Helmkamp
12dc5557d8 Consolidate unsafe process code into fabro-proc crate
Rename fabro-proctitle to fabro-proc and add safe wrappers for all
process management primitives (signals, pre-exec hooks). This contains
all unsafe proc code behind a safe API so downstream crates no longer
need #[allow(unsafe_code)] or direct libc dependencies.

New modules: signal (process_alive, sigterm, sigkill, sigterm_process_group),
pre_exec (pre_exec_setsid, pre_exec_setpgid, pre_exec_pdeathsig),
title (existing proctitle code). Eliminates three duplicate process_alive
definitions and removes libc as a direct dep of fabro-cli and fabro-sandbox.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-01 17:49:29 -04:00
Bryan Helmkamp
afd1b52527 Deny unsafe_code workspace-wide, remove unsafe pointer cast from tests
Promote unsafe_code lint from warn to deny so new unsafe code is a
compile error. Add #![allow(unsafe_code)] to the two sleep_inhibitor
modules that were missing it. Replace the unsafe trait-object pointer
cast in CliMockSandbox tests with a shared Arc<Mutex<Vec<String>>>.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-01 17:17:59 -04:00
Bryan Helmkamp
905206f63d Fix attach hanging on Linux CI when engine exits before attach starts
The attach loop's PID liveness fallback used `last_seq > 0` (store path)
and `!progress_file_is_empty` (file path) to keep the engine "alive" when
no launcher record could be found. These conditions are always true once
events exist, so the loop never exited via the PID path after the launcher
record was cleaned up by start_run or active_launcher_record_for_run.

The store-based terminal status check (the other exit path) only read from
the SlateDB DbReader, which may not see data still in the WAL or not yet
visible via manifest poll. Adding a disk fallback to read status.json
ensures the check works even when the store reader has a stale view.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-01 14:32:16 -04:00