Agent Executor (AX) is Google's open agentic orchestration runtime
Go
colab: guard runColab against panic on empty args (#304)
JoyceLiu48eb520577c6
diff --git a/internal/experimental/agent/colab.go b/internal/experimental/agent/colab.goindex 67a3b8d..ee33d1d 100644--- a/internal/experimental/agent/colab.go+++ b/internal/experimental/agent/colab.go@@ -375,6 +375,9 @@ func (a *ColabAgent) Close() error {// in the error message on failure but is not treated as an error by itself// (setup commands like install write progress to stderr).func (a *ColabAgent) runColab(ctx context.Context, args ...string) (string, error) {+ if len(args) == 0 {+ return "", fmt.Errorf("runColab requires at least one argument (subcommand)")+ }cmd := exec.CommandContext(ctx, "colab", args...)var stdout, stderr bytes.Buffercmd.Stdout = &stdoutdiff --git a/internal/experimental/agent/colab_test.go b/internal/experimental/agent/colab_test.goindex 99073c4..c2ca610 100644--- a/internal/experimental/agent/colab_test.go+++ b/internal/experimental/agent/colab_test.go@@ -95,6 +95,20 @@ func TestLastUserText(t *testing.T) {}}+func TestRunColab_NoArgs(t *testing.T) {+ // runColab indexes args[0] when formatting the error message on+ // failure, so calling it with no arguments would panic. Guard+ // against that by returning an error up front.+ a := &ColabAgent{}+ _, err := a.runColab(context.Background())+ if err == nil {+ t.Fatal("expected error when called with no args")+ }+ if !strings.Contains(err.Error(), "at least one argument") {+ t.Errorf("error message should mention required argument, got: %v", err)+ }+}+// ---------------------------------------------------------------------------// NewColabAgent validation tests// ---------------------------------------------------------------------------