fix: add text remediation hints for ACP session errors#256
Merged
steipete merged 1 commit intoApr 25, 2026
Conversation
081c629 to
ed56726
Compare
Contributor
|
Landed via maintainer rewrite and rebase onto main.
Thanks @SJeffZhang! |
This was referenced Apr 25, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This is a small first pass for #176.
It keeps the JSON / machine-readable error contract unchanged and adds additive remediation hints only to text-mode error output.
Initial text-mode coverage in this pass:
AUTH_REQUIREDNO_SESSIONsession/load,session/set_mode,session/set_model, andsession/set_config_optionWhy
acpxalready normalizes these failures into stablecode,detailCode,origin, and rawacpmetadata, but text mode usually stopped at the raw error message. That left users without a clear next step even when the client already had enough information to point them in the right direction.User Impact
Text-mode CLI failures now include short next-step hints in a few high-value cases, for example:
auth.<method>acpx <agent> sessions new--verboseto capture ACP method/error detailsJSON output and machine-readable error fields stay unchanged.
Root Cause
The existing text formatter and top-level stderr path emitted normalized error messages, but they did not translate the existing normalized metadata into actionable remediation guidance for human readers.
Validation
Targeted local validation:
corepack pnpm run build:testnode --test --test-name-pattern 'normalizeOutputError maps ACP resource not found errors to NO_SESSION|normalizeOutputError maps AuthPolicyError to AUTH_REQUIRED detail|normalizeOutputError infers AUTH_REQUIRED detail from ACP payload|sessions new --resume-session fails when agent does not support session/load|sessions new --resume-session surfaces not-found loadSession errors without fallback|set-mode surfaces actionable guidance when agent rejects session/set_mode params|prompt exits with NO_SESSION when no session exists \(no auto-create\)' dist-test/test/error-normalization.test.js dist-test/test/cli.test.jsnode --input-type=module -e ...assertions for generated remediation hintscorepack pnpm run typecheckcorepack pnpm run format:checkoxlint --type-aware src./node_modules/.bin/tsx scripts/lint-persisted-key-casing.ts./node_modules/.bin/tsx scripts/lint-flow-schema-terms.tsManual text-mode end-to-end stderr checks:
AUTH_REQUIREDsession/load/NO_SESSIONsession/set_modeinvalid paramsAI Assistance
AI-assisted with Codex. I reviewed the touched code paths and local validation results directly.