Skip to content

armgit / ax

Public Imported from GitHub
0

Agent Executor (AX) is Google's open agentic orchestration runtime

Go

Rename harnessConfig to agentConfig across the codebase for consistency

Jaana Dogan9faeb23bed39
diff --git a/cmd/ax/harnessconfig.go b/cmd/ax/agentconfig.go
similarity index 72%
rename from cmd/ax/harnessconfig.go
rename to cmd/ax/agentconfig.go
index 24492ab..398f2d9 100644
--- a/cmd/ax/harnessconfig.go
+++ b/cmd/ax/agentconfig.go
@@ -27,46 +27,46 @@ import (
// runConfigMenu shows the /config menu and returns the (possibly updated) config.
// An updated config is sent on subsequent requests.
-func runConfigMenu(d *internal.Display, harnessConfig []byte) ([]byte, error) {
+func runConfigMenu(d *internal.Display, agentConfig []byte) ([]byte, error) {
for {
action, err := d.PromptForConfigAction()
if err != nil {
if errors.Is(err, internal.ErrUserAborted) {
- return harnessConfig, nil // Esc/Ctrl+C on the menu cancels /config.
+ return agentConfig, nil // Esc/Ctrl+C on the menu cancels /config.
}
- return harnessConfig, err
+ return agentConfig, err
}
switch action {
case "edit":
- cfg, done, err := editHarnessConfig(d, harnessConfig)
+ cfg, done, err := editAgentConfig(d, agentConfig)
if err != nil {
- return harnessConfig, err
+ return agentConfig, err
}
if done {
return cfg, nil
}
case "load":
- cfg, done, err := loadHarnessConfig(d)
+ cfg, done, err := loadAgentConfig(d)
if err != nil {
- return harnessConfig, err
+ return agentConfig, err
}
if done {
return cfg, nil
}
default: // "cancel" or anything else
- return harnessConfig, nil
+ return agentConfig, nil
}
}
}
-// editHarnessConfig opens the JSON editor pre-filled with the current config. It
+// editAgentConfig opens the JSON editor pre-filled with the current config. It
// returns the updated config with done=true if the config was updated, or
// done=false (config ignored) if the user cancelled back to the menu. Invalid
// JSON is reported and the editor re-opens with the user's draft so they can fix
// it.
-func editHarnessConfig(d *internal.Display, harnessConfig []byte) ([]byte, bool, error) {
- draft := prettyHarnessConfig(harnessConfig)
+func editAgentConfig(d *internal.Display, agentConfig []byte) ([]byte, bool, error) {
+ draft := prettyAgentConfig(agentConfig)
for {
edited, err := d.PromptForConfigEdit(draft)
if err != nil {
@@ -75,7 +75,7 @@ func editHarnessConfig(d *internal.Display, harnessConfig []byte) ([]byte, bool,
}
return nil, false, err
}
- normalized, err := normalizeHarnessConfigJSON(edited)
+ normalized, err := normalizeAgentConfigJSON(edited)
if err != nil {
d.ShowNotice(fmt.Sprintf("Invalid config: %v", err))
draft = edited // Preserve the user's input so they can fix it.
@@ -85,10 +85,10 @@ func editHarnessConfig(d *internal.Display, harnessConfig []byte) ([]byte, bool,
}
}
-// loadHarnessConfig lets the user pick a JSON file and loads it. It returns the
+// loadAgentConfig lets the user pick a JSON file and loads it. It returns the
// loaded config with done=true, or done=false (config ignored) if the user
// cancelled back to the menu or the file could not be used.
-func loadHarnessConfig(d *internal.Display) ([]byte, bool, error) {
+func loadAgentConfig(d *internal.Display) ([]byte, bool, error) {
path, err := d.PromptForConfigFile()
if err != nil {
if errors.Is(err, internal.ErrUserAborted) {
@@ -101,7 +101,7 @@ func loadHarnessConfig(d *internal.Display) ([]byte, bool, error) {
d.ShowNotice(fmt.Sprintf("Failed to read file: %v", err))
return nil, false, nil
}
- normalized, err := normalizeHarnessConfigJSON(string(b))
+ normalized, err := normalizeAgentConfigJSON(string(b))
if err != nil {
d.ShowNotice(fmt.Sprintf("Invalid config: %v", err))
return nil, false, nil
@@ -109,10 +109,10 @@ func loadHarnessConfig(d *internal.Display) ([]byte, bool, error) {
return normalized, true, nil
}
-// normalizeHarnessConfigJSON trims and validates the given JSON config, returning
+// normalizeAgentConfigJSON trims and validates the given JSON config, returning
// the bytes to send on the wire. Empty input clears the config (returns nil). The
// config must be a JSON object.
-func normalizeHarnessConfigJSON(s string) ([]byte, error) {
+func normalizeAgentConfigJSON(s string) ([]byte, error) {
s = strings.TrimSpace(s)
if s == "" {
return nil, nil
@@ -124,9 +124,9 @@ func normalizeHarnessConfigJSON(s string) ([]byte, error) {
return []byte(s), nil
}
-// prettyHarnessConfig returns an indented JSON rendering of the config bytes for
+// prettyAgentConfig returns an indented JSON rendering of the config bytes for
// display, falling back to the raw bytes if they cannot be parsed.
-func prettyHarnessConfig(b []byte) string {
+func prettyAgentConfig(b []byte) string {
if len(b) == 0 {
return ""
}
diff --git a/cmd/ax/harnessconfig_test.go b/cmd/ax/agentconfig_test.go
similarity index 85%
rename from cmd/ax/harnessconfig_test.go
rename to cmd/ax/agentconfig_test.go
index 869759b..fd10bcb 100644
--- a/cmd/ax/harnessconfig_test.go
+++ b/cmd/ax/agentconfig_test.go
@@ -19,7 +19,7 @@ import (
"testing"
)
-func TestNormalizeHarnessConfigJSON(t *testing.T) {
+func TestNormalizeAgentConfigJSON(t *testing.T) {
tests := []struct {
name string
in string
@@ -37,7 +37,7 @@ func TestNormalizeHarnessConfigJSON(t *testing.T) {
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
- got, err := normalizeHarnessConfigJSON(tt.in)
+ got, err := normalizeAgentConfigJSON(tt.in)
if tt.wantErr {
if err == nil {
t.Fatalf("expected error, got nil (result %q)", got)
@@ -57,21 +57,21 @@ func TestNormalizeHarnessConfigJSON(t *testing.T) {
}
}
-func TestPrettyHarnessConfig(t *testing.T) {
- if got := prettyHarnessConfig(nil); got != "" {
+func TestPrettyAgentConfig(t *testing.T) {
+ if got := prettyAgentConfig(nil); got != "" {
t.Errorf("nil: got %q, want empty string", got)
}
- if got := prettyHarnessConfig([]byte{}); got != "" {
+ if got := prettyAgentConfig([]byte{}); got != "" {
t.Errorf("empty: got %q, want empty string", got)
}
// Invalid JSON falls back to the raw bytes.
- if got := prettyHarnessConfig([]byte("not json")); got != "not json" {
+ if got := prettyAgentConfig([]byte("not json")); got != "not json" {
t.Errorf("invalid: got %q, want raw passthrough", got)
}
// Valid JSON is rendered multi-line and indented.
- got := prettyHarnessConfig([]byte(`{"model":"gemini"}`))
+ got := prettyAgentConfig([]byte(`{"model":"gemini"}`))
if !strings.Contains(got, "model") || !strings.Contains(got, "gemini") {
t.Errorf("valid: got %q, want it to contain the key and value", got)
}
diff --git a/cmd/ax/exec.go b/cmd/ax/exec.go
index d7e71ac..8fa0b90 100644
--- a/cmd/ax/exec.go
+++ b/cmd/ax/exec.go
@@ -125,21 +125,21 @@ func runExec(cmd *cobra.Command, args []string) error {
execController = c
}
- var harnessConfig []byte
+ var agentConfig []byte
if execConfigFile != "" {
b, err := os.ReadFile(execConfigFile)
if err != nil {
- return fmt.Errorf("failed to read harness config %q: %w", execConfigFile, err)
+ return fmt.Errorf("failed to read agent config %q: %w", execConfigFile, err)
}
- harnessConfig = b
+ agentConfig = b
} else if execConfig != "" {
- harnessConfig = []byte(execConfig)
+ agentConfig = []byte(execConfig)
}
- return execLoop(ctx, execConversationID, execAgentID, harnessConfig, execInput)
+ return execLoop(ctx, execConversationID, execAgentID, agentConfig, execInput)
}
-func execLoop(ctx context.Context, id string, harnessID string, harnessConfig []byte, input string) error {
+func execLoop(ctx context.Context, id string, harnessID string, agentConfig []byte, input string) error {
d := internal.NewDisplay(id, os.Stdout)
d.DisplayHeader()
@@ -147,7 +147,7 @@ func execLoop(ctx context.Context, id string, harnessID string, harnessConfig []
if !execResume {
var quit bool
var err error
- input, harnessConfig, quit, err = promptUser(d, input, harnessConfig)
+ input, agentConfig, quit, err = promptUser(d, input, agentConfig)
if err != nil {
return err
}
@@ -181,7 +181,7 @@ func execLoop(ctx context.Context, id string, harnessID string, harnessConfig []
conf, err := runAutoExec(reqCtx, d, &proto.CreateInteractionEvent{
ConversationId: id,
AgentId: harnessID,
- AgentConfig: harnessConfig,
+ AgentConfig: agentConfig,
Inputs: inputs,
})
@@ -258,7 +258,7 @@ func execLoop(ctx context.Context, id string, harnessID string, harnessConfig []
conf, err = runAutoExec(reqCtx, d, &proto.CreateInteractionEvent{
ConversationId: id,
AgentId: harnessID,
- AgentConfig: harnessConfig,
+ AgentConfig: agentConfig,
Inputs: decision,
})
@@ -281,7 +281,7 @@ func execLoop(ctx context.Context, id string, harnessID string, harnessConfig []
// Per-request config: clear the config after each turn.
var quit bool
- input, harnessConfig, quit, err = promptUser(d, "", harnessConfig)
+ input, agentConfig, quit, err = promptUser(d, "", agentConfig)
if err != nil {
return err
}
@@ -407,13 +407,13 @@ func displayContents(d *internal.Display, steps []*proto.Step) {
}
// promptUser loops until the user provides a non-empty input string.
-// The "/config" command opens the harness config menu.
+// The "/config" command opens the agent config menu.
// It returns:
// - string: the valid user input
-// - []byte: the (possibly updated) harness config
+// - []byte: the (possibly updated) agent config
// - bool: true if the user entered a quit command
// - error: any error that occurred during prompting
-func promptUser(d *internal.Display, input string, harnessConfig []byte) (string, []byte, bool, error) {
+func promptUser(d *internal.Display, input string, agentConfig []byte) (string, []byte, bool, error) {
for {
for strings.TrimSpace(input) == "" {
var err error
@@ -421,22 +421,22 @@ func promptUser(d *internal.Display, input string, harnessConfig []byte) (string
if err != nil {
if errors.Is(err, internal.ErrUserAborted) {
if interruptHandler.HandleInterrupt() {
- return "", harnessConfig, true, nil
+ return "", agentConfig, true, nil
}
input = "" // Continue loop to prompt again
continue
}
- return "", harnessConfig, false, err
+ return "", agentConfig, false, err
}
}
trimmed := strings.TrimSpace(input)
if trimmed == "/config" {
- cfg, err := runConfigMenu(d, harnessConfig)
+ cfg, err := runConfigMenu(d, agentConfig)
if err != nil {
- return "", harnessConfig, false, err
+ return "", agentConfig, false, err
}
- harnessConfig = cfg
+ agentConfig = cfg
input = "" // Re-prompt after handling the config.
continue
}
@@ -444,9 +444,9 @@ func promptUser(d *internal.Display, input string, harnessConfig []byte) (string
d.DisplayInput(input)
if strings.ToLower(trimmed) == "q" {
d.ShowResumption(execConversationID, execServerAddr)
- return "", harnessConfig, true, nil
+ return "", agentConfig, true, nil
}
- return input, harnessConfig, false, nil
+ return input, agentConfig, false, nil
}
}
diff --git a/internal/controller/controller.go b/internal/controller/controller.go
index ff16f61..b5c4b59 100644
--- a/internal/controller/controller.go
+++ b/internal/controller/controller.go
@@ -240,13 +240,13 @@ func (l *logger) ResumptionState(ctx context.Context) (proto.State, string, erro
return state, harnessID, nil
}
-func (l *logger) LogInputs(ctx context.Context, steps []*proto.Step, harnessConfig []byte) (int64, error) {
- // Parse the harness config into a human-readable struct for logging.
+func (l *logger) LogInputs(ctx context.Context, steps []*proto.Step, agentConfig []byte) (int64, error) {
+ // Parse the agent config into a human-readable struct for logging.
var cfg *structpb.Struct
- if len(harnessConfig) > 0 {
+ if len(agentConfig) > 0 {
cfg = &structpb.Struct{}
- if err := protojson.Unmarshal(harnessConfig, cfg); err != nil {
- slog.WarnContext(ctx, "Failed to parse harness config for logging",
+ if err := protojson.Unmarshal(agentConfig, cfg); err != nil {
+ slog.WarnContext(ctx, "Failed to parse agent config for logging",
slog.String("conversation_id", l.conversationID),
slog.Any("error", err),
)
diff --git a/internal/controller/controller_test.go b/internal/controller/controller_test.go
index 2937a6f..c452764 100644
--- a/internal/controller/controller_test.go
+++ b/internal/controller/controller_test.go
@@ -29,7 +29,7 @@ import (
type fakeHarness struct{}
-func (f *fakeHarness) Start(ctx context.Context, conversationID string, harnessConfig []byte) (harness.Execution, error) {
+func (f *fakeHarness) Start(ctx context.Context, conversationID string, config []byte) (harness.Execution, error) {
return &fakeExecution{id: "fake-exec-id"}, nil
}
@@ -250,7 +250,7 @@ type testHarness struct {
startFunc func(ctx context.Context, conversationID string) (harness.Execution, error)
}
-func (c *testHarness) Start(ctx context.Context, conversationID string, harnessConfig []byte) (harness.Execution, error) {
+func (c *testHarness) Start(ctx context.Context, conversationID string, config []byte) (harness.Execution, error) {
c.startCalls++
return c.startFunc(ctx, conversationID)
}
diff --git a/internal/controller/registry_test.go b/internal/controller/registry_test.go
index c3eb751..5b26fe8 100644
--- a/internal/controller/registry_test.go
+++ b/internal/controller/registry_test.go
@@ -23,7 +23,7 @@ import (
type dummyHarness struct{}
-func (d *dummyHarness) Start(ctx context.Context, conversationID string, harnessConfig []byte) (harness.Execution, error) {
+func (d *dummyHarness) Start(ctx context.Context, conversationID string, config []byte) (harness.Execution, error) {
return nil, nil
}
diff --git a/internal/harness/antigravity/antigravity.go b/internal/harness/antigravity/antigravity.go
index 9d65561..2991a09 100644
--- a/internal/harness/antigravity/antigravity.go
+++ b/internal/harness/antigravity/antigravity.go
@@ -122,12 +122,12 @@ func (h *AntigravityHarness) Stop() error {
}
// Start implements Harness.Start.
-func (h *AntigravityHarness) Start(ctx context.Context, conversationID string, harnessConfig []byte) (harness.Execution, error) {
+func (h *AntigravityHarness) Start(ctx context.Context, conversationID string, config []byte) (harness.Execution, error) {
return &antigravityExecution{
harness: h,
conversationID: conversationID,
id: uuid.NewString(),
- harnessConfig: harnessConfig,
+ config: config,
}, nil
}
@@ -136,7 +136,7 @@ type antigravityExecution struct {
harness *AntigravityHarness
conversationID string
id string
- harnessConfig []byte
+ config []byte
mu sync.Mutex
queued []*proto.Step
@@ -196,7 +196,7 @@ func (e *antigravityExecution) Run(ctx context.Context, handler harness.Handler)
AgentId: "antigravity",
Type: &proto.HarnessRequest_Start{
Start: &proto.HarnessStart{
- AgentConfig: e.harnessConfig,
+ AgentConfig: e.config,
Steps: inputs,
},
},
diff --git a/internal/harness/antigravity/antigravity_test.go b/internal/harness/antigravity/antigravity_test.go
index 15f5ff0..d8f263f 100644
--- a/internal/harness/antigravity/antigravity_test.go
+++ b/internal/harness/antigravity/antigravity_test.go
@@ -25,7 +25,7 @@ import (
"github.com/google/ax/proto"
)
-var antigravityHarnessConfig = []byte(`{"system_instructions":"be terse"}`)
+var antigravityAgentConfig = []byte(`{"system_instructions":"be terse"}`)
func TestRun_AutoStartFalse_ServerOK_Succeeds(t *testing.T) {
srv := &harnesstest.MockHarnessServer{
@@ -36,7 +36,7 @@ func TestRun_AutoStartFalse_ServerOK_Succeeds(t *testing.T) {
t.Fatalf("New: %v", err)
}
- exec, err := harnessClient.Start(context.Background(), "conv-test", antigravityHarnessConfig)
+ exec, err := harnessClient.Start(context.Background(), "conv-test", antigravityAgentConfig)
if err != nil {
t.Fatalf("failed to start execution: %v", err)
}
@@ -65,12 +65,12 @@ func TestRun_AutoStartFalse_ServerOK_Succeeds(t *testing.T) {
t.Errorf("expected 'Hello world', got %q", got)
}
// The harness propagated the conversation id and config to the server.
- convID, _, harnessConfig, _ := srv.Received()
+ convID, _, agentConfig, _ := srv.Received()
if convID != "conv-test" {
t.Errorf("server got convID=%q, want conv-test", convID)
}
- if !bytes.Equal(harnessConfig, antigravityHarnessConfig) {
- t.Errorf("server got harnessConfig=%q, want %q", harnessConfig, antigravityHarnessConfig)
+ if !bytes.Equal(agentConfig, antigravityAgentConfig) {
+ t.Errorf("server got agentConfig=%q, want %q", agentConfig, antigravityAgentConfig)
}
}
@@ -81,7 +81,7 @@ func TestRun_AutoStartFalse_ServerErrorFrame_Fails(t *testing.T) {
t.Fatalf("New: %v", err)
}
- exec, _ := harnessClient.Start(context.Background(), "conv-test", antigravityHarnessConfig)
+ exec, _ := harnessClient.Start(context.Background(), "conv-test", antigravityAgentConfig)
defer exec.Close(context.Background())
if err := exec.Queue(context.Background(), userStep("Hi")); err != nil {
diff --git a/internal/harness/antigravityinteractions/antigravityinteractions.go b/internal/harness/antigravityinteractions/antigravityinteractions.go
index af3bf6b..fef8da2 100644
--- a/internal/harness/antigravityinteractions/antigravityinteractions.go
+++ b/internal/harness/antigravityinteractions/antigravityinteractions.go
@@ -242,12 +242,12 @@ func newWithHTTPClient(cfg AntigravityInteractionsConfig, hc *http.Client) (*Ant
// Start implements Harness.Start. It loads any previously persisted resume
// cursor for conversationID so the returned Execution resumes the existing
// interaction chain instead of starting a new one.
-func (h *AntigravityInteractionsHarness) Start(ctx context.Context, conversationID string, harnessConfig []byte) (harness.Execution, error) {
+func (h *AntigravityInteractionsHarness) Start(ctx context.Context, conversationID string, config []byte) (harness.Execution, error) {
e := &antigravityInteractionsExecution{
harness: h,
conversationID: conversationID,
id: uuid.NewString(),
- harnessConfig: harnessConfig,
+ config: config,
}
cur, found, err := h.cursors.load(conversationID)
@@ -273,7 +273,7 @@ type antigravityInteractionsExecution struct {
harness *AntigravityInteractionsHarness
conversationID string
id string
- harnessConfig []byte
+ config []byte
mu sync.Mutex
queued []*proto.Step
diff --git a/internal/harness/harness.go b/internal/harness/harness.go
index 5023db4..24b5878 100644
--- a/internal/harness/harness.go
+++ b/internal/harness/harness.go
@@ -40,10 +40,10 @@ type Handler interface {
// compare-and-swap, which is correct only because there is a single writer per
// conversation.
type Harness interface {
- // Start initializes a new Execution session for a conversation. harnessConfig
- // carries optional per-request harness configuration; it is opaque to the
+ // Start initializes a new Execution session for a conversation. config
+ // carries optional per-request configuration; it is opaque to the
// controller and interpreted by the harness implementation.
- Start(ctx context.Context, conversationID string, harnessConfig []byte) (Execution, error)
+ Start(ctx context.Context, conversationID string, config []byte) (Execution, error)
}
// Execution represents an active interactive session with an agent or planner.
diff --git a/internal/harness/harnesstest/harnesstest.go b/internal/harness/harnesstest/harnesstest.go
index f748381..42b22bc 100644
--- a/internal/harness/harnesstest/harnesstest.go
+++ b/internal/harness/harnesstest/harnesstest.go
@@ -110,11 +110,11 @@ type MockHarnessServer struct {
// ErrMessage is the error text used by FailConnect/FailFrame.
ErrMessage string
- mu sync.Mutex
- gotConvID string
- gotHarnessID string
- gotHarnessConfig []byte
- gotInputs []string
+ mu sync.Mutex
+ gotConvID string
+ gotHarnessID string
+ gotAgentConfig []byte
+ gotInputs []string
}
func (s *MockHarnessServer) Connect(stream proto.HarnessService_ConnectServer) error {
@@ -140,7 +140,7 @@ func (s *MockHarnessServer) Connect(stream proto.HarnessService_ConnectServer) e
s.mu.Lock()
s.gotConvID = req.GetConversationId()
s.gotHarnessID = req.GetAgentId()
- s.gotHarnessConfig = req.GetStart().GetAgentConfig()
+ s.gotAgentConfig = req.GetStart().GetAgentConfig()
s.gotInputs = inputs
s.mu.Unlock()
@@ -183,10 +183,10 @@ func (s *MockHarnessServer) Connect(stream proto.HarnessService_ConnectServer) e
}
// Received returns a copy of the start frame the server received.
-func (s *MockHarnessServer) Received() (convID, harnessID string, harnessConfig []byte, inputs []string) {
+func (s *MockHarnessServer) Received() (convID, harnessID string, agentConfig []byte, inputs []string) {
s.mu.Lock()
defer s.mu.Unlock()
- return s.gotConvID, s.gotHarnessID, append([]byte(nil), s.gotHarnessConfig...), append([]string(nil), s.gotInputs...)
+ return s.gotConvID, s.gotHarnessID, append([]byte(nil), s.gotAgentConfig...), append([]string(nil), s.gotInputs...)
}
// MockHandler records the steps and completion streamed during a turn.
diff --git a/internal/harness/substrate/substrate.go b/internal/harness/substrate/substrate.go
index ff219ed..15d1975 100644
--- a/internal/harness/substrate/substrate.go
+++ b/internal/harness/substrate/substrate.go
@@ -84,7 +84,7 @@ func New(harnessID string, endpoint string, namespace string, template string, p
}
// Start implements Harness interface. It creates/resumes the target actor.
-func (h *SubstrateHarness) Start(ctx context.Context, conversationID string, harnessConfig []byte) (harness.Execution, error) {
+func (h *SubstrateHarness) Start(ctx context.Context, conversationID string, config []byte) (harness.Execution, error) {
if conversationID == "" {
return nil, errors.New("SubstrateHarness needs valid conversationID")
}
@@ -128,7 +128,7 @@ func (h *SubstrateHarness) Start(ctx context.Context, conversationID string, har
execID: uuid.NewString(),
conn: conn,
client: proto.NewHarnessServiceClient(conn),
- harnessConfig: harnessConfig,
+ config: config,
}, nil
}
@@ -174,7 +174,7 @@ type substrateExecution struct {
execID string
conn *grpc.ClientConn
client proto.HarnessServiceClient
- harnessConfig []byte
+ config []byte
mu sync.Mutex
pending []*proto.Step
@@ -211,7 +211,7 @@ func (e *substrateExecution) Run(ctx context.Context, handler harness.Handler) e
AgentId: e.harness.harnessID,
Type: &proto.HarnessRequest_Start{
Start: &proto.HarnessStart{
- AgentConfig: e.harnessConfig,
+ AgentConfig: e.config,
Steps: inputs,
},
},
diff --git a/internal/harness/substrate/substrate_test.go b/internal/harness/substrate/substrate_test.go
index ab79799..6b2a668 100644
--- a/internal/harness/substrate/substrate_test.go
+++ b/internal/harness/substrate/substrate_test.go
@@ -34,7 +34,7 @@ import (
"google.golang.org/grpc/status"
)
-var substrateHarnessConfig = []byte(`{"model":"gemini-2.5-pro"}`)
+var substrateAgentConfig = []byte(`{"model":"gemini-2.5-pro"}`)
// startHealthTestServer starts a gRPC server on a random local port. If hs is
// non-nil the standard health service is registered. Returns the listen address.
@@ -156,13 +156,13 @@ func newTestSubstrateHarness(t *testing.T, ctrlAddr, harnessAddr string) *Substr
// They lock in the wiring that a substrate bump or an ax-side change could silently
// break: create/resume idempotency, worker-IP extraction, the health gate, the
// Connect streaming protocol, and suspend-on-close.
-func TestSubstrateHarness_EndToEnd(t *testing.T) {
+func TestSubstrateHarness_StartAndRun(t *testing.T) {
ctrl := &harnesstest.MockControlServer{ResumeIP: "127.0.0.1"}
srv := &harnesstest.MockHarnessServer{}
h := newTestSubstrateHarness(t, harnesstest.StartControlServer(t, ctrl), harnesstest.StartHarnessServer(t, srv))
ctx := context.Background()
- exec, err := h.Start(ctx, "conv-1", substrateHarnessConfig)
+ exec, err := h.Start(ctx, "conv-1", substrateAgentConfig)
if err != nil {
t.Fatalf("Start: %v", err)
}
@@ -175,12 +175,12 @@ func TestSubstrateHarness_EndToEnd(t *testing.T) {
}
// The harness server received the start frame with the right identifiers.
- convID, harnessID, harnessConfig, inputs := srv.Received()
+ convID, harnessID, agentConfig, inputs := srv.Received()
if convID != "conv-1" || harnessID != "antigravity" {
t.Errorf("server got convID=%q harnessID=%q, want conv-1/antigravity", convID, harnessID)
}
- if !bytes.Equal(harnessConfig, substrateHarnessConfig) {
- t.Errorf("server got harnessConfig=%q, want %q", harnessConfig, substrateHarnessConfig)
+ if !bytes.Equal(agentConfig, substrateAgentConfig) {
+ t.Errorf("server got agentConfig=%q, want %q", agentConfig, substrateAgentConfig)
}
if !slices.Equal(inputs, []string{"hi"}) {
t.Errorf("server got inputs=%v, want [hi]", inputs)
@@ -221,7 +221,7 @@ func TestSubstrateHarness_CreateAlreadyExistsTolerated(t *testing.T) {
h := newTestSubstrateHarness(t, harnesstest.StartControlServer(t, ctrl), harnesstest.StartHarnessServer(t, &harnesstest.MockHarnessServer{}))
ctx := context.Background()
- exec, err := h.Start(ctx, "conv-1", substrateHarnessConfig)
+ exec, err := h.Start(ctx, "conv-1", substrateAgentConfig)
if err != nil {
t.Fatalf("Start should tolerate AlreadyExists: %v", err)
}
@@ -246,7 +246,7 @@ func TestSubstrateHarness_ResumeNoWorkerIP(t *testing.T) {
ctrl := &harnesstest.MockControlServer{ResumeIP: ""} // empty AteomPodIp
h := newTestSubstrateHarness(t, harnesstest.StartControlServer(t, ctrl), harnesstest.StartHarnessServer(t, &harnesstest.MockHarnessServer{}))
- _, err := h.Start(context.Background(), "conv-1", substrateHarnessConfig)
+ _, err := h.Start(context.Background(), "conv-1", substrateAgentConfig)
if err == nil {
t.Fatal("expected error for empty worker IP, got nil")
}
@@ -259,7 +259,7 @@ func TestSubstrateHarness_ResumeNilActor(t *testing.T) {
ctrl := &harnesstest.MockControlServer{ResumeNilActor: true}
h := newTestSubstrateHarness(t, harnesstest.StartControlServer(t, ctrl), harnesstest.StartHarnessServer(t, &harnesstest.MockHarnessServer{}))
- _, err := h.Start(context.Background(), "conv-1", substrateHarnessConfig)
+ _, err := h.Start(context.Background(), "conv-1", substrateAgentConfig)
if err == nil {
t.Fatal("expected error for nil actor, got nil")
}
@@ -274,7 +274,7 @@ func TestSubstrateHarness_HarnessFailedFrame(t *testing.T) {
h := newTestSubstrateHarness(t, harnesstest.StartControlServer(t, ctrl), harnesstest.StartHarnessServer(t, srv))
ctx := context.Background()
- exec, err := h.Start(ctx, "conv-1", substrateHarnessConfig)
+ exec, err := h.Start(ctx, "conv-1", substrateAgentConfig)
if err != nil {
t.Fatalf("Start: %v", err)
}