Skip to content

feat(action): expose effort and max_tokens_budget inputs - #1157

Closed
ylcn91 wants to merge 1 commit into
alibaba:mainfrom
ylcn91:feat/action-effort-and-token-budget-inputs
Closed

feat(action): expose effort and max_tokens_budget inputs#1157
ylcn91 wants to merge 1 commit into
alibaba:mainfrom
ylcn91:feat/action-effort-and-token-budget-inputs

Conversation

@ylcn91

@ylcn91 ylcn91 commented Sep 3, 2026

Copy link
Copy Markdown

Description

The composite action builds the ocr review command itself and exposes only --concurrency, --timeout, --background and --rule, so two flags were unreachable from a workflow: --effort, which picks the review-round preset, and --max-tokens-budget, the only aggregate cap on a review's token spend (review_cmd.go gives it no config or environment fallback).

This adds both as optional inputs, appended to the review args only when non-empty, so an unset input keeps the CLI default: the configured effort (otherwise medium) and an unlimited budget. An explicit 0 budget is forwarded rather than dropped and means unlimited, matching the flag's own documentation.

Both are validated before the npm install, so a typo fails with an annotation in seconds instead of after the whole review setup. effort accepts low/medium/high in any case, because ocr review lower-cases the preset itself; the budget must be a non-negative integer without leading zeros, because the CLI parses integer flags with base-0 strconv, where 010 would silently mean 8.

effort also joins the checkpoint fingerprint: a checkpoint recorded by a low-effort run must not narrow a later high-effort one. max_tokens_budget deliberately stays out of it, since a run that hits its budget is partial and only a complete run should advance a checkpoint.

Type of Change

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Refactoring (no functional changes)
  • Documentation update
  • CI / Build / Tooling

How Has This Been Tested?

  • make test passes locally

  • Manual testing (describe below)

  • npm run test:github-actions: action-contract cases for both inputs (unset, set, 0 budget, invalid values, case handling of effort) and the fingerprint change in post-review-comments.test.js.

  • make test on this branch (Go packages plus the node script tests).

  • Only action.yml, the scripts under scripts/github-actions/ and examples/github_actions/README.md change; there is no Go change.

Checklist

  • My code follows the project's coding style (go fmt, go vet)
  • I have performed a self-review of my code
  • I have added tests that prove my fix is effective or my feature works
  • New and existing unit tests pass locally with my changes
  • I have updated the documentation accordingly (if applicable)
  • I have signed the CLA

Related Issues

Closes #1147

The composite action builds the `ocr review` command itself and exposes
only --concurrency, --timeout, --background and --rule, so two flags were
unreachable from a workflow: --effort, which picks the review-round
preset, and --max-tokens-budget, the only aggregate cap on a review's
token spend (review_cmd.go gives it no config or environment fallback).

Add both as optional inputs, appended to the review args only when
non-empty so an unset input keeps the CLI default: the configured effort
(otherwise medium), and an unlimited budget. An explicit 0 budget is
forwarded rather than dropped and means unlimited too, matching the
flag's own documentation.

Both are validated before the npm install, so a typo fails with an
annotation in seconds instead of after the whole review setup. effort
accepts low/medium/high in any case, because `ocr review` lower-cases the
preset itself; the budget must be a non-negative integer without leading
zeros, because the CLI parses integer flags with a base-0 strconv where
"010" would silently mean 8.

effort also joins the checkpoint fingerprint: a checkpoint recorded by a
low-effort run must not narrow a later high-effort one.
max_tokens_budget deliberately stays out, since a run that hits its
budget is partial and only a complete run advances a checkpoint.
@CLAassistant

CLAassistant commented Sep 3, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@github-actions

github-actions Bot commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

OpenCodeReview: Review complete: 0 finding(s) across 1 selected item(s).

@lizhengfeng101

Copy link
Copy Markdown
Contributor

Superseded by #1154, which landed effort and max_tokens_budget and closed #1147. Closing as duplicate — thanks for the contribution!

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.

feat(action): expose --effort and --max-tokens-budget as action inputs

3 participants