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
{{ message }}
Repository navigation
Commit 3616f9d
Browse filesBrowse the repository at this point in the historyBrowse files
fix(guardrails): translate the 2.x tool vocabulary for the 1.x guards; worker placement, permissions, launcher
Review round on #343 (code-reviewer agent + Codex route A, 2026-10-19): the bridge loaded and passed its tests, but
most tool gates never fired on 2.x because 2.x renamed the built-in tools and their argument keys
(packages/core/src/v1/config/migrate.ts normalizeAction: bash→shell, task→subagent, write/patch→edit; file tools take
`path`, the subagent tool `agent`, the shell result `metadata.exit`) and the 1.x guards compare against the old names
(a `shell` cat of the dotenv file, a `read {path}` of a secret file, `git push origin dev` all passed; with the 1.x
shapes they blocked).
- adapter: toV1Call / toV2Input translate every tool call to the 1.x shape before the hook and back afterwards
(a native `patch` is judged as an edit of its first file); execute.after maps `metadata.exit` → `exitCode` and marks
a tool error with a string, as guardrail-access.ts expects; the provider gate also runs on the compaction / generate /
title hooks; model catalog misses are cached (TTL 60 s); `permission.asked` is handed to the 1.x event hook with
permission/patterns; the event loop re-subscribes with backoff instead of dying with the stream
- command.execute.before: 2.x expands a command into a plain prompt (core/src/config/plugin/command.ts), so the five
packaged command templates end with `<!-- guardrails:command=NAME -->` and the prompt hook recognises the marker
(literal `/name` text still works); workflow_phase and the state summary reach the model again
- client: permission rules and the 1.x per-prompt `tools: { x: false }` list go through normalizeAction and become 2.x
`permissions` (deny rules via session.update); a child created with parentID inherits the parent's location in 2.x,
so the worker is moved to its isolated worktree with session.move; `noReply` notifications become a synthetic
message with resume:false (no model run, no wait); a failed/interrupted execution is kept (events.ts) and surfaced
to team.ts as an errored assistant row instead of a clean "done"
- bin/opencode-guardrails: OPENCODE_CONFIG_DIR replaces the global config dir in 2.x, so the user's global
opencode.json(c) is re-added through OPENCODE_CONFIG; extra plugins merge into an existing OPENCODE_CONFIG_CONTENT;
no checkout candidate (bun install does not fetch the CLI binaries); PATH scan skips wrappers without reading large
binaries; a `.cjs` shim target does not inherit OPENCODE_BIN_PATH (it would loop)
- tool.ts: no additionalProperties:false (zod stripped unknown keys)
- bun.lock: workspace entry for packages/guardrails (frozen installs failed without it)
Verified: bun test profile/src profile/plugins 110 pass / 0 fail — new tests fire 2.x-shaped calls (shell cat of the
dotenv file, `git push origin dev`, read {path} of a secret file, edit of the guardrail state) and expect the block,
check exit code / error mapping, rule and tool-deny mapping, session.move, noReply → synthetic, failure row, marker
detection, toV1Call/toV2Input round trip; live load with @opencode/cli 2.0.32 (scratch XDG, no key): 3 plugin
directories, 0 failed loads, run starts as implement · glm-5.3.
Agent-Lane: claude-code
Co-Authored-By: Claude Fable 5.1 <[email protected]>
Copy file name to clipboardExpand all lines: packages/guardrails/profile/commands/implement.md
+2Lines changed: 2 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -14,3 +14,5 @@ Requirements:
14
14
- for AI agent instrumentation or metric work, use source-level hooks only, add integration/smoke coverage, and include traceability from acceptance criteria to code paths
0 commit comments