Repository navigation
path, context: a refusal in --json mode keeps its prose (#1911) - #1912
Merged
Merged
Conversation
The front door asks every verb for --json. In that mode path and context run the answer inside redirect_stdout; a refusal (an endpoint nothing declares) leaves through die() -> SystemExit, which escaped the with-block, so neither the JSON nor its prose was printed: 'axiomcode path main NoSuchName' answered nothing at all, rc 2. SystemExit is caught inside the redirect and its code kept, so the document is printed with the refusal as its prose. Case a-refused-endpoint-is-said: the front-door check fails on the base (2/3), all pass after; control: a declared pair still answers. Co-authored-by: axiomcode-bot[bot] <334110751+axiomcode-bot[bot]@users.noreply.github.com>
swapnilpaliwal-sd
requested review from
JaredHLZhang,
Whua689 and
suyashpaliwal26
as code owners
October 10, 2026 21:46
This was referenced Oct 11, 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.
Fixes #1911 — found by the 0.1.9 cross-platform release check.
Symptom.
axiomcode path main NoSuchNameprinted nothing and exited 2. 0.1.9's front door asks every verb for--json, and in that mode a refusal was lost. A normal path query was unaffected.Cause. In
--jsonmodeaxiomcode-path(andaxiomcode-context) run the answer insidecontextlib.redirect_stdout. A refusal leaves throughdie()→SystemExit, which escaped thewithblock, so neither the JSON document nor the prose it carries was printed.Fix.
SystemExitis caught inside the redirect and its exit code kept; the JSON is printed with the refusal as itsprose, and the exit code stays 2.Case
tests/cases/python/a-refused-endpoint-is-said: the front-door check (AXIOMCODE_FRONT=1) fails on the base, 2/3 → 3/3 after; control:path main helperstill answers.Branched from
0.1.9, so until the release PR (#1905) merges, this PR's diff also shows the 0.1.9 commits; its own change is one commit (db26884).