Skip to content

fix(schedule): persist dispatched run links before continuing - #1128

Open
wcy12378 wants to merge 1 commit into
Tencent:mainfrom
wcy12378:codex/schedule-execution-ledger
Open

wcy12378 wants to merge 1 commit into
Tencent:mainfrom
wcy12378:codex/schedule-execution-ledger

Conversation

@wcy12378

Copy link
Copy Markdown

Problem

A scheduled SOP scan only persisted its dispatched Run links when the entire scan finished. If a later dispatch blocked and the process restarted, already-started downstream runs could lose their link to the scheduled execution.

Change

Checkpoint the existing execution's Run links and pulled/dispatched counts after every successful dispatch, before starting the next item. If that checkpoint fails, stop further dispatches and try to save a failed terminal record with the already-started run's evidence. User-facing errors stay generic; storage details remain in scheduler logs.

Related to #460. This is one bounded backend slice; it does not close the broader outcome-attribution issue or duplicate #1123's token-usage work. A dispatch is not counted as a delivered business outcome.

Validation

  • Added regressions for reading the first link while the next dispatch blocks, preserving it through interruption recovery, and stopping on a real SQLite checkpoint-write failure.
  • Added an accounting regression: multiple running checkpoints still produce one finished execution.
  • All 35 top-level internal/schedule tests passed in Linux/amd64 Docker using a cross-compiled Go 1.26.11 test binary, including the three new regressions. The original two regressions failed on the unmodified implementation before the fix.
  • GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go vet ./internal/schedule passed.
  • Existing targeted execution repository tests passed on Windows/SQLite; the optional MySQL cases were skipped because no MySQL test DSN was configured.
  • python scripts/check-public.py and git diff --check passed.
  • Full platform/browser suites, MySQL, and live-model tests were not run for this backend-only slice. Native Windows scheduler compilation is blocked by existing Unix-only runtime syscalls, so scheduler tests ran in Linux.

Compatibility and remaining scope

No schema, API, permission, or runner-protocol changes. The downstream dispatch and its checkpoint are not one atomic transaction: a crash between dispatch success and checkpoint commit can still lose that last link. Recovery reconciliation, durable long-term retention, and structured business-outcome reporting remain follow-up work under #460. A failed checkpoint does not cancel or change the status of a downstream SOP that already started.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant