Skip to content

Commit 7f056da

Browse files
feat: add hidden CODER_AGENT_IS_SUB_AGENT flag to coder agent (#17783)
Closes coder/internal#620 Adds a new, hidden, flag `CODER_AGENT_IS_SUB_AGENT` to the `coder agent` command.
1 parent 0b5f27f commit 7f056da

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

agent/agent.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ type Options struct {
8989
ServiceBannerRefreshInterval time.Duration
9090
BlockFileTransfer bool
9191
Execer agentexec.Execer
92+
SubAgent bool
9293

9394
ExperimentalDevcontainersEnabled bool
9495
ContainerAPIOptions []agentcontainers.Option // Enable ExperimentalDevcontainersEnabled for these to be effective.
@@ -190,6 +191,8 @@ func New(options Options) Agent {
190191
metrics: newAgentMetrics(prometheusRegistry),
191192
execer: options.Execer,
192193

194+
subAgent: options.SubAgent,
195+
193196
experimentalDevcontainersEnabled: options.ExperimentalDevcontainersEnabled,
194197
containerAPIOptions: options.ContainerAPIOptions,
195198
}
@@ -272,6 +275,8 @@ type agent struct {
272275
metrics *agentMetrics
273276
execer agentexec.Execer
274277

278+
subAgent bool
279+
275280
experimentalDevcontainersEnabled bool
276281
containerAPIOptions []agentcontainers.Option
277282
containerAPI atomic.Pointer[agentcontainers.API] // Set by apiHandler.

cli/agent.go

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ func (r *RootCmd) workspaceAgent() *serpent.Command {
5353
blockFileTransfer bool
5454
agentHeaderCommand string
5555
agentHeader []string
56+
subAgent bool
5657

5758
experimentalDevcontainersEnabled bool
5859
)
@@ -350,6 +351,7 @@ func (r *RootCmd) workspaceAgent() *serpent.Command {
350351
PrometheusRegistry: prometheusRegistry,
351352
BlockFileTransfer: blockFileTransfer,
352353
Execer: execer,
354+
SubAgent: subAgent,
353355

354356
ExperimentalDevcontainersEnabled: experimentalDevcontainersEnabled,
355357
})
@@ -481,6 +483,17 @@ func (r *RootCmd) workspaceAgent() *serpent.Command {
481483
Description: "Allow the agent to automatically detect running devcontainers.",
482484
Value: serpent.BoolOf(&experimentalDevcontainersEnabled),
483485
},
486+
{
487+
Flag: "is-sub-agent",
488+
Default: "false",
489+
Env: "CODER_AGENT_IS_SUB_AGENT",
490+
Description: "Specify whether this is a sub agent or not.",
491+
Value: serpent.BoolOf(&subAgent),
492+
// As `coderd` handles the creation of sub-agents, it does not make
493+
// sense for this to be exposed. We do not want people setting an
494+
// agent as a sub-agent if it is not.
495+
Hidden: true,
496+
},
484497
}
485498

486499
return cmd

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy