-
Notifications
You must be signed in to change notification settings - Fork 359
Accept deprecated max_tokens for MCP audit/compile and remove conflicting guidance
#27783
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -8,6 +8,8 @@ import ( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "fmt" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "os" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "os/exec" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "slices" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "strings" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "testing" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "github.com/modelcontextprotocol/go-sdk/mcp" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -299,6 +301,36 @@ func TestAuditToolErrorEnvelopeSetsIsErrorTrueHelperProcess(t *testing.T) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| os.Exit(1) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| func TestAuditTool_AcceptsDeprecatedMaxTokensParameter(t *testing.T) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const expectedStdout = `{"overview":{"run_id":"1234567890"}}` | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| var capturedArgs []string | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| mockExecCmd := func(ctx context.Context, args ...string) *exec.Cmd { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| capturedArgs = slices.Clone(args) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| return exec.CommandContext(ctx, "sh", "-c", `printf '%s' "$1"`, "sh", expectedStdout) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+304
to
+310
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| func TestAuditTool_AcceptsDeprecatedMaxTokensParameter(t *testing.T) { | |
| const expectedStdout = `{"overview":{"run_id":"1234567890"}}` | |
| var capturedArgs []string | |
| mockExecCmd := func(ctx context.Context, args ...string) *exec.Cmd { | |
| capturedArgs = slices.Clone(args) | |
| return exec.CommandContext(ctx, "sh", "-c", `printf '%s' "$1"`, "sh", expectedStdout) | |
| func TestAuditTool_AcceptsDeprecatedMaxTokensParameterHelperProcess(t *testing.T) { | |
| if os.Getenv("GH_AW_AUDIT_MAX_TOKENS_HELPER_PROCESS") != "1" { | |
| return | |
| } | |
| _, _ = fmt.Fprint(os.Stdout, os.Getenv("GH_AW_AUDIT_MAX_TOKENS_HELPER_STDOUT")) | |
| os.Exit(0) | |
| } | |
| func TestAuditTool_AcceptsDeprecatedMaxTokensParameter(t *testing.T) { | |
| const expectedStdout = `{"overview":{"run_id":"1234567890"}}` | |
| var capturedArgs []string | |
| mockExecCmd := func(ctx context.Context, args ...string) *exec.Cmd { | |
| capturedArgs = slices.Clone(args) | |
| cmd := exec.CommandContext(ctx, os.Args[0], "-test.run=TestAuditTool_AcceptsDeprecatedMaxTokensParameterHelperProcess") | |
| cmd.Env = append( | |
| os.Environ(), | |
| "GH_AW_AUDIT_MAX_TOKENS_HELPER_PROCESS=1", | |
| "GH_AW_AUDIT_MAX_TOKENS_HELPER_STDOUT="+expectedStdout, | |
| ) | |
| return cmd |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This test asserts the CLI args don’t include
max_tokens, but an accidental forwarding would more likely show up as a flag like--max-tokens. Strengthen the assertion to check for the actual flag forms (e.g.,--max-tokens) so the test will fail on the intended regression.