Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

fix(agent): start devcontainers through agentcontainers package#18471

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
DanielleMaywood merged 25 commits intomainfromdm-devcontainer-log-spam
Jun 25, 2025
Merged
Show file tree
Hide file tree
Changes from1 commit
Commits
Show all changes
25 commits
Select commitHold shift + click to select a range
978c871
fix(agent): start devcontainers through agentcontainers package
DanielleMaywoodJun 20, 2025
fe99bd6
chore: appease formatter
DanielleMaywoodJun 20, 2025
aeae6e2
chore: fix test, appease linter
DanielleMaywoodJun 20, 2025
916f7e8
chore: feedback
DanielleMaywoodJun 24, 2025
53e256b
Merge branch 'main' into dm-devcontainer-log-spam
DanielleMaywoodJun 24, 2025
91bb43a
chore: re-add script timings
DanielleMaywoodJun 24, 2025
81fe11d
fix: change how containerAPI is stored
DanielleMaywoodJun 24, 2025
5c70a8c
Merge branch 'main' into dm-devcontainer-log-spam
DanielleMaywoodJun 24, 2025
8437ca4
chore: appease linter
DanielleMaywoodJun 24, 2025
2c6a2b1
chore: ensure the last log line is printed
DanielleMaywoodJun 24, 2025
a512ad4
chore: fix typo
DanielleMaywoodJun 24, 2025
c50dc6e
chore: OOPS
DanielleMaywoodJun 24, 2025
4d40ef2
chore: 1 -> 2
DanielleMaywoodJun 24, 2025
ce32e2e
chore: add a status to the timings
DanielleMaywoodJun 24, 2025
32ac48a
chore: initialize containerapi even earlier
DanielleMaywoodJun 24, 2025
738b755
chore: only enable when devcontainers are enabled
DanielleMaywoodJun 24, 2025
3714fec
chore: simplify things a little
DanielleMaywoodJun 24, 2025
996d440
chore: recreate -> create with argument
DanielleMaywoodJun 24, 2025
ae5dd1e
chore: ensure we close and init
DanielleMaywoodJun 24, 2025
9d76cf6
chore: appease linter
DanielleMaywoodJun 24, 2025
7285c39
chore: mock ReadConfig any time
DanielleMaywoodJun 24, 2025
3fce51c
chore: feedback
DanielleMaywoodJun 25, 2025
54aa84a
chore: feedback
DanielleMaywoodJun 25, 2025
3d08d0e
chore: only set status if not set, and run create in test
DanielleMaywoodJun 25, 2025
fa479fc
chore: feedback on poor error message
DanielleMaywoodJun 25, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
PrevPrevious commit
NextNext commit
chore: only enable when devcontainers are enabled
  • Loading branch information
@DanielleMaywood
DanielleMaywood committedJun 24, 2025
commit738b755bb329e3dc264a86b30ddfbf05b0611de1
35 changes: 22 additions & 13 deletionsagent/agent.go
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -336,16 +336,18 @@ func (a *agent) init() {
// will not report anywhere.
a.scriptRunner.RegisterMetrics(a.prometheusRegistry)

containerAPIOpts := []agentcontainers.Option{
agentcontainers.WithExecer(a.execer),
agentcontainers.WithCommandEnv(a.sshServer.CommandEnv),
agentcontainers.WithScriptLogger(func(logSourceID uuid.UUID) agentcontainers.ScriptLogger {
return a.logSender.GetScriptLogger(logSourceID)
}),
}
containerAPIOpts = append(containerAPIOpts, a.containerAPIOptions...)
if a.devcontainers {
containerAPIOpts := []agentcontainers.Option{
agentcontainers.WithExecer(a.execer),
agentcontainers.WithCommandEnv(a.sshServer.CommandEnv),
agentcontainers.WithScriptLogger(func(logSourceID uuid.UUID) agentcontainers.ScriptLogger {
return a.logSender.GetScriptLogger(logSourceID)
}),
}
containerAPIOpts = append(containerAPIOpts, a.containerAPIOptions...)

a.containerAPI = agentcontainers.NewAPI(a.logger.Named("containers"), containerAPIOpts...)
a.containerAPI = agentcontainers.NewAPI(a.logger.Named("containers"), containerAPIOpts...)
}

a.reconnectingPTYServer = reconnectingpty.NewServer(
a.logger.Named("reconnecting-pty"),
Expand DownExpand Up@@ -1106,6 +1108,9 @@ func (a *agent) handleManifest(manifestOK *checkpoint) func(ctx context.Context,
if a.devcontainers {
a.logger.Info(ctx, "devcontainers are not supported on sub agents, disabling feature")
a.devcontainers = false
if err := a.containerAPI.Close(); err != nil {
a.logger.Error(ctx, "disable container API", slog.Error(err))
}
}
}
a.client.RewriteDERPMap(manifest.DERPMap)
Expand DownExpand Up@@ -1310,8 +1315,10 @@ func (a *agent) createOrUpdateNetwork(manifestOK, networkOK *checkpoint) func(co
network.SetBlockEndpoints(manifest.DisableDirectConnections)

// Update the subagent client if the container API is available.
client := agentcontainers.NewSubAgentClientFromAPI(a.logger, aAPI)
a.containerAPI.UpdateSubAgentClient(client)
if a.containerAPI != nil {
client := agentcontainers.NewSubAgentClientFromAPI(a.logger, aAPI)
a.containerAPI.UpdateSubAgentClient(client)
}
}
return nil
}
Expand DownExpand Up@@ -1912,8 +1919,10 @@ func (a *agent) Close() error {
a.logger.Error(a.hardCtx, "script runner close", slog.Error(err))
}

if err := a.containerAPI.Close(); err != nil {
a.logger.Error(a.hardCtx, "container API close", slog.Error(err))
if a.containerAPI != nil {
if err := a.containerAPI.Close(); err != nil {
a.logger.Error(a.hardCtx, "container API close", slog.Error(err))
}
}

// Wait for the graceful shutdown to complete, but don't wait forever so
Expand Down
2 changes: 2 additions & 0 deletionsagent/agentcontainers/api.go
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -1605,6 +1605,8 @@ func (api *API) Close() error {
api.logger.Debug(api.ctx, "closing API")
api.closed = true

close(api.initialized)

// Stop all running subagent processes and clean up.
subAgentIDs := make([]uuid.UUID, 0, len(api.injectedSubAgentProcs))
for workspaceFolder, proc := range api.injectedSubAgentProcs {
Expand Down
Loading

[8]ページ先頭

©2009-2025 Movatter.jp