refactor(orchestration): extract init_common and add graph_dirty checkpoint#4809
Merged
Conversation
a5e104f to
80f32c1
Compare
…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
fe3e935 to
da98381
Compare
This was referenced Jun 5, 2026
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
DagScheduler::init_common()private helper from::newand::resume_from, eliminating ~75 lines of duplicated struct initialization code (refactor(orchestration): extract shared init logic from DagScheduler::new and resume_from #4781).graph_dirty: boolfield set on all durable graph mutations;GraphPersistence::save()in the scheduler loop fires only when the flag is set, ensuring task states survive mid-execution crashes (fix(orchestration): graph state is not checkpointed per-tick — mid-execution crashes lose all progress #4747).graph_dirtyflag lifecycle (set-on-terminal, reset-on-take, false-on-dispatch-only).Changes
crates/zeph-orchestration/src/scheduler/mod.rs—init_common()helper,graph_dirtyfield,take_graph_dirty()methodcrates/zeph-orchestration/src/scheduler/tick.rs— setsgraph_dirtyon 5 mutation paths + 8 new unit testscrates/zeph-core/src/agent/scheduler_loop.rs— conditionalGraphPersistence::save()based ongraph_dirtyTest plan
cargo nextest run -p zeph-orchestration -p zeph-core --lib --bins— 1906 passedcargo nextest run --workspace --lib --bins— 10464 passedcargo +nightly fmt --check— cleancargo clippy -p zeph-orchestration -p zeph-core -- -D warnings— cleanRUSTFLAGS="-D warnings" cargo check --workspace --all-targets --features desktop,ide,server,chat,pdf,scheduler --locked— cleanFollow-up
inject_tasksandrecord_predicate_outcomeinpersistence.rsalso mutate task states durably but do not setgraph_dirty(pre-existing gap, not introduced by this PR). Filed as a follow-up P3 issue.Closes #4747
Closes #4781