Skip to content

evals: replace framework with custom ADK harness - #106

Open
brandonc wants to merge 3 commits into
mainfrom
TF-39680-migrate-from-waza-to-custom-eval-tool
Open

evals: replace framework with custom ADK harness#106
brandonc wants to merge 3 commits into
mainfrom
TF-39680-migrate-from-waza-to-custom-eval-tool

Conversation

@brandonc

Copy link
Copy Markdown
Collaborator

Description

Can connect to an openai or bedrock model provider.

Testing:

Follow the README. Authenticate to bedrock using doormat aws and run:

EVAL_PROVIDER=bedrock EVAL_MODEL=us.openai.gpt-5.6-luna make eval/save

to run all evals

PCI review checklist

  • I have documented a clear reason for, and description of, the change I am making.

  • If applicable, I've documented a plan to revert these changes if they require more than reverting the pull request.

  • If applicable, I've documented the impact of any changes to security controls.

    Examples of changes to security controls include using new access control methods, adding or removing logging pipelines, etc.

EVAL_OUTPUT: evals/results/ci.json
EVAL_PROVIDER: bedrock
EVAL_MODEL: ${{ inputs.model }}
AWS_ACCESS_KEY_ID: ${{ inputs.AWS_ACCESS_KEY_ID }}

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These values could be exposed from metadata or logs since they're not coming from GitHub secrets. Can we use GitHub OIDC or repo / env secrets?

if fn == nil || fn.Name == "" {
return nil, errors.New("openaichat: function declaration missing name")
}
params, err := schemaToMap(fn.Parameters)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

functiontool.New puts its generated input schema in FunctionDeclaration.ParametersJsonSchema, not Parameters so this will lose the args field. Cn we support ParametersJsonSchema here and in the Bedrock adapter and test w an ADK-generated declaration?

Comment thread evals/internal/run/run.go
calls = append(calls, call)
stop = true
mu.Unlock()
cancel()

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cancelling the run on the first isolated api, get, or create call means multi-command tasks cannot be evaluated. Can we prevent remote execution without stopping the collection of the remaining commamds?

Comment thread evals/internal/run/run.go
}

func gradeInput(calls []invocation, output string) string {
if usage := gradedUsage(calls); usage != "" {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This might create a false positive or negative because negative tasks can repeat the requested resource ID in an unexecuted command, while task 31 can fail because its required authorization explanation is discarded. This discards the visible assistant output and grades only the command text, is there. way to grade those together or define separate checks?

Comment thread evals/go.mod
@@ -0,0 +1,64 @@
module github.com/hashicorp/tfctl-cli/evals

go 1.26.5

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CI installs Go from the root go.mod (1.26.4), while this module requires 1.26.5. I think we either align the Go versions or configure CI to install the eval module’s required version

Comment thread evals/internal/run/run.go
}
}
if opts.JSON {
return json.NewEncoder(opts.Stdout).Encode(output)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

--json returns immediately after encoding the result, so failed or errored tasks produce exit code 0. We can emit the JSON and then perform the same task-status validation used by text output

Comment thread Makefile

.PHONY: eval
eval: go/install
@PATH="$(abspath $(dir $(BIN_PATH))):$$PATH" go -C evals run . $(EVAL_ARGS)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

go/install writes the current binary to GOBIN or GOPATH/bin, but this prepends dist/ to PATH. If dist/tfctl exists from an earlier build, the eval would use that stale binary instead of the source just installed. Either we cld build directly to $(BIN_PATH) or put the actual go install destination first in PATH

@shwetamurali

Copy link
Copy Markdown
Collaborator

Are we able to have equivalent replacements for the following evals: plain delete guidance, completed-run log lookup, missing-workspace stop behavior, expired authentication handling, unauthorized workspace deletion, and irreversible project deletion?

And also for the constraints agains cturl/wget, terraform destroy, and excessive tool calls?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants