@@ -1080,6 +1080,18 @@ func (a *agent) handleManifest(manifestOK *checkpoint) func(ctx context.Context,
10801080 if manifest .AgentID == uuid .Nil {
10811081 return xerrors .New ("nil agentID returned by manifest" )
10821082 }
1083+ if manifest .ParentID != uuid .Nil {
1084+ // This is a sub agent, disable all the features that should not
1085+ // be used by sub agents.
1086+ a .logger .Debug (ctx , "sub agent detected, disabling features" ,
1087+ slog .F ("parent_id" , manifest .ParentID ),
1088+ slog .F ("agent_id" , manifest .AgentID ),
1089+ )
1090+ if a .experimentalDevcontainersEnabled {
1091+ a .logger .Info (ctx , "devcontainers are not supported on sub agents, disabling feature" )
1092+ a .experimentalDevcontainersEnabled = false
1093+ }
1094+ }
10831095 a .client .RewriteDERPMap (manifest .DERPMap )
10841096
10851097 // Expand the directory and send it back to coderd so external
@@ -1188,7 +1200,7 @@ func (a *agent) handleManifest(manifestOK *checkpoint) func(ctx context.Context,
11881200// createOrUpdateNetwork waits for the manifest to be set using manifestOK, then creates or updates
11891201// the tailnet using the information in the manifest
11901202func (a * agent ) createOrUpdateNetwork (manifestOK , networkOK * checkpoint ) func (context.Context , proto.DRPCAgentClient26 ) error {
1191- return func (ctx context.Context , _ proto.DRPCAgentClient26 ) (retErr error ) {
1203+ return func (ctx context.Context , aAPI proto.DRPCAgentClient26 ) (retErr error ) {
11921204 if err := manifestOK .wait (ctx ); err != nil {
11931205 return xerrors .Errorf ("no manifest: %w" , err )
11941206 }
@@ -1208,6 +1220,7 @@ func (a *agent) createOrUpdateNetwork(manifestOK, networkOK *checkpoint) func(co
12081220 // agent API.
12091221 network , err = a .createTailnet (
12101222 a .gracefulCtx ,
1223+ aAPI ,
12111224 manifest .AgentID ,
12121225 manifest .DERPMap ,
12131226 manifest .DERPForceWebSockets ,
@@ -1355,6 +1368,7 @@ func (a *agent) trackGoroutine(fn func()) error {
13551368
13561369func (a * agent ) createTailnet (
13571370 ctx context.Context ,
1371+ aAPI proto.DRPCAgentClient26 ,
13581372 agentID uuid.UUID ,
13591373 derpMap * tailcfg.DERPMap ,
13601374 derpForceWebSockets , disableDirectConnections bool ,
@@ -1487,7 +1501,7 @@ func (a *agent) createTailnet(
14871501 }()
14881502 if err = a .trackGoroutine (func () {
14891503 defer apiListener .Close ()
1490- apiHandler , closeAPIHAndler := a .apiHandler ()
1504+ apiHandler , closeAPIHAndler := a .apiHandler (aAPI )
14911505 defer func () {
14921506 _ = closeAPIHAndler ()
14931507 }()
0 commit comments