Skip to content

fix: report unreadable model catalogs without a traceback - #2

Open
lidge-jun wants to merge 2 commits into
foxytanuki:mainfrom
lidge-jun:fix/check-models-catalog-errors
Open

lidge-jun wants to merge 2 commits into
foxytanuki:mainfrom
lidge-jun:fix/check-models-catalog-errors

Conversation

@lidge-jun

Copy link
Copy Markdown

Depends on #1. This branch contains that PR's commit until it merges; the change for review here is the last commit, fix: report unreadable model catalogs without a traceback. I'll rebase onto main once #1 lands.

check-models ends in a Python traceback when the catalog is missing or has an unexpected shape, for example:

$ python3 tools/pstack_opencodex.py check-models --catalog /nonexistent.json
Traceback (most recent call last):
  ...
FileNotFoundError: [Errno 2] No such file or directory: '/nonexistent.json'

check-runtime already turns the same inputs into a BLOCKED diagnostic, so this brings check-models in line:

  • catalog_models() shape-checks every entry in file order (an object document, a models array, object entries with string slugs). Duplicates are kept, so a disabled or malformed earlier entry for the same slug is still seen.
  • catalog_efforts() is the existing effort projection; load_catalog() keeps its return shape, so check-runtime behaves exactly as before.
  • check-models reads the catalog once inside one (OSError, ValueError) boundary and exits 1 with cannot read model catalog <path>: <reason> on stderr, before printing anything else. The disabled-model check reuses the validated entries instead of parsing the file a second time.

Tests (tests/test_runtime.py, CheckModelsCLI): eight error cases (missing file, malformed JSON, non-object document, non-array models, non-object entry, missing slug, non-string slug, malformed effort) all fail on main and pass here; a duplicate-slug regression; and a valid catalog that still resolves and clamps an effort, which passes before and after.

Verified on a fresh macOS clone: 28 tests OK, build, license cmp, git diff --check and an unchanged upstream/. No live delegation is involved.

UPSTREAM and the upstream/ directory differ only by case, so a fresh clone on
a case-insensitive filesystem (default macOS and Windows) cannot hold both:
git reports UPSTREAM as deleted and build fails with IsADirectoryError.

Rename the lock to UPSTREAM.lock (content unchanged) and update its readers.
Add a test that fails when two tracked paths, including directory prefixes,
differ only by case, and a macOS CI job that checks the checkout is complete.
The macOS job also surfaced a temp-path comparison in test_runtime.py that
failed on macOS before this change (/var is a symlink to /private/var); the
test now resolves its temp root.
check-models read the catalog with a bare json.loads and indexed model["slug"],
so a missing file, malformed JSON or an unexpected shape ended in a Python
traceback. check-runtime already reports the same inputs as a BLOCKED
diagnostic.

catalog_models() now shape-checks every entry in file order (duplicates are
kept, so a disabled or malformed earlier entry is still seen), catalog_efforts()
projects reasoning efforts, and load_catalog() keeps its return shape.
check-models reads the catalog once inside one error boundary and exits 1 with
"cannot read model catalog <path>: <reason>".
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 9, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-09T06:25:56.023751Z 1f6db41 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

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.

1 participant