Skip to content

[safeoutputs] Show allowed enum values in safeoutputs tool --help - #79594

Merged
pelikhan merged 4 commits into
mainfrom
fix/safeoutputs-cli-help-enum-values-e9904386d63a1aef
Nov 21, 2026
Merged

pelikhan merged 4 commits into
mainfrom
fix/safeoutputs-cli-help-enum-values-e9904386d63a1aef

Conversation

@github-actions

Copy link
Copy Markdown
Contributor

Summary

safeoutputs <tool> --help truncates the tool description to ~90 characters and lists option names only, so enum constraints never reach the agent. Workflow-specific narrowing (for example submit-pull-request-review: allowed-events) is compiled into the tool schema enum, the event property description and a description suffix, but none of these appear in --help. Agents that rely on --help then send a rejected value and waste a call.

Evidence (last 24h, 272 runs in the pre-downloaded summary.json)

submit_pull_request_review was rejected 4 times in workflow PR Code Quality Reviewer (runs 44768454794, 44763741572, 44760026995, 44788222348). All were engine copilot, model gpt-5.6-luna. In each run the agent ran safeoutputs submit_pull_request_review --help, then called it with "event":"APPROVE":

Invalid arguments for submit_pull_request_review:
  event must be one of: COMMENT, REQUEST_CHANGES.
  Expected: ["COMMENT","REQUEST_CHANGES"]
  Received: "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.md sets allowed-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 --help output in those runs showed only Options (7): --body, --depends-on, --event, ... and a truncated description.

Same class, 1 occurrence: add_comment with target:"discussion" in Daily Fact (run 44751372878); the schema enum for target was ["status"]. The analysis cache shows submit_pull_request_review event errors 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: showToolHelp now appends an Allowed values (any other value is rejected): block listing --option: A, B, C for options whose schema has an enum (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:

Options (7):
  --body, --depends_on, --event, --integrity, --pull_request_number, --repo, --secrecy
Allowed values (any other value is rejected):
  --event: COMMENT, REQUEST_CHANGES

Validation

  • Added three tests to actions/setup/js/mcp_cli_bridge.test.cjs (enum listed, no section without enums, line budget with 24 enum options).
  • Vitest was NOT run: node_modules is absent and npm cannot 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-test failed 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.
  • Verified manually with node -e calling the real showToolHelp for the failing schema (output above), a 24-enum-option schema (22 lines, under the 30 cap) and a no-enum tool (unchanged output). node --check passes for both edited files.
  • No workflow markdown changed, so no recompile was needed. Go tests were not run (no Go changes).

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 invoked safeoutputs as 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)

Generated by ⚡ Daily Safe Output Tool Optimizer · claude · routed: sonnet55 high · ~83 AIC · ⌖ ~2 AIC · ⊞ 10K · ◷

  • expires on Nov 22, 2026, 1:10 PM UTC-08:00

@github-actions github-actions Bot added automated-analysis bug Something isn't working cookie Issue Monster Loves Cookies! safe-outputs tool-improvement labels Nov 20, 2026
@pelikhan
pelikhan marked this pull request as ready for review November 20, 2026 22:30
Copilot AI adaptive review requested due to automatic review settings November 20, 2026 22:30
@github-actions

github-actions Bot commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor Author

✅ Test Quality Sentinel completed test quality analysis.

Test Quality Sentinel

Outcome: reported_no_action

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.

🧪 Test quality analysis by Test Quality Sentinel · copilot · routed: haiku55 xhigh · ~1 AIC · ⌖ ~2 AIC · ⊞ 7.3K · ◷

@github-actions

github-actions Bot commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor Author

✅ PR Code Quality Reviewer completed the code quality review.

PR Code Quality Reviewer

Outcome: reported_action

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.

🔎 Code quality review by PR Code Quality Reviewer · copilot · gpt56 · ~3 AIC · ⌖ ~1 AIC · ⊞ 1.6K · ◷

@github-actions

github-actions Bot commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor Author

✅ PR Specification Reviewer completed successfully!

Caution

agentic threat detected
Threat detection flagged this output in warn mode. Manual review is REQUIRED before any follow-up automation.

Details

Potential security threats were detected in the agent output. Detected threat types: prompt injection.

Review the workflow run logs for details.

PR Specification Reviewer

Outcome: reported_action

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.

Generated by PR Specification Reviewer for #79594 · copilot · gpt56 · ~2 AIC · ⌖ ~2 AIC · ⊞ 1.7K · ◷

@github-actions

github-actions Bot commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor Author

✅ Ponytail Reviewer completed successfully!

Ponytail Reviewer

Outcome: reported_no_action

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.

Generated by Ponytail Reviewer for #79594 · codex · routed: gpt61 medium · ~4 AIC · ⌖ ~1 AIC · ⊞ 185 · ◷

@github-actions

github-actions Bot commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor Author

🧠 Matt Pocock Skills Reviewer has completed the skills-based review. ✅

🧠 Reviewed using Matt Pocock's skills by Matt Pocock Skills Reviewer · copilot · routed: haiku55 xhigh · ~4 AIC · ⌖ ~2 AIC · ⊞ 6.7K · ◷

@github-actions

Copy link
Copy Markdown
Contributor Author

Comment Memory

Peek at saved memory (pr-code-quality-reviewer)
reviewed_at: 2026-11-20T22:33:18Z
review_event: COMMENT
top_themes:
  - enum-help truncation hides constrained options after the six-item cap
files_reviewed:
  - actions/setup/js/mcp_cli_bridge.cjs
  - actions/setup/js/mcp_cli_bridge.test.cjs
comment_count: 1
History

Note

This comment is managed by comment memory.

Expand the saved memory block to view or edit the persistent context for this thread.
Edit only the text inside the backtick fences; workflow metadata and the footer are regenerated automatically.

Learn more about comment memory

🔎 Code quality review by PR Code Quality Reviewer · copilot · gpt50 · ~3 AIC · ⌖ ~1 AIC · ⊞ 1.6K · ◷
Comment /review to run again

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

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) {

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

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.

@github-actions

Copy link
Copy Markdown
Contributor Author

Comment Memory

Peek at saved memory (review-history)
{"id":"ldg-34c48708-903a-491c-a21c-3885bee40ef0","parents":[],"payload":{"id":"ldg-14b47cca-3a9e-4f3c-bb06-a0e3f28aefc7","operation":"append","value":{"finding_count":1,"head_sha":"b443f027fc90fec958aaba369b8e94eaf45374bb","outcome":"findings"}},"sha":"sha256:febaab091fb9478abf8af18e904430faf0c85970c12cca9fb171a2643c1c198e","timestamp":"2026-11-20T22:37:07.901Z","type":"ledger_append","version":1}
History

@github-actions

Copy link
Copy Markdown
Contributor Author

Comment Memory

Peek at saved memory (spec-review-history)
{"id":"ldg-cb9a503e-f117-450e-a61f-17a1c36d71e8","parents":[],"payload":{"id":"ldg-2b7718f3-8e27-4d41-8177-e3a6c6809295","operation":"append","value":{"finding_count":0,"head_sha":"b443f027fc90fec958aaba369b8e94eaf45374bb","outcome":"aligned"}},"sha":"sha256:8dc4c86ec1d96ec4845ffea92975d96b21682b9a0a7d0850df1ccfd47abad26c","timestamp":"2026-11-20T22:38:02.001Z","type":"ledger_append","version":1}
History

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 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)

Comment thread actions/setup/js/mcp_cli_bridge.cjs Outdated
if (!schema || !Array.isArray(schema.enum) || schema.enum.length === 0) {
continue;
}
lines.push(` --${key}: ${schema.enum.map(String).join(", ")}`);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Fixed in 606a4b3: enum control characters are escaped, with a JSON-mode line-budget regression test.

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

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: renderEnumOptionLines stops 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-events narrowing that caused the failed calls is now visible in --help, which is the core fix.

Validation Notes

  • Vitest could not run here. npm ci failed with a self-signed certificate error, so the new tests are unexecuted. I exercised showToolHelp directly 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) {

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

[/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", () => {

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

[/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.

@gh-aw-bot

Copy link
Copy Markdown
Collaborator

@copilot

🍳 A little prep to help this PR along! Copilot assignment requested for the following outstanding work:

  1. Update this branch with the latest main using make merge-main, resolving any conflicts and preserving the intended changes.
  2. Review (actions/setup/js/mcp_cli_bridge.cjs:1443): address unresolved feedback - Review comment

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"
}

Generated by 👨🍳 PR Sous Chef · pi · routed: haiku55 xhigh · ~3 AIC · ⌖ ~2 AIC · ⊞ 7K · ◷
Comment /souschef to run again

gh-aw-bot and others added 2 commits November 20, 2026 23:16
…elp-enum-values-e9904386d63a1aef

Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Co-authored-by: copilot-swe-agent[bot] <[email protected]>

Copilot AI commented Nov 20, 2026

Copy link
Copy Markdown
Contributor

@copilot

🍳 A little prep to help this PR along! Copilot assignment requested for the following outstanding work:...

Merged main in 72f1bd9 and addressed the linked review in 606a4b3. The focused tests and pre-PR checks passed; CodeQL timed out.

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);
@pelikhan

Copy link
Copy Markdown
Collaborator

@copilot run pr-finisher skill

…elp-enum-values-e9904386d63a1aef

Co-authored-by: copilot-swe-agent[bot] <[email protected]>

Copilot AI commented Nov 21, 2026

Copy link
Copy Markdown
Contributor

@copilot run pr-finisher skill

Merged main in 4a4b6dcd13. Local formatting, lint, final validation, and 164 focused tests passed. CodeQL timed out; full recompilation was interrupted. Review threads remain unresolved and CI on the new head is unverified.

Copilot AI requested a review from pelikhan November 21, 2026 03:57
@pelikhan
pelikhan merged commit d69c415 into main Nov 21, 2026
52 checks passed
@pelikhan
pelikhan deleted the fix/safeoutputs-cli-help-enum-values-e9904386d63a1aef branch November 21, 2026 04:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants