anthropics / anthropics/claude-code-action

collect-inputs.ts input map has drifted from action.yml: 11 removed inputs tracked, 19 current inputs missing (including prompt)

Abierto
#1,664 0 comentarios 0 reacciones 0 asignados Ver en GitHub
bug dev-experience p3
Lenguaje dominante
TypeScript
Estrellas
8.9k
Forks
2.1k
Métricas de merge de PR
Métricas de PR pendientes

Descripción

## Summary

The input map in [`src/entrypoints/collect-inputs.ts`](https://github.com/anthropics/claude-code-action/blob/d721746d683d812e669ce117cebe55a85fbd9c3e/src/entrypoints/collect-inputs.ts#L2-L34) has drifted out of sync with the inputs actually declared in `action.yml`. It currently tracks **11 inputs that no longer exist** and **omits 19 that do**, including `prompt` — the input that determines whether the action runs in tag mode or agent mode.

Because this function's output becomes the `GITHUB_ACTION_INPUTS` environment variable ([`base-action/src/parse-sdk-options.ts#L280-L282`](https://github.com/anthropics/claude-code-action/blob/d721746d683d812e669ce117cebe55a85fbd9c3e/base-action/src/parse-sdk-options.ts#L280-L282)), the usage signal it produces is currently incomplete and partly meaningless.

## Reproduction

Diffing the declared inputs in `action.yml` against the keys in `inputDefaults`:

```console
$ awk '/^inputs:/,/^outputs:/' action.yml | grep -E "^ [a-z_]+:" | tr -d ' :' | sort > declared.txt
$ grep -oE '^ [a-z_]+:' src/entrypoints/collect-inputs.ts | tr -d ' :' | sort > collected.txt

$ comm -13 declared.txt collected.txt # tracked but no longer declared
allowed_tools
anthropic_model
claude_env
custom_instructions
direct_prompt
disallowed_tools
fallback_model
max_turns
mode
model
override_prompt

$ comm -23 declared.txt collected.txt # declared but not tracked
allowed_non_write_users
bot_id
bot_name
branch_name_template
claude_args
display_report
exclude_comments_by_actor
include_comments_by_actor
include_fix_links
path_to_bun_executable
path_to_claude_code_executable
plugin_marketplaces
plugins
prompt
show_full_output
track_progress
use_bedrock
use_foundry
use_vertex
```

All 11 stale entries are v0.x inputs removed in the v1.0 migration — they are listed as deprecated in `docs/usage.md` and `docs/configuration.md`.

## Impact

`collectActionInputsPresence()` reports, for each input, whether the user set it to something other than its default. The current map means that signal cannot observe:

- **`prompt`** — the single input that selects agent mode over tag mode (`src/modes/detector.ts`). Presence of a prompt is arguably the most significant thing about any given invocation, and it is not tracked.
- **`claude_args`** — the primary v1.0 configuration surface, which replaced `allowed_tools`, `disallowed_tools`, `max_turns`, `model`, and `fallback_model`. All five predecessors are still tracked; their replacement is not.
- **`use_bedrock` / `use_vertex` / `use_foundry`** — which cloud provider the run targets.
- **`track_progress`**, **`plugins`**, **`plugin_marketplaces`**, **`allowed_non_write_users`** — all newer features.

Meanwhile the 11 stale keys can never be anything but `false`, since `ALL_INPUTS` (populated from `toJson(inputs)` at `action.yml#L317`) will never contain a key that `action.yml` does not declare. They are pure noise in the output.

## Related: `inputs.mode` is referenced but never declared

Same root cause. [`action.yml#L290`](https://github.com/anthropics/claude-code-action/blob/d721746d683d812e669ce117cebe55a85fbd9c3e/action.yml#L290) sets:

```yaml
MODE: ${{ inputs.mode }}
```

but there is no `mode:` entry in the `inputs:` block — it was removed when mode detection became automatic. The expression resolves to the empty string, and nothing in `src/` reads `process.env.MODE`. It should be deleted along with the stale map entries.

## Why this keeps happening

There is no mechanism tying the two lists together, so any input added to or removed from `action.yml` silently diverges from `collect-inputs.ts`. The drift above accumulated across the whole v1.0 migration without surfacing.

## Suggested fix

1. Regenerate `inputDefaults` from the current `action.yml`, dropping the 11 stale keys and adding the 19 missing ones with their declared defaults.
2. Remove the `MODE` env line from `action.yml`.
3. Add a drift-guard test that parses `action.yml` and asserts the key sets match exactly, so this cannot silently recur. [`test/action-metadata.test.ts`](https://github.com/anthropics/claude-code-action/blob/d721746d683d812e669ce117cebe55a85fbd9c3e/test/action-metadata.test.ts) is the natural home — it already reads and asserts against `action.yml`, and currently contains a single test.

A question for maintainers before I open a PR: should the guard assert exact set equality, or should there be an explicit opt-out list for inputs deliberately excluded from the presence signal (secrets such as `anthropic_api_key` and `github_token` are currently tracked, so I assume exact equality is intended — but I'd rather confirm than guess).

Happy to submit the fix and the guard test together.

## Environment

- Repository at `d721746d683d812e669ce117cebe55a85fbd9c3e` (`main`)

Guía de contribución

Abrir la guía de contribución

Evaluación

Este issue todavía no se ha evaluado.

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.