feat(surface,sdk): lower postfix .gate(config) to slice-P named gates - #372
Conversation
Step<T>.gate() is now an overload: - gate(config: NamedGate) attaches a slice-P named data gate (references_input, subprocess_gate, word_count_bounds, regex_match) to the step's verification: field. Journal-honest — the gate is data, so it survives replay. - gate(predicate) still refuses with unsupported_gate. JS closures can't be journaled without breaking covenant 1 (journal-as-truth). Closes the "typed but refused" surface oddity: every postfix gate call used to throw regardless of shape. Wire path: - surface: NamedGate union export, .gate() overload - sdk/authored-flow-operation: .gate() checks arg shape, sets operation.namedGate on config or throws on predicate - sdk/authored-flow-executor: run/llm/agent verbs hoist the operation reference, read op.namedGate at start-time, and thread it into the compiled StepSpec - sdk/authored-worker-step: authoredDeterministicRunner + worker.agent/.llm accept optional verification, inject into the step spec Tests: existing predicate-refusal case pinned as gate-predicate-not-lowered; new gate-config-is-lowered case proves the config branch bypasses the unsupported_gate refusal. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> Session-Id: efeda5df-9b7c-48d4-b2ce-957f5bef0a82
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars. ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Advanced Run ID: Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using high effort and found 2 potential issues.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 0bcd7f5. Configure here.
| id, type: 'deterministic', command, | ||
| ...(leaseMs === undefined ? {} : { lease_ms: leaseMs }), | ||
| ...(verification === undefined ? {} : { verification }), | ||
| }], |
There was a problem hiding this comment.
Run gates ignore verification failure
High Severity
f.run().gate(config) lowers a second .gate step into the kernel spec, but the deterministic runner still only reads the producer step's step.completed. A failed named gate therefore never fails the authored f.run step, so postfix verification on f.run does not enforce.
Additional Locations (1)
Reviewed by Cursor Bugbot for commit 0bcd7f5. Configure here.
| // Config-object gate: lowers into the compiled StepSpec's | ||
| // `verification:` field via slice-P named-gate lowering. | ||
| operation.namedGate = configOrPredicate; | ||
| return step; |
There was a problem hiding this comment.
Config gates skip helper steps
Medium Severity
.gate(config) now accepts a named gate on every Step, but only f.run, f.llm, and f.agent read namedGate. Slack, helper, MCP, and plugin starts ignore it, so the call succeeds and the step runs with no verification.
Additional Locations (2)
Reviewed by Cursor Bugbot for commit 0bcd7f5. Configure here.
maintainability lens — FAILMaintainability review — PR #372Blockers1. Test does not verify the behavior it claims to. Concerns2. Four hand-synchronized copies of the gate-kind set, none compile-checked.
The surface's "kept in sync with 3. 4. Silent late/duplicate 5. Notes6. Hoist pattern's invariant is implicit. REVIEW_FAILED |
history lens — PASSBlockers: none identified under the three HISTORY criteria. The diff builds on Concerns:
Notes:
I inspected history and source; I did not execute tests or independently verify the PR’s reported pass counts. The RFC’s referenced sibling charter was absent from this checkout. REVIEW_PASSED |
structure lens — MISSING |
|
🎯 review-swarm: FAILED (M:fail H:pass S:missing) Lens transcripts posted as sibling comments above. |


Closes the 'typed but refused' surface oddity — Step.gate() was declared in the surface but every call threw unsupported_gate at runtime.
Now:
Test plan
Note
Medium Risk
Changes step verification lowering for run/llm/agent paths; predicate gates remain refused but successful flows now enforce named gates at replay time.
Overview
Postfix
.gate({ type: … })on authored steps is now lowered into journal-honest slice-P verification instead of always failing withunsupported_gate.The surface exports typed
NamedGateconfigs (references_input,subprocess_gate,word_count_bounds,regex_match).AuthoredFlowOperationrecords config-object gates onnamedGate; predicate.gate(fn)still throwsunsupported_gatewith a clearer message.f.run,f.llm, andf.agenthoist the operation handle so spec build reads the caller’s gate and passes it into the compiled step’sverification:field. Tests assert predicate gates still refuse and config gates reachjournal.runStart(notunsupported_gate).Reviewed by Cursor Bugbot for commit 0bcd7f5. Bugbot is set up for automated code reviews on this repo. Configure here.