Skip to content

fix(guardrails): plugin config missing — runtime loading broken #132

@terisuke

Description

@terisuke

Problem

The guardrails plugin (guardrail.ts, team.ts) exists in packages/guardrails/profile/plugins/ but was never registered in opencode.json's plugin field.

Impact: At runtime via the binary, the guardrails plugin is never loaded. All hooks (21+ hooks, 1184 lines) are dead code at runtime.

Why tests passed: Scenario tests call Plugin.trigger() directly, bypassing config-based plugin loading. This masked the issue since Wave 1.

Root Cause

The plugin field in opencode.json drives plugin_origins in the config system, which feeds PluginLoader.loadExternal(). Without this field, the plugin loader receives an empty list.

Fix

Add "plugin": ["./plugins/guardrail.ts", "./plugins/team.ts"] to packages/guardrails/profile/opencode.json.

Verification

  • opencode debug config --print-logsloading plugin path=file:///...guardrail.ts confirmed
  • Integration test: plugin discovery → session.created → state init → hard blocks → env vars

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions