fix(engine): warn once about a bad allowlist flag, not per tool call #10
No reviewers
Labels
No labels
area/engine
clarity/clear
enhancement
security
size/M
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
basepeak-ai/gptscript!10
Loading…
Reference in a new issue
No description provided.
Delete branch "fix/flag-warn-once"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Found while reviewing the bump of gptscript#9 into bpai, before anything has set the flag — which is the window worth fixing it in, since enabling it is the entire point of that bump.
strictToolEnvis re-evaluated on every tool invocation. That is deliberate: it keeps the check cheap and letst.Setenvdrive it in tests. But the misconfiguration warning sat inside it, so an operator writingGPTSCRIPT_TOOL_ENV_ALLOWLIST: "yes"in a values file would get aWARNline per tool call, forever — turning a one-line mistake into a log flood, at the exact moment they are reading those logs to work out why their tools changed behaviour.The decision stays per call. Only the warning moves behind a
sync.Once.The test asserts on the
sync.Onceitself rather than on captured output: the Once is the mechanism, and a test that swapped the logger would pass against a version that logged every time through some other path.Verified locally (this fork's CI is red on
mainand gates nothing):go build ./...,go test ./pkg/engine/... -count=1,golangci-lint run ./pkg/engine/...— the only lint finding is the pre-existing import-ordering one oncmd.go, byte-identical onmain.