Collapse init_run/init_run_with_records/init_run_inner into a single
init_run(run_id, files) that takes all files as a flat slice. Resume
from metadata branch now uses RunRecord's embedded graph directly
when available, falling back to graph.fabro DOT parsing for old runs.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Delete run_spec.rs and manifest.rs modules. Remove write_manifest()
from the engine, update DiskLifecycle and GitLifecycle to only write
StartRecord. Remove read_manifest() from MetadataStore. Update
run_fork to only handle run.json/start.json. Convert resume.rs to
use RunRecord/StartRecord from the metadata branch. Update all tests
and integration tests.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Introduce two new persistence types aligned to the CREATE/START lifecycle:
- RunRecord (run.json): written at CREATE with merged FabroConfig, fully
transformed Graph, and run metadata
- StartRecord (start.json): written at START with start_time, run_branch,
and base_sha
All readers (run_lookup, inspect, diff, pr, attach, detached_support,
start, run_fork, pull_request, run_rewind, resume) now read from the
new types first. Legacy manifest.json + spec.json are still written
for backward compatibility (removal in follow-up).
Also adds dry_run, auto_approve, no_retro fields to FabroConfig, derives
Default on LlmConfig and Graph, and updates docs + tests.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Remove the ContextStore trait, InMemoryStore, and Context::with_store() from
fabro-core — put the HashMap directly in Context. Replace the duplicate
fabro-workflows Context struct with a re-export of fabro_core::Context, and
move domain accessors (fidelity, run_id, preamble, thread_id) to a
WorkflowContext extension trait. Eliminate the bridge layer (WfContextStore,
bridge_context, WorkflowContextExt) entirely since there is now one Context
type. Rename clone_context() to fork() for clarity.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The dry_run_writes_jsonl_and_live_json test was timing out at 4s because
the arc() helper didn't pass --no-upgrade-check, causing every test run
to await a background GitHub API call before process exit.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Fill in the previously stubbed ArtifactLifecycle and GitLifecycle, and
complete FidelityLifecycle and CircuitBreakerLifecycle with their full
behavior. Wire the orchestrator with context seeding, shared state, and
all callback orderings matching the plan.
FidelityLifecycle: use resolve_fidelity/resolve_thread_id for full
resolution chains, add preamble building via build_preamble, set
thread.{tid}.current_node key, store raw Edge for proper resolution.
CircuitBreakerLifecycle: add on_edge_selected with TransientInfra guard
and restart_failure_signatures tracking for loop_restart edges.
EventLifecycle: add Skipped guard in after_node (engine.rs:2080 parity),
read GitCheckpointResult for GitCommit/GitPush events in on_checkpoint,
read artifact_store count and last_git_sha in on_run_end.
HookLifecycle: add Skipped guard in after_node, add on_checkpoint for
CheckpointSaved hook.
DiskLifecycle: add on_run_start with write_manifest + write_run_status,
use write_node_status with visit-based directory naming.
GitLifecycle: full implementation — on_run_start resets last_git_sha and
inits metadata branch; on_checkpoint does shadow commit, run branch
commit, checkpoint re-save with SHA, push, and diff.patch; on_run_end
writes final.patch.
ArtifactLifecycle: full implementation — on_run_start swaps fresh store,
before_attempt records epoch, after_attempt collects assets and emits
AssetsCaptured, after_node offloads large values and syncs to sandbox.
Orchestrator: context seeding (mirror_graph_attributes, INTERNAL_RUN_ID,
INTERNAL_WORK_DIR) with is_initial_resume gating, shared state for
checkpoint_git_result/last_git_sha/artifact_store, full callback wiring.
Promote write_manifest, write_node_status, git_diff to pub(crate).
Add Clone to RunConfig. Constructor takes Arc<RunConfig> + is_resume.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Split the 564-line core_adapter/lifecycle.rs into a lifecycle/ directory
with dedicated structs for each domain concern (event, hook, fidelity,
auto_status, circuit_breaker, disk, git, artifact), orchestrated by a
WorkflowLifecycle that enforces explicit per-callback ordering.
Also fixes core adapter boundary gaps:
- Handler now uses per-call snapshot/apply context bridge and real graph
instead of STUB_GRAPH
- Executor::run() returns (Outcome, RunState) so run_via_core can
extract the final context instead of returning an empty one
- run_via_core populates git_state on EngineServices for handlers
- Checkpoint resume gains stage_index, next_node_id fallback, and
node_visits reconstruction for old checkpoints
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Extract format_panic_message() helper, used by both engine.rs and core_adapter
- Add RetryPolicy::DEFAULT_BACKOFF const, replacing 6 identical BackoffPolicy literals
- Cache stub graph via LazyLock to avoid per-call allocation in core_adapter handler
- Replace magic "success" string with StageStatus::Success.to_string()
- Bind graph.stall_timeout() once in run_via_core instead of calling twice
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Introduce `fabro_workflows::pipeline` module defining typed phases:
PARSE → TRANSFORM → VALIDATE → INITIALIZE → EXECUTE → RETRO → FINALIZE.
Each phase is a standalone function with `#[non_exhaustive]` input/output
types so the compiler enforces ordering. `Validated` uses private fields
with read-only accessors to guarantee immutability post-validation.
Split `engine.run_with_lifecycle()` into `prepare_sandbox()` +
`execute_graph()` (backward-compatible wrapper preserved). Rewrite
`WorkflowBuilder::prepare_inner()` and CLI `prepare_workflow()` to use
pipeline functions. `PreparedWorkflow` now carries a `Validated` with
accessor methods instead of raw `graph`/`source` fields.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Context::append_log / logs_snapshot was a write-only audit trail that
was never surfaced — not in events, CLI output, or tracing. Errors like
"checkpoint save failed" were silently swallowed.
Replace all append_log call sites with RunNotice events (which are
automatically traced and visible in progress.jsonl / CLI). Remove the
logs field from both Context types, the Checkpoint struct, the OpenAPI
spec, and the TS client. Old checkpoints containing a logs field are
silently ignored during deserialization.
Also make git_diff return Result<String, String> with structured error
info (exit code + stderr) instead of Option<String>.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The select_edge bridge was creating an empty Context, which meant edge
conditions reading context values (e.g. context.failure_class=budget_exhausted)
would never match when using the core engine. Now snapshots the CoreContext
into a wf Context so evaluate_condition sees the real runtime state.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Make fabro-core's Outcome generic over a usage/metadata type parameter
(OutcomeMeta trait), allowing fabro-workflows to use core's types
directly via a type alias instead of maintaining duplicate Outcome,
StageStatus, and FailureDetail types with bidirectional conversions.
Key changes:
- Add FailureCategory enum to fabro-core (moved from fabro-workflows'
FailureClass), with Display/FromStr/is_signature_tracked
- Add OutcomeMeta supertrait + blanket impl for the generic parameter
- Make Outcome<M>, NodeResult<M>, RunState<M>, NodeDecision<M> generic
with default type parameter M=()
- Add Graph::Meta associated type
- Update FailureDetail with serde renames (category→"failure_class",
signature→"failure_signature") for checkpoint backward compat
- Replace fabro-workflows' Outcome with type alias to
fabro_core::Outcome<Option<StageUsage>>
- Add OutcomeExt extension trait for wf-specific factory methods
(fail_classify, fail_deterministic, retry_classify, simulated, etc.)
- Delete core_adapter/outcome.rs (~170 lines of conversion functions)
- Replace FailureClass with FailureCategory throughout fabro-workflows
- Fix timeout handler to use TransientInfra category, panic handler to
use Deterministic category
Net: -144 lines, zero-cost type unification with no runtime conversions.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Three crates independently implemented the same exponential-backoff-with-jitter
logic. Extract a single BackoffPolicy into fabro-util and have fabro-core,
fabro-workflows, and fabro-llm all use it, eliminating duplication and making
the backoff conversion in core_adapter trivial.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Fix fabro-core semantics to match fabro-workflows (checkpoint after edge
selection, terminal callback with goal-gate result, loop restart uses edge
target with fresh context, retry-target routing for failed nodes, visit
limit >= semantics, stall token with CancellationToken, backoff jitter).
Add core_adapter module bridging fabro-workflows types to fabro-core traits:
WorkflowGraph/Node/Edge newtypes, bidirectional outcome conversion, context
bridge sharing values/logs via ContextStore, WorkflowNodeHandler with
panic/timeout protection, and full WorkflowLifecycle implementing all 8
RunLifecycle callbacks (events, hooks, fidelity, circuit breaker, checkpoints).
Add run_via_core method behind core-engine feature flag that builds and runs
the fabro-core Executor with the full adapter suite. The existing run_internal
path remains the default.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Add verbose_enabled(), prevent_idle_sleep_enabled(), and
upgrade_check_enabled() helpers to FabroConfig to encapsulate default
values. Update all call sites in fabro-cli to use the new helpers.
Also eliminate an unnecessary clone in SubAgentManager::run_to_completion
and use extend() instead of append()+clone() in config merging.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Update references to WorkflowRunConfig, ServerConfig, apply_defaults,
and deny_unknown_fields in comments and docs to reflect the FabroConfig
unification.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Replace five config types with a single FabroConfig superset type. All
loading functions (load_cli_config, load_server_config, load_run_config,
parse_project_config) now return FabroConfig. This eliminates the
run_defaults indirection, into_run_defaults() conversion, and
apply_defaults() bridging method in favor of a single merge_overlay()
that works across all config layers (CLI → project → workflow).
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Collapse the coupled `status` and `cached_result` fields into a single
`SubAgentStatus` enum where `Finished` carries the result, eliminating
impossible states (e.g. Completed with no cached result).
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The field was populated in constructors but never read by any code.
Selected keys are already carried by AnswerValue::MultiSelected(Vec<String>),
making this field redundant. Also removes the unused options parameter from
Answer::multi_selected().
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Retain agents in the HashMap after wait/close instead of removing them,
enabling cached result retrieval, status queries, and disambiguated error
messages (never spawned vs completed vs closed vs failed).
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Preserve original error chains (reqwest, serde_json, etc.) in SdkError
via Arc<dyn Error>-backed #[source] fields on Network, RequestTimeout,
Stream, and Configuration variants. This makes production debugging of
network/TLS/DNS issues easier since error reporters can now walk the
full chain. Serde-compatible via #[serde(skip)] — message string still
carries the text for serialized forms.
Also add a `type` field to ToolCall (defaulting to "function") so
non-function tool types from providers won't be silently mishandled.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Add parse_literal() that strips surrounding double-quotes from condition
literal values, so `outcome="success"` and `outcome=success` behave
identically. Update the tokenizer to handle "..." as single tokens
(including spaces and escaped characters). Add BareLiteral to the
grammar comment per spec Section 10.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Remove ErrorPolicy enum (continue/fail_fast/ignore) and the k_of_n/quorum
join policies from the parallel handler, leaving only wait_all and
first_success. This deletes ~180 lines of conditional logic including
FailFast early termination, the ParallelEarlyTermination event, and all
related tests and documentation.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Remove any-edge fallback from select_edge() in deterministic mode; random
mode retains it as an enhancement over the base spec
- Restrict preferred_label and suggested_next_ids matching to unconditional
edges only (already applied in prior work, tests added here)
- Rename default_max_retry → default_max_retries across codebase (code, docs,
fixtures, skills) and change default from 3 to 0
- Update transitions.mdx to document edge selection cascade accurately
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Introduce a reusable Warning { kind, message, details } variant in
AgentEvent so non-fatal warnings (context window usage, deprecation,
etc.) share a single event shape. The context_window warning preserves
all original fields inside the JSON details object.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Introduces Session::transition() to validate and emit events on state
changes. Processing→Idle now emits ProcessingEnd (matching the spec's
PROCESSING_END). All bare state assignments go through transition().
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Replaces set_subagent_manager() with an Option parameter on the
constructor so the dependency is explicit at creation time.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Matches spec shutdown order: cleanup subagents → emit SESSION_END →
transition to CLOSED. Session now holds an optional SubAgentManager
reference and calls close_all() during shutdown.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Expands the HTTP status code mapping from 500-504 to 500-599 so that
uncommon 5xx codes (505, 507, etc.) are correctly classified as
retryable ServerError instead of falling through to message-based
heuristics. The existing 529 (Overloaded) handling is subsumed by
the broader range.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Aligns with spec update: 408 timeout errors are now non-retryable
by default. Applications can opt in to timeout retries via custom
retry logic. RequestTimeout remains failover-eligible since a
different provider may not share the same timeout.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Introduces a typed ReasoningEffort enum (Low, Medium, High) with
serde, Display, and FromStr support. Updates Request, GenerateParams,
and SessionConfig to use Option<ReasoningEffort> instead of
Option<String>. Aligns with spec change removing "none" as a valid
reasoning_effort value.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The capabilities() method was removed from the trait but the README
still listed it with an incorrect return type.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Align with attractor spec update: both limits now default to 0
(unlimited) instead of 200 and 50 respectively. The
max_tool_rounds_per_input loop check now guards on > 0 so that 0
means no limit.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Move model facts (knowledge_cutoff, context_window) to fabro-model catalog as
source of truth. Move request-shaping (auto-thinking, 1M beta headers, Gemini
safety settings) into fabro-llm adapters. Delete ProfileCapabilities struct and
all dead code (supports_reasoning, supports_streaming, supports_parallel_tool_calls,
OpenAiProfile.reasoning_effort). Fix "powered by OpenAI" mislabeling for
Kimi/ZAI/Minimax/Inception providers.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Delete the single-implementor LanguageModel trait and merge its methods
into inherent impl on a renamed Model struct. Change provider field from
String to Provider enum, eliminating constant string↔enum conversions
across the codebase. Fix Provider serde attributes so OpenAi serializes
as "openai" (not "open_ai") to match catalog.json.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Introduce OOP API for the model catalog: LanguageModel trait with blanket
impl on ModelInfo, Catalog struct with typed methods (get, list,
default_for_provider, closest, build_fallback_chain, etc.), ModelRef enum
replacing ModelId, and Provider::OpenAiCompatible variant. Migrate all
callers across the workspace to use Catalog::builtin() and remove the old
free-function API.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
reqwest::Client::new() queries macOS SCDynamicStore for system proxy
settings, which calls CFBundleGetMainBundle() → readdir() on
target/debug/deps/. With 576K stale build artifacts accumulated in
that directory, each readdir() took 1.3s, causing 15s+ delays when
multiple test processes ran concurrently.
- Disable jsonschema default features to remove unnecessary reqwest@0.13
and rustls-platform-verifier dependencies
- Make reqwest::Client lazy in web_search tool (OnceLock) to avoid
constructing it during profile tests
- Mark validate_api_key_rejects_invalid_key as #[ignore] since it hits
the live Anthropic API (3.2s per invocation)
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
## Summary
- **Unify foreground and detach code paths**: Both `fabro run` modes now
go through the same `create_run() + start_run()` pipeline, with
foreground adding `attach_run()`. Only `--preflight` remains as a
special case.
- **Fix three bugs in create→start→attach path**: (1) `_run_engine`
crashed for `.fabro` workflows by hardcoding `run.toml` — now falls back
to `graph.fabro`; (2) `attach_run` couldn't detect crashed engines due
to zombie processes — `start_run` now returns the `Child` handle; (3)
`create_run` ignored `--run-id`.
- **Configure nextest slow-timeout profiles**: Tighten unit test timeout
to 2s slow / 4s kill, add `e2e` profile with 10s/30s. Switch CI and docs
to `cargo nextest run`.
## Test plan
- [ ] `cargo nextest run --workspace` passes with new timeout profiles
- [ ] `fabro run <workflow>` works in foreground mode (create + start +
attach)
- [ ] `fabro run --detach <workflow>` prints run ID and exits
- [ ] `fabro attach <run>` works standalone (without child handle)
- [ ] `fabro resume <run>` works for both `.toml` and `.fabro` workflows
🤖 Generated with [Claude Code](https://claude.com/claude-code)
---------
Co-authored-by: Fabro <noreply@fabro.sh>
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>