Commit graph

767 commits

Author SHA1 Message Date
Bryan Helmkamp
ba7dc77be0
refactor(billing): unify the LLM billing domain
Replace the overlapping usage and cost model with canonical billing
primitives centered on ModelRef, ModelHandle, TokenCounts, and
BilledModelUsage. This also renames the public API and web surface from
usage to billing, removes compatibility aliases, and normalizes provider
usage adapters onto the shared billing vocabulary.
2026-04-07 14:33:35 -04:00
Bryan Helmkamp
6c5ea35fd1
Merge remote-tracking branch 'origin/main' 2026-04-07 13:00:13 -04:00
Bryan Helmkamp
f4488c4d35
feat(run): record run creation provenance
Persist server, client, and subject provenance on run creation so
run state and inspect output can show which Fabro version created a
run, which first-party client submitted it, and how the request was
authenticated.
2026-04-07 12:59:25 -04:00
Bryan Helmkamp
26e21f0a13
fmt 2026-04-07 12:59:16 -04:00
Bryan Helmkamp
6a804e9808
refactor(cli): stream run attach over SSE
Replace the attach polling loop with the existing run attach SSE endpoint.
Seed from stored history once, fetch interview questions only when needed,
and keep completed-run replay behavior intact.
2026-04-07 12:58:37 -04:00
Bryan Helmkamp
80dfbd5309
Merge remote-tracking branch 'origin/main'
# Conflicts:
#	lib/crates/fabro-cli/tests/it/cmd/support.rs
2026-04-07 11:44:13 -04:00
Bryan Helmkamp
a2ab0afc86
perf(nextest): keep shared test server state in memory
Default test daemons now opt into an in-memory object store and test
helpers carry explicit run ids instead of rediscovering runs from
shared state.

This also disables the disk-backed store dump integration tests until
store dump is routed through the server's live store handles.
2026-04-07 11:39:40 -04:00
Bryan Helmkamp
552498cf8a
refactor(store): share run projection with cli
Make fabro-store::RunProjection the single projection type used by the
server, CLI, and CLI test helpers. This removes the duplicated CLI-side
mirrors and adds serde coverage for the store-owned projection.
2026-04-07 11:36:22 -04:00
Bryan Helmkamp
5c5d48c152
refactor(cli): centralize HTTP client builder with User-Agent header
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-07 10:31:07 -04:00
Bryan Helmkamp
7c71afed53
Merge remote-tracking branch 'origin/main' 2026-04-07 10:29:36 -04:00
Bryan Helmkamp
4470eb21ad
fix(run): propagate worker cancellation into command stages
Pass a real cancel signal from __run-worker through the workflow engine
into sandbox command execution so cancelled runs reap gated shell loops
instead of leaking slow.gate waiters.
2026-04-07 10:09:30 -04:00
Bryan Helmkamp
099362cd42
fix(nextest): let shared test server reap run workers
Give the harness longer to stop the shared test server than the server
itself uses to shut down active run workers. This prevents session cleanup
from SIGKILLing the server before it can terminate worker process groups,
which was leaving orphaned `fabro <run> running` subprocesses behind.
2026-04-07 09:52:12 -04:00
Bryan Helmkamp
9d9ebd529f
test(nextest): share one session server by default
Eagerly start one shared test server per nextest session and point default
TestContext commands at that session socket instead of leaking per-test
daemons keyed by FABRO_STORAGE_DIR. Add isolated_server() for tests that
need an explicit separate daemon, and tighten the ps filtering test so it
still proves the contract without timing out under full-suite load.
2026-04-07 09:44:34 -04:00
Bryan Helmkamp
9fe7268026
chore: remove workflows and steer endpoints
Remove GET /workflows, GET /workflows/{name}, GET /workflows/{name}/runs,
and POST /runs/{id}/steer from the OpenAPI spec, server routes, demo
fixtures, pagination tests, docs navigation, and generated TS client.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-07 08:25:54 -04:00
Bryan Helmkamp
c9d1b92725
feat(run): harden server-supervised worker lifecycle
Move subprocess workers fully behind the server-owned run store by
switching worker/server coordination to HTTP-backed run events and
control state. Reconcile stale in-flight runs on boot, terminate live
workers during shutdown, and update process titles to reflect server and
worker lifecycle phases.
2026-04-07 07:59:35 -04:00
Bryan Helmkamp
a7bc63a5ae
feat(logging): add daily log rotation and 7-day cleanup
Some checks are pending
Rust / Format (push) Waiting to run
Rust / Clippy (push) Waiting to run
Rust / Test (Linux) (push) Waiting to run
Rust / Test (macOS) (push) Waiting to run
TypeScript / Typecheck (push) Waiting to run
TypeScript / Test (push) Waiting to run
TypeScript / Build (push) Waiting to run
Logs were growing unbounded — cli.log and server.log used
rolling::never() with no rotation. Switch to daily rotation via
tracing-appender builder API (prefix.YYYY-MM-DD.log) and clean up
files older than 7 days on startup.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-06 19:08:26 -04:00
Bryan Helmkamp
5b63e25b28
chore: remove unused verification, retros, and sessions endpoints
These endpoints had zero CLI callers and served only the web UI demo.
Verification and retros were `not_implemented` stubs in real mode;
sessions had an in-memory implementation but no CLI usage. Removing
them shrinks the API surface and eliminates ~9,000 lines of dead code.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-06 17:52:51 -04:00
Bryan Helmkamp
097c86024f
chore: remove skill install command and GET /runs/{id}/verification endpoint
Dead feature cleanup: `skill install` was hidden/experimental and never
graduated; the run verification endpoint was only implemented in demo mode.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-06 16:38:03 -04:00
Bryan Helmkamp
6c53fc29b5
fix(logging): use stable server log paths 2026-04-06 16:18:13 -04:00
Bryan Helmkamp
62f6f9b100
feat(system): add server-backed system commands 2026-04-06 16:10:06 -04:00
Bryan Helmkamp
8ba893bf68
Merge remote-tracking branch 'origin/main' 2026-04-06 15:25:43 -04:00
Bryan Helmkamp
b29a582d31
fix(storage): use Storage/RunScratch accessors instead of raw path joins
Four callsites were bypassing existing Storage/RunScratch methods:

1. install.rs — .join("secrets.json") → Storage::secrets_path()
2. initialize.rs — .join("worktree") → RunScratch::worktree_dir()
3. git.rs — .join("final.patch") → RunScratch::final_patch()
4. create.rs — duplicated date-format logic → RunScratch::for_run()

Adds RunScratch::for_run(scratch_dir, run_id) to centralize the
date-prefixed directory name, used by both Storage::run_scratch()
and make_run_dir().

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-06 15:12:19 -04:00
Bryan Helmkamp
d00dea696e
fix(testing): stabilize artifact fixture under load
Increase the artifact scenario timeout so the retry fixture still forces one timeout without spuriously creating a third retry under full-workspace nextest load. Also import the generated ServerSettings type directly so workspace clippy stays clean.
2026-04-06 14:09:32 -04:00
Bryan Helmkamp
c57bf24410
refactor(home): remove dead settings path fallbacks
default_settings_path() and active_settings_path() always return a
value (Home::from_env() never fails), so unwrap_or_else fallbacks to
".fabro/settings.toml" were dead code. Change both functions to return
PathBuf instead of Option<PathBuf> and remove the unreachable branches
in server_client, serve, and user config.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-06 13:59:17 -04:00
Bryan Helmkamp
3d7c839278
chore(api-client): regenerate settings client models 2026-04-06 13:46:57 -04:00
Bryan Helmkamp
7afcb5091a
fix(home): migrate all runtime consumers to use Home
Replaces every dirs::home_dir().join(".fabro") in production code with
Home::from_env() accessors, so FABRO_HOME is respected everywhere:

- fabro-config: project workflows dir, legacy .env path
- fabro-cli: logging dir, install root + cert defaults, upgrade check
  state, workflow list, doctor/install/login legacy_env callers
- fabro-telemetry: tmp dir for spawn, anonymous ID file
- fabro-workflow: file resolver fallback in source resolution
- fabro-agent: skill discovery (session + default_skill_dirs API)

Remaining dirs::home_dir() calls are legitimate: tilde expansion,
display path shortening, non-.fabro paths (e.g. ~/.claude/skills).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-06 13:36:43 -04:00
Bryan Helmkamp
a740b2d395
refactor(settings): make settings command server-backed
Default `fabro settings` now resolves effective runtime settings against the
selected server, while `--local` preserves local-only inspection. This also
extracts shared settings resolution logic so CLI output, manifest preparation,
and the `/api/v1/settings` contract stay aligned.
2026-04-06 13:34:28 -04:00
Bryan Helmkamp
c8af7e0638
refactor(home): move Home to fabro-util so all crates can share it
Home lived in fabro-config, which meant fabro-types (a dependency of
fabro-config) could not use it — forcing Settings::storage_dir() to
duplicate the FABRO_HOME / dirs::home_dir() fallback logic. Moving Home
to the leaf crate fabro-util breaks this layering constraint and lets
Settings::storage_dir() delegate to Home::from_env().storage_dir().

Also adds stable accessors: storage_dir, socket_path, workflows_dir,
logs_dir, tmp_dir. fabro-config re-exports Home for API compatibility.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-06 13:08:35 -04:00
Bryan Helmkamp
cd392b29c7
fix(storage): align workflow scratch defaults with settings
Full workspace verification exposed one real mismatch after the socket and
storage split: workflow default scratch lookup still derived from ~/.fabro
instead of the new storage root. Keep the helper aligned with Settings defaults
and fold in the small clippy-driven cleanups in the related server path code.
2026-04-06 12:21:54 -04:00
Bryan Helmkamp
cb58b18385
refactor(cli): separate local socket and storage defaults
Keep local server targeting based on explicit server targets instead of
implicitly deriving a socket from storage_dir. This makes ~/.fabro/fabro.sock
the default local socket again, keeps storage under ~/.fabro/storage, threads
FABRO_CONFIG through server autostart paths, and updates the CLI test harness
for the new split.
2026-04-06 11:57:14 -04:00
Bryan Helmkamp
15dcf90763
fix(storage): satisfy clippy in home and artifact paths 2026-04-06 10:31:08 -04:00
Bryan Helmkamp
35593d0a11
refactor(storage): unify scratch paths and key schema
- centralize FABRO_HOME and storage path resolution in fabro-config
- rename store types, extract ArtifactStore, and simplify run key layout
- switch run scratch to scratch/, remove RuntimeState, and refresh docs/clients
2026-04-06 10:13:37 -04:00
Bryan Helmkamp
beec4c8dff
refactor(cli): make run-adjacent commands server-only 2026-04-06 06:12:16 -04:00
Bryan Helmkamp
36ff3c5377
refactor(config): unify machine config as settings.toml
Consolidate CLI and server machine defaults under settings.toml,
including loader renames, writer preservation fixes, same-machine
manifest handling, and docs/test updates for the new config model.
2026-04-05 23:55:28 -04:00
Bryan Helmkamp
c66ba89875
refactor(cli): make core run lifecycle server-only 2026-04-05 21:57:27 -04:00
Bryan Helmkamp
147986de11
fix(test): stabilize file interviewer claim-release timing
The file interviewer tests were assuming a transient claim file would be
observed within a 2ms window, which flaked under full-workspace load.
Make the observation wait explicit so nextest remains reliable.
2026-04-05 21:22:11 -04:00
Bryan Helmkamp
f583127059
refactor(cli): target run and create commands via server connection
Allow run and create to resolve the same explicit or configured server
connection model used by preflight, validate, and graph. This removes the
last local-only submission assumption from the CLI surface while keeping
local storage-backed behavior intact when no remote target is selected.
2026-04-05 21:22:04 -04:00
Bryan Helmkamp
2d0cacaa99
refactor(workflow): make bundled child workflows authoritative 2026-04-05 20:13:00 -04:00
Bryan Helmkamp
bd70f805be
refactor(server): submit runs and preflight via manifests 2026-04-05 20:07:10 -04:00
Bryan Helmkamp
9ddcc13b66
fix(test): satisfy clippy import style in lifecycle tests
Some checks are pending
Rust / Format (push) Waiting to run
Rust / Clippy (push) Waiting to run
Rust / Test (Linux) (push) Waiting to run
Rust / Test (macOS) (push) Waiting to run
TypeScript / Typecheck (push) Waiting to run
TypeScript / Test (push) Waiting to run
TypeScript / Build (push) Waiting to run
2026-04-05 17:55:30 -04:00
Bryan Helmkamp
b8c3aa826d
Merge remote-tracking branch 'origin/main'
Resolve the fabro-server merge conflicts by keeping the settings-aware test
app-state helper from origin/main while preserving the secret-store-aware
AppState construction added locally.
2026-04-05 17:45:57 -04:00
Bryan Helmkamp
e876d63745
refactor(cli): clean legacy server-target and env naming
Tighten pre-manifest cleanup by removing the old dotenv helper, reducing
legacy .env handling to warning-only path detection, and renaming internal
remote target fields from base_url to api_url.

This also updates install/server docs and CLI terminology so the codebase
reflects the current direct-run vs server-interface model more accurately.
2026-04-05 17:43:03 -04:00
Bryan Helmkamp
e33ee6073a
refactor(server): make secrets and operational checks server-canonical
Move secret storage, diagnostics, and repo/provider validation behind the
server API so credentials live under the server storage dir and take effect
immediately without process env mutation.

This also removes the old .env runtime path, rewires doctor/install/secret/
provider login/repo init around the server contract, and regenerates the
TypeScript client for the new endpoints.
2026-04-05 17:34:01 -04:00
Bryan Helmkamp
afc53a421d
refactor(cli): deglobalize server and storage target flags
Move --storage-dir and --server-url off GlobalArgs and onto the
leaf commands that actually honor them.

This aligns help, parser behavior, and env-var wiring with the
current command architecture while preserving the intended model
and exec targeting semantics.
2026-04-05 16:06:42 -04:00
Bryan Helmkamp
dad418f95d
fix(test): disable worktrees in fabro-server integration tests
Server scenario tests were inheriting the default local sandbox
worktree mode, which meant they created git worktrees and branches
before stage execution. Under suite load that setup intermittently
stalled the run long enough for the scenario polling windows to fail.

Disable worktrees in the shared server test settings and let lifecycle
scenarios use the same test-only settings through a settings-aware
registry factory helper.
2026-04-05 15:33:16 -04:00
Bryan Helmkamp
260460aebf
refactor(cli): remove global execution mode 2026-04-05 15:20:00 -04:00
Bryan Helmkamp
5f6a5ced6b
refactor(test): restructure fabro-server it/ into api/ and scenario/ subdirs
Move integration tests from monolithic api.rs into api/ (single-endpoint
contract tests) and scenario/ (multi-API-step flows), mirroring the CLI's
cmd/ vs scenario/ pattern. Move 3 scheduler-dependent unit tests from
server.rs into it/scenario/ where they get the correct nextest timeout
(kind=test override). Deduplicate shared helpers into helpers.rs.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-05 14:58:24 -04:00
Bryan Helmkamp
0bdcb4df77
Merge remote-tracking branch 'origin/main' 2026-04-05 14:44:35 -04:00
Bryan Helmkamp
420f82180e
refactor(workspace): satisfy clippy all-targets warnings 2026-04-05 14:37:32 -04:00
Bryan Helmkamp
6af4943f4c
refactor(cli): move model CLI out of fabro-llm
Move the model command surface into fabro-cli and delete the dead
fabro-llm CLI module now that prompt/chat/model CLI entrypoints are gone.
This also removes the now-unused fabro-llm CLI-only dependencies.
2026-04-05 14:26:05 -04:00