Repository navigation
[safeoutputs] Show allowed enum values in safeoutputs tool --help - #79594
Conversation
|
✅ Test Quality Sentinel completed test quality analysis. Test Quality SentinelOutcome: The agent completed and reported no action. A no-op output alone does not verify that all required work was completed or that publication was possible. Agent messages are omitted from this comment. The category uses structured run status, not interpretation of agent prose.
|
|
✅ PR Code Quality Reviewer completed the code quality review. PR Code Quality ReviewerOutcome: The agent completed and reported one or more actions. The no-op output is a completion signal, not a claim that no action was taken. Agent messages are omitted from this comment. The category uses structured run status, not interpretation of agent prose.
|
|
✅ PR Specification Reviewer completed successfully! Caution agentic threat detected DetailsPotential security threats were detected in the agent output. Detected threat types: prompt injection. Review the workflow run logs for details. PR Specification ReviewerOutcome: The agent completed and reported one or more actions. The no-op output is a completion signal, not a claim that no action was taken. Agent messages are omitted from this comment. The category uses structured run status, not interpretation of agent prose.
|
|
✅ Ponytail Reviewer completed successfully! Ponytail ReviewerOutcome: The agent completed and reported no action. A no-op output alone does not verify that all required work was completed or that publication was possible. Agent messages are omitted from this comment. The category uses structured run status, not interpretation of agent prose.
|
|
🧠 Matt Pocock Skills Reviewer has completed the skills-based review. ✅
|
Comment MemoryPeek at saved memory (pr-code-quality-reviewer)Note This comment is managed by comment memory.Expand the saved memory block to view or edit the persistent context for this thread.
|
There was a problem hiding this comment.
Found one correctness issue: the new enum-help section silently omits constrained options after the sixth, despite implying all allowed values are listed. Please add a truncation marker or otherwise represent omitted constraints. The rest of the change is narrowly scoped and the added tests cover the main behavior.
🔎 Code quality review by PR Code Quality Reviewer · copilot · gpt50 · ~3 AIC · ⌖ ~1 AIC · ⊞ 1.6K
Comment /review to run again
| continue; | ||
| } | ||
| lines.push(` --${key}: ${schema.enum.map(String).join(", ")}`); | ||
| if (lines.length >= TOOL_HELP_MAX_ENUM_OPTIONS) { |
There was a problem hiding this comment.
The section header says all rejected enum values are shown, but this loop silently stops after six constrained options. For tools with 7+ enum properties, options after the sixth are omitted with no marker, so agents can still miss a schema restriction and make the same rejected call this change is intended to prevent. Please either surface a truncation indicator (and reserve its line) or ensure omitted constraints are represented.
Comment MemoryPeek at saved memory (review-history)History |
Comment MemoryPeek at saved memory (spec-review-history)History |
There was a problem hiding this comment.
🟡 Changes recommended
Enum values with literal newlines bypass the help output’s 30-line budget because each value is counted as one line, requiring control characters to be escaped before rendering.
1 open issue
What changed in this PR
This PR exposes schema enum constraints in safeoutputs <tool> --help, helping agents choose valid values without relying on truncated tool descriptions.
Changes:
- Displays allowed values for up to six enum-constrained options.
- Reserves space for the new section within the existing help-line budget.
- Adds tests for enum display, omission when no enums exist, and line budgeting.
| File | Description |
|---|---|
actions/setup/js/mcp_cli_bridge.test.cjs |
Adds three tests covering enum help output and line budgeting. |
actions/setup/js/mcp_cli_bridge.cjs |
Renders allowed enum values and adjusts option-line allocation. |
Review effort: Balanced (adaptive)
| if (!schema || !Array.isArray(schema.enum) || schema.enum.length === 0) { | ||
| continue; | ||
| } | ||
| lines.push(` --${key}: ${schema.enum.map(String).join(", ")}`); |
There was a problem hiding this comment.
Fixed in 606a4b3: enum control characters are escaped, with a JSON-mode line-budget regression test.
There was a problem hiding this comment.
Skills-Based Review 🧠
Applied /diagnosing-bugs and /tdd. The change is small and correct for the case it targets. I am posting comments, not requesting changes, because both findings are non-blocking.
📋 Key Themes & Highlights
Key Themes
- Silent enum truncation:
renderEnumOptionLinesstops at 6 options with no indication, while the header still says any other value is rejected. - Test gap on the failing path: the new tests use scalar options only. The reported failure ran in JSON mode, where the enum section is the only place the constraint appears.
Positive Highlights
- ✅ The line budget is correct. I rendered a 24-enum-option schema and an 80-long-name schema, and both stay within the 30-line cap.
- ✅ Tools without enums print exactly as before, and the existing wrapping logic is reused.
- ✅ The
allowed-eventsnarrowing that caused the failed calls is now visible in--help, which is the core fix.
Validation Notes
- Vitest could not run here.
npm cifailed with a self-signed certificate error, so the new tests are unexecuted. I exercisedshowToolHelpdirectly against the same scenarios instead, and the outputs match the test expectations. - The skill triage step was not run as a separate agent. I classified the change directly from the pre-fetched metadata and diff.
@copilot please address the two inline review comments.
🧠 Reviewed using Matt Pocock's skills by Matt Pocock Skills Reviewer · copilot · routed: haiku55 xhigh · ~4 AIC · ⌖ ~2 AIC · ⊞ 6.7K
Comment /matt to run again
| continue; | ||
| } | ||
| lines.push(` --${key}: ${schema.enum.map(String).join(", ")}`); | ||
| if (lines.length >= TOOL_HELP_MAX_ENUM_OPTIONS) { |
There was a problem hiding this comment.
[/diagnosing-bugs] Silent truncation: the 6-option cap drops further enum-constrained options with no indication, yet the header still reads "any other value is rejected". An agent cannot tell a 7th option is constrained, so the same wasted-call pattern this PR targets can recur. Add a count line when options are dropped.
💡 Suggested change
function renderEnumOptionLines(optionEntries) {
const enumEntries = optionEntries.filter(([, schema]) => Array.isArray(schema?.enum) && schema.enum.length > 0);
const lines = enumEntries
.slice(0, TOOL_HELP_MAX_ENUM_OPTIONS)
.map(([key, schema]) => ` --${key}: ${schema.enum.map(String).join(", ")}`);
if (enumEntries.length > TOOL_HELP_MAX_ENUM_OPTIONS) {
lines.push(` (+${enumEntries.length - TOOL_HELP_MAX_ENUM_OPTIONS} more constrained options not shown)`);
}
return lines;
}The reserved-line budget in showToolHelp already counts every returned line, so the 30-line cap still holds. Add a 7-enum-option test to pin this behaviour.
@copilot please address this.
| expect(output).toContain("--field_2*"); | ||
| }); | ||
|
|
||
| it("lists allowed enum values for constrained options", () => { |
There was a problem hiding this comment.
[/tdd] The new tests miss the path that failed. The fixture has only scalar options, so Usage renders flag syntax. The reported failure ran in JSON mode, where the live submit_pull_request_review --help renders '<json object>' and the enum section is the only place the constraint appears. Add a case with a non-scalar property and assert the enum line appears there. A 7-option case would also pin the cap behaviour.
💡 Suggested test
it("lists enum values in JSON-mode help", () => {
showToolHelp("safeoutputs", "submit_pull_request_review", [
{
name: "submit_pull_request_review",
inputSchema: {
properties: {
event: { type: "string", enum: ["COMMENT", "REQUEST_CHANGES"] },
comments: { type: "array", items: { type: "object" } },
},
},
},
]);
const output = stdoutChunks.join("");
expect(output).toContain("<json object>");
expect(output).toContain(" --event: COMMENT, REQUEST_CHANGES");
});@copilot please address this.
|
🍳 A little prep to help this PR along! Copilot assignment requested for the following outstanding work:
Keeping the changes focused; human review and CI get the final taste test. No merging or CI triggering. Structured data{
"completed_task": 0,
"head": "b443f027fc90fec958aaba369b8e94eaf45374bb",
"kind": "requested",
"schema_version": "1",
"state": "6979b7252c052d391b7054758d775292ab66940f550c25fcd0e78fe336ed854d",
"work": [
"dd1efd9bd2d355d2b0f85de76c06b5b4cbba4aea34ef33d1038643e5033461e8"
],
"workflow": "pr-sous-chef"
}
|
…elp-enum-values-e9904386d63a1aef Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Co-authored-by: copilot-swe-agent[bot] <[email protected]>
| if (enumLines.length > 0) { | ||
| // The full tool description is truncated above, so surface enum constraints here: | ||
| // workflow-specific narrowing (e.g. allowed-events) would otherwise be invisible to the agent. | ||
| lines.push("Allowed values (any other value is rejected):", ...enumLines); |
|
@copilot run pr-finisher skill |
…elp-enum-values-e9904386d63a1aef Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Merged |

Summary
safeoutputs <tool> --helptruncates the tool description to ~90 characters and lists option names only, so enum constraints never reach the agent. Workflow-specific narrowing (for examplesubmit-pull-request-review: allowed-events) is compiled into the tool schema enum, theeventproperty description and a description suffix, but none of these appear in--help. Agents that rely on--helpthen send a rejected value and waste a call.Evidence (last 24h, 272 runs in the pre-downloaded
summary.json)submit_pull_request_reviewwas rejected 4 times in workflow PR Code Quality Reviewer (runs 44768454794, 44763741572, 44760026995, 44788222348). All were enginecopilot, modelgpt-5.6-luna. In each run the agent ransafeoutputs submit_pull_request_review --help, then called it with"event":"APPROVE":Each run recovered by retrying with
COMMENT, so the cost was a wasted call, not a failed run.The workflow prompt is correct:
pr-code-quality-reviewer.mdsetsallowed-events: [COMMENT, REQUEST_CHANGES]and never mentions APPROVE. The compiled lock file already contains the narrowed enum and the "Events not listed (APPROVE) are rejected" suffix. The--helpoutput in those runs showed onlyOptions (7): --body, --depends-on, --event, ...and a truncated description.Same class, 1 occurrence:
add_commentwithtarget:"discussion"in Daily Fact (run 44751372878); the schema enum fortargetwas["status"]. The analysis cache showssubmit_pull_request_revieweventerrors recurring since 2026-11-14 (9 prior occurrences).Classification: tool description/help issue, not a workflow prompt issue.
Change
actions/setup/js/mcp_cli_bridge.cjs:showToolHelpnow appends anAllowed values (any other value is rejected):block listing--option: A, B, Cfor options whose schema has anenum(capped at 6 options). The option line budget accounts for these lines, so the existing 30-line cap still holds. Tools without enums print exactly as before.Example output for the failing schema:
Validation
actions/setup/js/mcp_cli_bridge.test.cjs(enum listed, no section without enums, line budget with 24 enum options).node_modulesis absent andnpmcannot reach the registry in this sandbox (self-signed certificate error), so the new tests have not been executed. CI should run them.make agent-report-progress-no-testfailed at the Prettier step for the same reason (Pinned Prettier is not installed); formatting was done by hand against the repo.prettierrc(printWidth 240) and has not been machine-checked.node -ecalling the realshowToolHelpfor the failing schema (output above), a 24-enum-option schema (22 lines, under the 30 cap) and a no-enum tool (unchanged output).node --checkpasses for both edited files.Not addressed
Four runs (Dead Code Removal Agent, UK AI Operational Resilience, Avenger, Daily Malicious Code Scan Agent) hit
Tool safeoutputs does not exist., where the agent invokedsafeoutputsas a native tool. That looks like an engine tool-naming issue rather than a schema one, so it is left for separate follow-up.🤖 Generated with [Claude Code]((claude.com/redacted)