Skip to content

fix: preserve Markdown context during JSON command recovery - #559

Merged
rng1995 merged 2 commits into
NVIDIA:mainfrom
longchen-nv:codex/fix-json-recovery-fence-context
Sep 16, 2026
Merged

rng1995 merged 2 commits into
NVIDIA:mainfrom
longchen-nv:codex/fix-json-recovery-fence-context

Conversation

@longchen-nv

Copy link
Copy Markdown
Contributor

When JSON string recovery scans a string in isolation, it can reinterpret literal shell backticks from a surrounding Markdown code fence as inline-code delimiters. The example reported on #516 then changes from incomplete/CAUTION to complete/SAFE merely by adding unrelated array entries, allowing --fail-on-incomplete and MCP installation checks to accept unresolved static analysis.

Reuse the corresponding slice of the whole-document Markdown projection during recovery. This preserves the original delimiter ownership, source coordinates, JSON escapes, and disjoint-span work bound without reparsing each string as a new Markdown document.

Follow-up to the P1 review, as requested by the maintainer.

Regression coverage

  • Add 30 cases covering single-entry/multiple-entry arrays, backtick/tilde fences, plain/blockquote/list/tab-indented list containers, and benign controls.
  • Twelve public cases each invoke CLI and MCP, with semantic analysis disabled or successful deterministic model responses. Unresolved commands must retain static_parse_limit, CAUTION, strict CLI exit 1, and safe_to_install=false; benign controls remain complete/SAFE.
  • Correct the existing fenced hostname example's unit and public expectations: a JSON code fence does not establish Markdown inline ownership inside its strings, so runtime-selected literal backticks remain incomplete even when surrounded by prose. Two additional public cases verify that the standalone inline-documentation control remains complete.

Validation

  • Tests-first checkpoint: the initial 24 new cases produced 10 failures before the fix, including both public scan modes.
  • Final focused run of all three affected test modules: 139 passed.
  • Python 3.12 with locked development dependencies, make test-ci: 5,054 passed, 14 skipped, 38 deselected, four expected failures, 90% coverage. Its two failures were the existing fenced-hostname public expectations described above; those expectations were corrected, a standalone control was added, and the affected modules then passed the 139-case rerun. Production code is unchanged since the full run. Hosted CI will rerun the full suite on the final commit.
  • Original review fixture through the actual CLI with --no-llm --fail-on-incomplete: score 0, CAUTION, is_complete=false, static_parse_limit, exit 1.
  • Ruff lint, repository formatting, and git diff --check passed.
  • Semantic-enabled tests use deterministic transports; no live LLM validation was performed. CodeRabbit CLI was signed out, so review used local code inspection and tests.

Signed-off-by: Long Chen <longchen@nvidia.com>

@rng1995 rng1995 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[SkillSpector Review]

Reviewed current head b179f91ab7e9aa090a5fb4415a818f1c3c2cf9af, including the complete production diff, the whole-document Markdown projection and JSON-span recovery paths, all added unit/public CLI/MCP regressions, prior discussion, and exact-head checks.

Reusing the length-preserving whole-document projection correctly keeps each recovered JSON string's original fenced, literal, or inline-code ownership while preserving the validated structural-quote offsets and bounded disjoint-span work. The tests cover fence/container combinations, single and multiple entries, conservative runtime-selected cases, benign controls, semantic/static modes, CLI exit behavior, and MCP installation decisions. All five hosted checks pass. No required changes remain on this head.

@rng1995
rng1995 enabled auto-merge (squash) September 16, 2026 19:31
@rng1995
rng1995 merged commit beb5f3f into NVIDIA:main Sep 16, 2026
5 checks passed
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.

2 participants