feat: add hidden CODER_AGENT_IS_SUB_AGENT flag to coder agent (#17783)

Closes https://github.com/coder/internal/issues/620

Adds a new, hidden, flag `CODER_AGENT_IS_SUB_AGENT` to the `coder agent`
command.
This commit is contained in:
Danielle Maywood
2025-05-13 10:57:50 +01:00
committed by GitHub
parent 0b5f27f566
commit 7f056da088
2 changed files with 18 additions and 0 deletions

View File

@ -53,6 +53,7 @@ func (r *RootCmd) workspaceAgent() *serpent.Command {
blockFileTransfer bool
agentHeaderCommand string
agentHeader []string
subAgent bool
experimentalDevcontainersEnabled bool
)
@ -350,6 +351,7 @@ func (r *RootCmd) workspaceAgent() *serpent.Command {
PrometheusRegistry: prometheusRegistry,
BlockFileTransfer: blockFileTransfer,
Execer: execer,
SubAgent: subAgent,
ExperimentalDevcontainersEnabled: experimentalDevcontainersEnabled,
})
@ -481,6 +483,17 @@ func (r *RootCmd) workspaceAgent() *serpent.Command {
Description: "Allow the agent to automatically detect running devcontainers.",
Value: serpent.BoolOf(&experimentalDevcontainersEnabled),
},
{
Flag: "is-sub-agent",
Default: "false",
Env: "CODER_AGENT_IS_SUB_AGENT",
Description: "Specify whether this is a sub agent or not.",
Value: serpent.BoolOf(&subAgent),
// As `coderd` handles the creation of sub-agents, it does not make
// sense for this to be exposed. We do not want people setting an
// agent as a sub-agent if it is not.
Hidden: true,
},
}
return cmd