next.js
c41d1beb - Add a CLI for reviewing agent feedback (#100739)

Commit
11 days ago
Add a CLI for reviewing agent feedback (#100739) ## Why Agent Feedback reports are created inside coding environments that often cannot launch a local browser. The previous instructions made the final handoff depend on the agent finding and invoking host-specific browser tooling. In headless, sandboxed, or remote sessions, that step could fail even when the anonymized report itself was valid, leaving the maintainer without a usable review link. This happened in practice when an agent could not share its feedback and had to be told to run a browser command manually. Browser control should not be part of the Agent Feedback reporting contract. ## What changed - add the hidden `next internal agent-feedback [report]` command as the supported handoff for an encoded v5 Agent Feedback report - keep the command internal because it is protocol machinery, not a public semver-covered CLI surface - accept the report as a positional argument or through stdin, validate the complete v5 schema, and always print the review URL before attempting to open the default browser - preserve the printed URL when browser launching is unavailable or fails - bound stdin to 16 KiB and a five-second read deadline using Node's async iterator and `AbortController` - support `--dry-run` for validation and URL generation without opening a browser - update the Agent Feedback protocol and evals to use the internal CLI instead of host-specific browser commands This keeps the report anonymized and makes CLI output—not browser availability—the reliable source of truth for the maintainer handoff. ## Verification - `pnpm jest --runInBand packages/next/src/cli/internal/agent-feedback.test.ts packages/next/src/cli/internal/agent-feedback-instructions.test.ts` (23 tests) - `pnpm prettier --check packages/next/src/agent-feedback/protocol.md packages/next/src/bin/next.ts packages/next/src/cli/internal/agent-feedback.ts packages/next/src/cli/internal/agent-feedback.test.ts` - `pnpm eslint packages/next/src/bin/next.ts packages/next/src/cli/internal/agent-feedback.ts packages/next/src/cli/internal/agent-feedback.test.ts` - `pnpm --filter=next types` - `pnpm --filter=next build` - built CLI smoke test: `node packages/next/dist/bin/next internal agent-feedback --help` ### Agent Feedback evals Variant: `agent-feedback`; model: `claude-opus-4-8`; one run per eval. | Eval | Coverage | Last completed model run | Exact-head rerun (`77e626ee5c9`) | | --- | --- | --- | --- | | `agent-056-agent-feedback-routine-debugging` | Routine debugging does not open a feedback review | 1/1 passed (192.6s) | Gateway fetch failed before model execution (retried once) | | `agent-057-agent-feedback-anonymization` | The report remains anonymized and uses `next internal agent-feedback` | 1/1 passed (389.9s) | Gateway fetch failed before model execution | | `agent-058-agent-feedback-distinct-issues` | Distinct issues produce separate reports and internal CLI invocations | 1/1 passed (330.8s) | Gateway fetch failed before model execution | The exact-head reruns produced no model output or classifier result; all three failed in the shared AI gateway after 180–195 seconds. Fixture generation remains up to date, and deterministic CLI tests/builds pass on the exact head. <!-- NEXT_JS_LLM -->
Author
Parents
Loading