Bug Description
The agent input defined in github/action.yml is set as the AGENT environment variable, but the opencode github run binary command (packages/opencode/src/cli/cmd/github.ts) never reads process.env.AGENT.
This means the agent: input in GitHub Action workflows has no effect — the session always falls back to default_agent from config, or "build" if unset.
Steps to Reproduce
-
Configure a GitHub Action workflow with a custom agent:
- uses: anomalyco/opencode/github@latest
with:
model: opencode/gpt-5.4
agent: on-call # <-- This is ignored
-
The action.yml correctly maps this to an env var:
env:
AGENT: ${{ inputs.agent }}
-
But github.ts line 943 explicitly omits the agent:
// agent is omitted - server will use default_agent from config or fall back to "build"
-
The session runs under "build" regardless of what agent: was set to.
Expected Behavior
The agent input should be passed through to SessionPrompt.prompt() so the session uses the specified agent and its tool permissions.
Actual Behavior
The AGENT env var is set but never consumed. The session always uses the default agent ("build"), which means agent-specific tool permissions (e.g., datadog_*: true on an on-call agent) are never applied.
Impact
This is a silent failure — the workflow appears to work, but the agent doesn't have access to the MCP tools it needs. In our case, an on-call agent configured with Datadog access was running as build with Datadog tools denied, causing it to fall back to manual investigation methods (grep, curl, etc.) instead of using the Datadog MCP tools.
Suggested Fix
In packages/opencode/src/cli/cmd/github.ts, the chat() function should read process.env.AGENT and pass it to SessionPrompt.prompt():
const agent = process.env["AGENT"] || undefined
const result = await SessionPrompt.prompt({
sessionID: session.id,
messageID: MessageID.ascending(),
variant,
agent, // <-- pass the agent
model: { providerID, modelID },
parts: [ ... ],
})
Workaround
Setting "default_agent": "on-call" in OPENCODE_CONFIG_CONTENT env var overrides the config-level default and works around this issue.
References
github/action.yml — sets AGENT env var from input
packages/opencode/src/cli/cmd/github.ts line 943 — agent omitted comment
packages/opencode/src/session/prompt.ts line 953 — input.agent || defaultAgent() fallback
Bug Description
The
agentinput defined ingithub/action.ymlis set as theAGENTenvironment variable, but theopencode github runbinary command (packages/opencode/src/cli/cmd/github.ts) never readsprocess.env.AGENT.This means the
agent:input in GitHub Action workflows has no effect — the session always falls back todefault_agentfrom config, or"build"if unset.Steps to Reproduce
Configure a GitHub Action workflow with a custom agent:
The
action.ymlcorrectly maps this to an env var:But
github.tsline 943 explicitly omits the agent:// agent is omitted - server will use default_agent from config or fall back to "build"The session runs under
"build"regardless of whatagent:was set to.Expected Behavior
The
agentinput should be passed through toSessionPrompt.prompt()so the session uses the specified agent and its tool permissions.Actual Behavior
The
AGENTenv var is set but never consumed. The session always uses the default agent ("build"), which means agent-specific tool permissions (e.g.,datadog_*: trueon anon-callagent) are never applied.Impact
This is a silent failure — the workflow appears to work, but the agent doesn't have access to the MCP tools it needs. In our case, an
on-callagent configured with Datadog access was running asbuildwith Datadog tools denied, causing it to fall back to manual investigation methods (grep, curl, etc.) instead of using the Datadog MCP tools.Suggested Fix
In
packages/opencode/src/cli/cmd/github.ts, thechat()function should readprocess.env.AGENTand pass it toSessionPrompt.prompt():Workaround
Setting
"default_agent": "on-call"inOPENCODE_CONFIG_CONTENTenv var overrides the config-level default and works around this issue.References
github/action.yml— setsAGENTenv var from inputpackages/opencode/src/cli/cmd/github.tsline 943 — agent omitted commentpackages/opencode/src/session/prompt.tsline 953 —input.agent || defaultAgent()fallback