Skip to content

refactor(orchestration): extract init_common and add graph_dirty checkpoint#4809

Merged
bug-ops merged 2 commits into
mainfrom
orchestration-checkpoint
Jun 5, 2026
Merged

refactor(orchestration): extract init_common and add graph_dirty checkpoint#4809
bug-ops merged 2 commits into
mainfrom
orchestration-checkpoint

Conversation

@bug-ops

@bug-ops bug-ops commented Jun 5, 2026

Copy link
Copy Markdown
Owner

Summary

Changes

  • crates/zeph-orchestration/src/scheduler/mod.rsinit_common() helper, graph_dirty field, take_graph_dirty() method
  • crates/zeph-orchestration/src/scheduler/tick.rs — sets graph_dirty on 5 mutation paths + 8 new unit tests
  • crates/zeph-core/src/agent/scheduler_loop.rs — conditional GraphPersistence::save() based on graph_dirty

Test plan

  • cargo nextest run -p zeph-orchestration -p zeph-core --lib --bins — 1906 passed
  • cargo nextest run --workspace --lib --bins — 10464 passed
  • cargo +nightly fmt --check — clean
  • cargo clippy -p zeph-orchestration -p zeph-core -- -D warnings — clean
  • RUSTFLAGS="-D warnings" cargo check --workspace --all-targets --features desktop,ide,server,chat,pdf,scheduler --locked — clean

Follow-up

inject_tasks and record_predicate_outcome in persistence.rs also mutate task states durably but do not set graph_dirty (pre-existing gap, not introduced by this PR). Filed as a follow-up P3 issue.

Closes #4747
Closes #4781

@github-actions github-actions Bot added documentation Improvements or additions to documentation rust Rust code changes core zeph-core crate labels Jun 5, 2026
@github-actions github-actions Bot added refactor Code refactoring without functional changes size/L Large PR (201-500 lines) labels Jun 5, 2026
@bug-ops bug-ops force-pushed the orchestration-checkpoint branch from a5e104f to 80f32c1 Compare June 5, 2026 12:59
@bug-ops bug-ops enabled auto-merge (squash) June 5, 2026 12:59
bug-ops added 2 commits June 5, 2026 15:18
…kpoint

Extract DagScheduler::init_common() private helper from ::new and
::resume_from, eliminating ~75 lines of duplicated struct initialization.
Only graph-state-specific setup (pre-validation, tracing) differs between
the two constructors.

Add graph_dirty: bool field set on all durable graph mutations (completion,
failure, fatal spawn failure, cancel_all, timeout). GraphPersistence::save()
in scheduler_loop fires only when graph_dirty is true, ensuring task states
survive mid-execution crashes. Add 8 unit tests for the flag lifecycle.

Closes #4747
Closes #4781
@bug-ops bug-ops force-pushed the orchestration-checkpoint branch from fe3e935 to da98381 Compare June 5, 2026 13:18
@bug-ops bug-ops merged commit 5d1caf2 into main Jun 5, 2026
32 checks passed
@bug-ops bug-ops deleted the orchestration-checkpoint branch June 5, 2026 13:26
bug-ops added a commit that referenced this pull request Jun 5, 2026
…ate_outcome

inject_tasks and record_predicate_outcome mutate task state durably but did not
set the graph_dirty flag introduced in #4809. A crash after either mutation and
before the next terminal event (completion, failure, timeout, cancel) would
silently lose the injected or predicate-resolved state.

Set self.graph_dirty = true in inject_tasks after successful insertion and in
all three mutating branches of record_predicate_outcome (pass, fail+rerun,
fail+remediation), matching the pattern in handle_completed_outcome,
handle_failed_outcome, cancel_all, and check_timeouts. Added 3 regression tests.

refactor(memory): add tracing spans to recall hot-path helpers (#4799)

recall_fts5_raw, recall_vectors_raw, and recall_merge_and_rank are the
innermost helpers called on every recall() invocation. Added
#[cfg_attr(feature = "profiling", tracing::instrument(...))] matching the
existing pattern in the file, with span names memory.recall.fts5,
memory.recall.vectors, and memory.recall.merge_and_rank.

refactor(db): add tracing spans to zeph-db async fns (#4822)

Added unconditional #[tracing::instrument(name = "...", skip_all, err)] to
DbConfig::connect, both run_migrations variants, begin, and both begin_write
variants. zeph-db has no profiling feature gate; unconditional instrument
matches the #4821 precedent for this crate.

Closes #4810, Closes #4799, Closes #4822
bug-ops added a commit that referenced this pull request Jun 5, 2026
…ate_outcome (#4831)

inject_tasks and record_predicate_outcome mutate task state durably but did not
set the graph_dirty flag introduced in #4809. A crash after either mutation and
before the next terminal event (completion, failure, timeout, cancel) would
silently lose the injected or predicate-resolved state.

Set self.graph_dirty = true in inject_tasks after successful insertion and in
all three mutating branches of record_predicate_outcome (pass, fail+rerun,
fail+remediation), matching the pattern in handle_completed_outcome,
handle_failed_outcome, cancel_all, and check_timeouts. Added 3 regression tests.

refactor(memory): add tracing spans to recall hot-path helpers (#4799)

recall_fts5_raw, recall_vectors_raw, and recall_merge_and_rank are the
innermost helpers called on every recall() invocation. Added
#[cfg_attr(feature = "profiling", tracing::instrument(...))] matching the
existing pattern in the file, with span names memory.recall.fts5,
memory.recall.vectors, and memory.recall.merge_and_rank.

refactor(db): add tracing spans to zeph-db async fns (#4822)

Added unconditional #[tracing::instrument(name = "...", skip_all, err)] to
DbConfig::connect, both run_migrations variants, begin, and both begin_write
variants. zeph-db has no profiling feature gate; unconditional instrument
matches the #4821 precedent for this crate.

Closes #4810, Closes #4799, Closes #4822
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

core zeph-core crate documentation Improvements or additions to documentation refactor Code refactoring without functional changes rust Rust code changes size/L Large PR (201-500 lines)

Projects

None yet

1 participant