Repository navigation
feat(engine): bind approvals to artifacts and gate verification nodes - #1070
Open
chenhonggang0623-sketch wants to merge 2 commits into
Open
chenhonggang0623-sketch wants to merge 2 commits into
chenhonggang0623-sketch wants to merge 2 commits into
Conversation
An approval could be recorded against a node that had moved on, and /pass could mark any failed script node as succeeded. Both conventions now have engine enforcement. - NodeExpectation gains artifactName/artifactSha256; approval verifies the newest artifact of that name still carries that hash, returns 409 on a stale decision, and writes gate.approval_rejected with expected and actual values. - WorkflowNode.requires supports artifact:<name>@<sha256> and verdict:<PASS|FAIL>@<diffHash>; an unmet precondition fails the node with both values instead of silently skipping it. - WorkflowNode.verificationStep makes /pass refuse the node unless the request carries override:true; both outcomes are audited with the operator. The JSON name avoids the removed legacy `verification` gate-array field that the API strips on save. - Docs and OpenAPI updated; new engine and HTTP tests cover all three. Co-Authored-By: Claude Code <noreply@anthropic.com>
Review fixes for the approval-binding change: - Half an artifact binding (name without hash or hash without name) is now a 400, not a silently unbound approval. - The rejection audit releases only the lease it acquired and never a worker's live lease, and writes with the revision guard, re-applying the event to the newest snapshot on conflict. - Artifact recency is creation time, not attempt number: attempts are per node, so cross-node attempt comparison picked the wrong artifact. - A requires check is deferred while a sibling is still in flight, so a parallel producer cannot cause a spurious permanent failure. - The SOP overlay carries requires/verificationStep on retry. - Docs/OpenAPI: expected fan-out, half-binding rule, run-global artifact names, verdict case/whitespace, basename, parallel-producer rule, and the scope of /pass versus /approve on a verification step. Co-Authored-By: Claude Code <noreply@anthropic.com>
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.
Motivation
Two human-control conventions were not engine guarantees:
POST /api/runs/{id}/approvecould be recorded against a run state the operator never saw. A stale workbench card, or an artifact that changed between rendering and clicking, still approved something.POST /api/runs/{id}/passcould mark any failed script node as succeeded. A node that exists to verify the change could be bypassed with no trace of who did it.This change binds a human decision to the artifact it reviewed and makes verification nodes refuse
/passwithout an explicit, audited override.What changes
engine.NodeExpectation/ the HTTPexpectedobject gainartifactNameandartifactSha256. Approval checks the newest artifact with that name (by creation time) still carries that hash. A mismatch returns409, appendsgate.approval_rejectedwith expected/actual values, and leaves the node inwaiting_approval. Half a binding (name without hash or vice versa) is400.WorkflowNode.requiressupportsartifact:<name>@<sha256>andverdict:<PASS|FAIL>@<diffHash>. An unmet precondition fails the node with the expected and actual values instead of silently skipping it; the check is deferred while a sibling is still in flight.WorkflowNode.verificationStepmakes/passreturn409and auditnode.pass_rejected;override: truepasses it and auditsnode.passed_overridewith the operator (server-resolved; anonymous is recorded as such).Compatibility
expected(status/attempt/rework mismatch) now returns409instead of400. Same meaning — the decision is stale — and no in-repo client branches on400for these endpoints.verificationSteprather thanverificationbecauseverificationis the removed legacy gate-array field the API strips on save; reusing it breaks that normalization.expectedbehave exactly as before.Tests
internal/engine/gate_binding_test.go,node_requires_test.go,pass_override_test.gointernal/httpapi/gate_binding_http_test.go409+ audit row, bound approval completes the run,/passrefuses a verification node and override recordsoperator=admin.This PR intentionally contains no sidecar or AegisOS integration code.
🤖 Generated with Claude Code