Require reviewed workflow source hash on start - #557
Conversation
ea1e118 to
275f903
Compare
|
[REVIEW] NO_GO — #557 @ 275f903 — lens: correctness+security+gates, reviewer unresolved-account001 (1 of 1) Reviewed the exact range What I ran and read:
Authoritative forge check rollup read by name:
Blocking P0/P1 findings:
Non-blocking follow-ups:
|
Todos: 40083146-e1a1-4c59-a7b6-a164e27ff37b Agent: agent-chief-shipping
Todos: 40083146-e1a1-4c59-a7b6-a164e27ff37b Agent: agent-chief-shipping
275f903 to
476c5d0
Compare
|
[REVIEW] NO_GO — #557 @ 476c5d0 — fixed reviewer 1 of 1\n\nBlocking P1 findings:\n\n1. Invalid source-snapshot terminalization still skips established cleanup. The path in codex-rs/state/src/runtime/workflows.rs marks only the workflow run failed, clears its owner/lease, and appends an event. The reachable activation path does not stop linked branch agents, cancel pending interactions, release background-agent worktree leases, cancel timers/monitor links, or terminalize child steps/verifiers. The established cancellation path in workflow_orchestrator.rs performs those operations. Existing regression tests assert run status/generation/event count only and do not prove branch-agent, timer, monitor, lease, pending-interaction, step, or verifier cleanup.\n\n2. Required exact-head hosted gates are incomplete. The head/base pair is 476c5d0 / 2fd98cf and mergeStateStatus is UNSTABLE. Fourteen required checks were still in progress at review time, including Linux/Windows Bazel tests and clippy, release builds, Linux CLI build, SDKs, and argument-comment lint.\n\nThe prior workflow-identity fixture defect is fixed: the changed-spec test now preserves the same thread and workflow identity before testing the changed hash.\n\nEvidence: exact immutable head inspection across the workflow storage, activation, orchestration cleanup, automation, migration 0071, manager/API propagation, and changed-spec tests; git diff --check returned rc=0 with empty stdout/stderr. No additional reachable in-scope P0/P1 defect was identified. Focused remediation must address only the cleanup defect and direct regressions; required CI must reach terminal success. |
Todos: 40083146-e1a1-4c59-a7b6-a164e27ff37b Agent: agent-chief-shipping
Problem
Managed workflow creation upserts a specification under a stable workflow record ID. Before this change,
startaccepted that record ID without the hash of the reviewed source, so a same-thread upsert could replace the reviewed YAML before start and the run could execute different source without an identity mismatch.Transactional, immutable-source solution
Workflow creation now returns the SHA-256 of the canonical stored YAML. Both the direct
manage_workflow startaction and the app-server v2 start request require that reviewed hash. Run creation reads the current specification and compares the expected hash inside the same database transaction; a mismatch fails before a run or goal plan is created. A matching start stores both the hash and the full source YAML on the run, and later activation reads that immutable run snapshot instead of a mutable specification. Idempotency replays also refuse a different source hash.Acceptance behavior
Migration and compatibility
Migration
0071_workflow_run_source_yaml_snapshot.sqladds a non-null source snapshot column with an empty default so older binaries remain writable during migration. Existing rows are hydrated only when the current stored specification bytes and SHA exactly match the run's recorded source SHA. A legacy row whose specification changed is terminally rejected before activation instead of being backfilled from mutable source or retried indefinitely.Existing workflow record IDs, list/read behavior, and same-thread upsert identity remain unchanged. Start is intentionally tightened: callers must pass the source hash returned by workflow create/read (
expected_source_yaml_sha256for the manager tool andexpectedSourceYamlSha256for app-server v2).Candidate and verification
2fd98cf2544e08f445a57bd76f27b311eeb23819476c5d02b852c520c09842b7cfb7dacf9a61bc43acf45474371a71c95449c48a45c908784915817c31577192220(running; final result will be recorded before review)Exact affected-lane command:
Tracking and review
Todos implementation task: OPE2-00322 —
40083146-e1a1-4c59-a7b6-a164e27ff37b.Focused remediation review task: OPE2-00323 —
5d9bec41-b90c-4d51-93e1-159b23fbe2ff. The same independent Codewith reviewer fixed before the initial pass will review only the initial P1 migration/activation findings and direct regressions after the exact Testbox gate succeeds.