Skip to content

fix: parse compact release metadata in installer#31667

Merged
efrazer-oai merged 1 commit into
mainfrom
agent/fix-install-compact-release-json
Jul 9, 2026
Merged

fix: parse compact release metadata in installer#31667
efrazer-oai merged 1 commit into
mainfrom
agent/fix-install-compact-release-json

Conversation

@efrazer-oai

@efrazer-oai efrazer-oai commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

Summary

GitHub's latest-release endpoint can return compact, single-line JSON. The standalone installer treated release metadata as line-oriented text, so those responses could make asset lookup fail even though the requested assets were present.

The regression was introduced by #31056. That change reused the /releases/latest metadata response for both version resolution and asset lookup, exposing the existing formatting-sensitive asset parser to compact responses from that endpoint.

This change parses the release metadata once with a one-pass POSIX awk scanner. The scanner tracks JSON strings and nesting, extracts the root release tag plus direct asset name/digest pairs, and produces the same result regardless of whitespace or object field order. It uses POSIX fold to bound awk record sizes so compact responses stay fast across awk implementations.

Fixes #31520.

Changes

  • replace line-oriented release metadata matching with structure-aware parsing
  • reuse the parsed metadata for latest-version and asset-digest lookup
  • add regression coverage for compact JSON, reordered fields, nested decoys, and JSON-looking release text

Design decisions

  • Keep the installer dependency-free by using standard POSIX tools already required by the shell installer.
  • Parse only the GitHub release fields the installer consumes, in one pass, instead of vendoring a general JSON library.
  • Preserve asset-object boundaries so nested or string-encoded name and digest fields cannot be mistaken for release assets.

Testing

  • Tests: focused installer suite locally and on Linux.
  • Smoke tests: real pretty and compact GitHub release metadata, latest-release resolution, and checksum-asset selection.
  • Portability: macOS awk plus Linux gawk, mawk, and nawk.
  • Stress coverage: randomized formatting and field order, adversarial nested/string content, and a synthetic 2,000-asset compact response.

@efrazer-oai efrazer-oai marked this pull request as ready for review July 8, 2026 23:22

@etraut-openai etraut-openai 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.

Looks good! I had codex also run some manual tests on this, and they all passed.

Thanks for doing this.

@efrazer-oai efrazer-oai merged commit dc23c7b into main Jul 9, 2026
35 checks passed
@efrazer-oai efrazer-oai deleted the agent/fix-install-compact-release-json branch July 9, 2026 05:08
@github-actions github-actions Bot locked and limited conversation to collaborators Jul 9, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Update command failed with "Could not find Codex package or platform npm release assets for Codex $resolved_version."

2 participants