You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
"Guardrail" means two different things in the public API: the input/output/tool guardrails of createAgent({ guardrails }) (IoGuardrail, regexGuardrail(), GuardrailError, the guardrail.tripped event, finishReason: 'guardrail') and the fail-closed checks over a proposed diff (runGuardrails(), Guardrail, secretScanGuardrail). A user who reads "guardrail" in an event or error cannot tell which one is meant, and Guardrail (the patch check) sits next to IoGuardrail. Renaming the patch checks before 1.0 leaves "guardrail" with one meaning. Audit evidence: .agent-loop/audit2/our-report.md section 5, row "Diff guardrails" ("rename or split the page"), and section 4 (src/execution/guardrails.ts:112 "LOU-J (not yet landed)" stale note).
Current state
Verified on main at cc5ddb8:
src/execution/guardrails.ts (393 lines), re-exported by src/execution/index.ts:16 (export * from './guardrails'), 13 root exports: ProposedAction (:117), GuardrailResult (:124), Guardrail (:132), runGuardrailSafely (:144), createDiffSizeGuardrail (:182), SECRET_PATTERNS (:205), secretScanGuardrail (:215), CommandGuardrailOptions (:234), createCommandGuardrail (:284), createTestRunGuardrail (:337), createLintGuardrail (:347), RunGuardrailsResult (:357), runGuardrails (:369). The comment at :110-116 says "LOU-J (not yet landed) is expected to define the real ProposedAction".
src/execution/ioGuardrails.ts:14 imports SECRET_PATTERNS from ./guardrails (the default pattern list of regexGuardrail(), :167). Because of that import, createAgent() reaches guardrails.ts, which imports node:child_process; src/deploy/bundle.ts:103 lists 'execution/guardrails' in NODE_SHIMMED_IMPORTERS so the Cloudflare Worker build shims it.
Tests: src/execution/guardrails.test.ts.
Examples: examples/ops-pipeline/guardedPr.ts:5,23-27,45,49,59,70-73,83, guardedPr.test.ts, index.ts:46,95,100,144, pipeline.eval.ts:32,118,125, README.md:17-18 (all import deep paths such as ../../src/execution/guardrails).
No Agent Forge use (grep of apps/agent-forge/{src,server,shared}).
Spec files: src/spec/guardrailOptions.ts (SPEC_GUARDRAIL_NAMES) configures the input/output guardrails only; unaffected.
Scope
In:
Rename the file src/execution/guardrails.ts to src/execution/patchChecks.ts (and its test to patchChecks.test.ts), with these renames (decided: "patch check" says what is checked and does not collide with guardrail):
Old
New
ProposedAction
ProposedPatch
GuardrailResult
PatchCheckResult
Guardrail
PatchCheck
runGuardrailSafely
runPatchCheckSafely
runGuardrails
runPatchChecks
RunGuardrailsResult
RunPatchChecksResult
createDiffSizeGuardrail
createDiffSizeCheck
secretScanGuardrail
secretScanCheck
CommandGuardrailOptions
CommandCheckOptions
createCommandGuardrail
createCommandCheck
createTestRunGuardrail
createTestRunCheck
createLintGuardrail
createLintCheck
SECRET_PATTERNS
SECRET_PATTERNS (unchanged)
Shapes and behavior do not change ({ name, check(patch) }, { pass, reason? }, the 30 s default timeout, fail-closed). No deprecated aliases: the old names would sit in the surface that A7 freezes.
Move SECRET_PATTERNS to a new Node-free module src/execution/secretPatterns.ts; patchChecks.ts and ioGuardrails.ts import it from there, so createAgent() no longer reaches the patch checks. Update src/deploy/bundle.ts:103: replace 'execution/guardrails' with 'execution/patchChecks' only if the Cloudflare build still needs it (run npx vitest run src/deploy/adapters/cloudflare.test.ts; if it passes without the entry, remove it and say so in the pull request).
Delete the stale "LOU-J (not yet landed)" comment; describe ProposedPatch as "the diff a patch check vets".
src/execution/index.ts:16: export * from './patchChecks' and export { SECRET_PATTERNS } from './secretPatterns'.
Update the ops-pipeline example and its README to the new names (its tests and eval must pass).
Docs: docs/guardrails.md intro and section: rename the heading "## Patch guardrails" to "## Patch checks" (same position, so the Arabic page stays aligned by position; it needs its heading text translated), and use the new names in the snippet, table and prose; :86 says "the secretScanCheck patterns". docs/api-overview.md:606-608 and README.md:98,203,229 use the new names. The page title "Guardrails and sandboxing" stays.
Append the 12 old names to src/publicSurface.test.ts / .test-d.ts as absent from the root, and the 12 new names as present.
CHANGELOG ### Breaking entry with the migration note below.
Out:
Input/output guardrails (src/execution/ioGuardrails.ts): unchanged apart from the SECRET_PATTERNS import. N5 adds new ones.
Moving the patch checks to a subpath: they stay in the root.
Acceptance criteria
grep -rnw "runGuardrails\|createDiffSizeGuardrail\|secretScanGuardrail\|createCommandGuardrail\|createTestRunGuardrail\|createLintGuardrail\|ProposedAction\|GuardrailResult\|RunGuardrailsResult\|CommandGuardrailOptions\|runGuardrailSafely" src examples docs/*.md README.md finds nothing (CHANGELOG excepted); grep -rnw "Guardrail" src --include=*.ts finds no type named Guardrail (only IoGuardrail and prose).
Root export count unchanged (12 renamed, SECRET_PATTERNS kept); both numbers in the pull request.
src/execution/patchChecks.test.ts passes with the same cases as before; npx vitest run examples/ops-pipeline passes; npx vitest run src/deploy passes.
docs/guardrails.md heading renamed in place; npm run docs:verify-snippets -- --skip-build and npm run docs:llms re-run. The pull request names guardrails as a docs-site page whose Arabic heading text must be updated.
Full verification list in BRIEF-2.md passes.
CHANGELOG ### Breaking entry:
The patch guardrails are now called patch checks, so "guardrail" only means the input/output/tool guardrails of createAgent({ guardrails }). Rename: runGuardrails to runPatchChecks, Guardrail to PatchCheck, GuardrailResult to PatchCheckResult, ProposedAction to ProposedPatch, RunGuardrailsResult to RunPatchChecksResult, runGuardrailSafely to runPatchCheckSafely, secretScanGuardrail to secretScanCheck, createDiffSizeGuardrail to createDiffSizeCheck, createCommandGuardrail to createCommandCheck (options type CommandCheckOptions), createTestRunGuardrail to createTestRunCheck, createLintGuardrail to createLintCheck. Arguments, results and behavior are unchanged. SECRET_PATTERNS keeps its name.
Live test
None: this ticket spends nothing.
Dependencies
A1, A2a, A2b, A2c, A3 (all edit src/execution/index.ts, src/publicSurface.test.ts and CHANGELOG.md; run after them).
N5 (guardrail starter set) edits src/execution/ioGuardrails.ts and docs/guardrails.md; if N5 is open when you start, wait for it or rebase onto it.
Owner decision required before starting (see Notes).
Notes for the implementer
Owner question (record the answer in the issue before starting): "May A5 rename the 12 patch-guardrail exports (runGuardrails and friends) to patch checks, without deprecated aliases, in the next alpha?"
Use git mv for both file renames so history follows.
src/execution/guardrails.test.ts may be one of the flaky timeout tests named in BRIEF-2.md ("guardrails.test.ts timeout tests are flaky under load"); a timeout there after the rename is the known flake, re-run it alone before investigating.
Event and error names that contain "guardrail" (guardrail.tripped, GuardrailError, LOUSHO_GUARDRAIL_TRIPPED, finishReason: 'guardrail') belong to the input/output guardrails and stay.
Round 2 ticket A5. Before starting, read the agent brief (worktree rules, verification list, live-test budget) and the plan. One ticket is one pull request; put Closes #<this issue> in it.
Goal
"Guardrail" means two different things in the public API: the input/output/tool guardrails of
createAgent({ guardrails })(IoGuardrail,regexGuardrail(),GuardrailError, theguardrail.trippedevent,finishReason: 'guardrail') and the fail-closed checks over a proposed diff (runGuardrails(),Guardrail,secretScanGuardrail). A user who reads "guardrail" in an event or error cannot tell which one is meant, andGuardrail(the patch check) sits next toIoGuardrail. Renaming the patch checks before 1.0 leaves "guardrail" with one meaning. Audit evidence:.agent-loop/audit2/our-report.mdsection 5, row "Diff guardrails" ("rename or split the page"), and section 4 (src/execution/guardrails.ts:112"LOU-J (not yet landed)" stale note).Current state
Verified on
mainatcc5ddb8:src/execution/guardrails.ts(393 lines), re-exported bysrc/execution/index.ts:16(export * from './guardrails'), 13 root exports:ProposedAction(:117),GuardrailResult(:124),Guardrail(:132),runGuardrailSafely(:144),createDiffSizeGuardrail(:182),SECRET_PATTERNS(:205),secretScanGuardrail(:215),CommandGuardrailOptions(:234),createCommandGuardrail(:284),createTestRunGuardrail(:337),createLintGuardrail(:347),RunGuardrailsResult(:357),runGuardrails(:369). The comment at:110-116says "LOU-J (not yet landed) is expected to define the real ProposedAction".src/execution/ioGuardrails.ts:14importsSECRET_PATTERNSfrom./guardrails(the default pattern list ofregexGuardrail(),:167). Because of that import,createAgent()reachesguardrails.ts, which importsnode:child_process;src/deploy/bundle.ts:103lists'execution/guardrails'inNODE_SHIMMED_IMPORTERSso the Cloudflare Worker build shims it.src/execution/guardrails.test.ts.examples/ops-pipeline/guardedPr.ts:5,23-27,45,49,59,70-73,83,guardedPr.test.ts,index.ts:46,95,100,144,pipeline.eval.ts:32,118,125,README.md:17-18(all import deep paths such as../../src/execution/guardrails).docs/guardrails.md:1-8(intro says "patch guardrails"),:86(regexGuardraildefault "thesecretScanGuardrailpatterns"),:90-126(section "## Patch guardrails", snippet at:98, table:114-119, fail-closed paragraph:121-126);docs/api-overview.md:606-608;README.md:98,:203,:229.apps/agent-forge/{src,server,shared}).src/spec/guardrailOptions.ts(SPEC_GUARDRAIL_NAMES) configures the input/output guardrails only; unaffected.Scope
In:
Rename the file
src/execution/guardrails.tstosrc/execution/patchChecks.ts(and its test topatchChecks.test.ts), with these renames (decided: "patch check" says what is checked and does not collide with guardrail):ProposedActionProposedPatchGuardrailResultPatchCheckResultGuardrailPatchCheckrunGuardrailSafelyrunPatchCheckSafelyrunGuardrailsrunPatchChecksRunGuardrailsResultRunPatchChecksResultcreateDiffSizeGuardrailcreateDiffSizeChecksecretScanGuardrailsecretScanCheckCommandGuardrailOptionsCommandCheckOptionscreateCommandGuardrailcreateCommandCheckcreateTestRunGuardrailcreateTestRunCheckcreateLintGuardrailcreateLintCheckSECRET_PATTERNSSECRET_PATTERNS(unchanged)Shapes and behavior do not change (
{ name, check(patch) },{ pass, reason? }, the 30 s default timeout, fail-closed). No deprecated aliases: the old names would sit in the surface that A7 freezes.Move
SECRET_PATTERNSto a new Node-free modulesrc/execution/secretPatterns.ts;patchChecks.tsandioGuardrails.tsimport it from there, socreateAgent()no longer reaches the patch checks. Updatesrc/deploy/bundle.ts:103: replace'execution/guardrails'with'execution/patchChecks'only if the Cloudflare build still needs it (runnpx vitest run src/deploy/adapters/cloudflare.test.ts; if it passes without the entry, remove it and say so in the pull request).Delete the stale "LOU-J (not yet landed)" comment; describe
ProposedPatchas "the diff a patch check vets".src/execution/index.ts:16:export * from './patchChecks'andexport { SECRET_PATTERNS } from './secretPatterns'.Update the ops-pipeline example and its README to the new names (its tests and eval must pass).
Docs:
docs/guardrails.mdintro and section: rename the heading "## Patch guardrails" to "## Patch checks" (same position, so the Arabic page stays aligned by position; it needs its heading text translated), and use the new names in the snippet, table and prose;:86says "thesecretScanCheckpatterns".docs/api-overview.md:606-608andREADME.md:98,203,229use the new names. The page title "Guardrails and sandboxing" stays.Append the 12 old names to
src/publicSurface.test.ts/.test-d.tsas absent from the root, and the 12 new names as present.CHANGELOG
### Breakingentry with the migration note below.Out:
src/execution/ioGuardrails.ts): unchanged apart from theSECRET_PATTERNSimport. N5 adds new ones.Acceptance criteria
grep -rnw "runGuardrails\|createDiffSizeGuardrail\|secretScanGuardrail\|createCommandGuardrail\|createTestRunGuardrail\|createLintGuardrail\|ProposedAction\|GuardrailResult\|RunGuardrailsResult\|CommandGuardrailOptions\|runGuardrailSafely" src examples docs/*.md README.mdfinds nothing (CHANGELOG excepted);grep -rnw "Guardrail" src --include=*.tsfinds no type namedGuardrail(onlyIoGuardrailand prose).SECRET_PATTERNSkept); both numbers in the pull request.src/execution/patchChecks.test.tspasses with the same cases as before;npx vitest run examples/ops-pipelinepasses;npx vitest run src/deploypasses.docs/guardrails.mdheading renamed in place;npm run docs:verify-snippets -- --skip-buildandnpm run docs:llmsre-run. The pull request namesguardrailsas a docs-site page whose Arabic heading text must be updated.### Breakingentry:Live test
None: this ticket spends nothing.
Dependencies
src/execution/index.ts,src/publicSurface.test.tsandCHANGELOG.md; run after them).src/execution/ioGuardrails.tsanddocs/guardrails.md; if N5 is open when you start, wait for it or rebase onto it.Notes for the implementer
runGuardrailsand friends) to patch checks, without deprecated aliases, in the next alpha?"git mvfor both file renames so history follows.src/execution/guardrails.test.tsmay be one of the flaky timeout tests named in BRIEF-2.md ("guardrails.test.tstimeout tests are flaky under load"); a timeout there after the rename is the known flake, re-run it alone before investigating.guardrail.tripped,GuardrailError,LOUSHO_GUARDRAIL_TRIPPED,finishReason: 'guardrail') belong to the input/output guardrails and stay.Round 2 ticket
A5. Before starting, read the agent brief (worktree rules, verification list, live-test budget) and the plan. One ticket is one pull request; putCloses #<this issue>in it.