Skip to content

Commit 0f9ad9b

Browse files
committed
fix(agent/agentcontainers): make sure arch is set for sub agents
1 parent 5e3a225 commit 0f9ad9b

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

agent/agentcontainers/api.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1051,6 +1051,10 @@ func (api *API) maybeInjectSubAgentIntoContainerLocked(ctx context.Context, dc c
10511051
)
10521052
return nil
10531053
}
1054+
if proc.agent.ID == uuid.Nil {
1055+
proc.agent.Architecture = arch
1056+
}
1057+
10541058
agentBinaryPath, err := os.Executable()
10551059
if err != nil {
10561060
return xerrors.Errorf("get agent binary path: %w", err)
@@ -1095,6 +1099,8 @@ func (api *API) maybeInjectSubAgentIntoContainerLocked(ctx context.Context, dc c
10951099

10961100
subAgentConfig := proc.agent.CloneConfig(dc)
10971101
if proc.agent.ID == uuid.Nil || maybeRecreateSubAgent {
1102+
subAgentConfig.Architecture = arch
1103+
10981104
// Detect workspace folder by executing `pwd` in the container.
10991105
// NOTE(mafredri): This is a quick and dirty way to detect the
11001106
// workspace folder inside the container. In the future we will

agent/agentcontainers/api_test.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -252,6 +252,15 @@ func (m *fakeSubAgentClient) Create(ctx context.Context, agent agentcontainers.S
252252
}
253253
}
254254
}
255+
if agent.Name == "" {
256+
return agentcontainers.SubAgent{}, xerrors.New("name must be set")
257+
}
258+
if agent.Architecture == "" {
259+
return agentcontainers.SubAgent{}, xerrors.New("architecture must be set")
260+
}
261+
if agent.OperatingSystem == "" {
262+
return agentcontainers.SubAgent{}, xerrors.New("operating system must be set")
263+
}
255264
agent.ID = uuid.New()
256265
agent.AuthToken = uuid.New()
257266
if m.agents == nil {

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