Skip to content

fix(apps): treat a deeply nested registry cache file as absent - #31779

Merged
bolichen97 merged 1 commit into
mainfrom
fix/22359-registry-cache-recursion
Nov 7, 2026
Merged

bolichen97 merged 1 commit into
mainfrom
fix/22359-registry-cache-recursion

Conversation

@bolichen97

Copy link
Copy Markdown
Contributor

Problem / Motivation

Goal: A registry cache file nested too deeply to decode reads as "no cached copy", like any other malformed cache file, instead of raising out of the App Store listing or the store-art prewarm.

Three readers of the agent-writable registry cache directory parse their file with json.loads inside an except that does not list RecursionError: the manifest cache (_read_manifest_cache), the external registry cache (_read_external_registry_cache) and the store-art clone-failure record (_read_clone_failure). A body under the size cap that nests deeply enough to exhaust the decoder's stack raises RecursionError, which escapes the reader.

The issue names the first and third; the external registry cache reads from the same directory with the same except, so it is the same defect. The UnicodeDecodeError gap the issue also mentions for the manifest cache is already closed on main.

Why it matters

The cache directory is writable by the agent, so one planted or corrupted file is enough. A nested external registry cache makes that registry's load raise instead of re-fetching, so its apps drop out of the App Store listing. The manifest-cache and clone-failure reads sit in the owner-tier prewarm's pre-filter, outside its per-row error handling, so one such file ends the whole store-art batch. Every other malformed body in these files already reads as absent; this one shape does not.

Not a goal

  • JSON read from a fresh clone, the installed checkout or the bundled registry file. Those are not cache readers and their callers handle failure their own way.
  • Changing the cache format, the size cap or the TTLs.

What changed (motivation → approach → change)

A cache file nested past the JSON decoder's stack made its reader raise RecursionError instead of returning "absent".

The decoder raises RecursionError, which is neither ValueError nor OSError, and the three readers' except clauses named only those. The readers #22300 added or changed already list it.

Each of the three except clauses in apps/registry_pipeline/caches.py and store_art.py now lists RecursionError, so the nested body takes the same "no record" path as any other malformed body.

Backwards compatibility

Compatible: a reader that used to raise on this body now returns the same "absent" answer it gives for every other malformed body; well-formed files read exactly as before.

Removes nothing: no path, record, key or function is removed or narrowed.

Tests

  • test_apps_registry_coverage_manifests.py: a manifest cache file and an external registry cache file nested past the decoder read as None; a RecursionError fails the test.
  • test_registry_store_art_prewarm_rewarm.py: a clone-failure record nested past the decoder reads as None.
  • The nested body comes from stray_line_helpers.too_deep_to_decode(), which probes this interpreter's decoder ceiling instead of hardcoding a depth.
  • Determinism: the three tests passed 20 runs at -n0, 10 runs at -n 4 --dist loadgroup --max-worker-restart=2 beside test_app_metadata_undecodable.py and test_registry_store_art_prewarm_order.py, and both touched test files in a shuffled order (seed 9664).

Proof: PROVEN test/test_apps_registry_coverage_manifests.py::TestManifestCache::test_cache_nested_past_the_decoder_stack_reads_none, test/test_apps_registry_coverage_manifests.py::TestManifestCache::test_external_cache_nested_past_the_decoder_stack_reads_none, test/test_registry_store_art_prewarm_rewarm.py::TestCloneFailureBackoff::test_a_record_nested_past_the_decoder_stack_reads_as_absent (head f386ccc)

Manual verification

N/A — unit coverage sufficient: each reader is a pure file-to-value function, and the tests write the nested body to the real cache path and call the reader.

Screenshots / video

N/A — no user-visible frontend surface is touched.

Related Issues

Closes #22359

Sibling sweep

Swept: git grep -n -A6 "json.loads" -- src/kiro_crew/apps/registry_pipeline/ src/kiro_crew/apps/registry.py
Sibling: src/kiro_crew/apps/registry_pipeline/caches.py -- changed here
Sibling: src/kiro_crew/apps/registry_pipeline/store_art.py -- changed here
Sibling: src/kiro_crew/apps/registry_pipeline/indexes.py:243 -- not affected -- reads a fresh clone of the index, not the cache directory
Sibling: src/kiro_crew/apps/registry_pipeline/manifests.py -- not affected -- reads the installed checkout or a fresh clone, not the cache directory; the listing gathers with return_exceptions=True and keeps the bare row
Sibling: src/kiro_crew/apps/registry_pipeline/install.py:861 -- not affected -- reads the clone being installed, not the cache directory
Sibling: src/kiro_crew/apps/registry_pipeline/install_clone.py:430 -- not affected -- reads the clone being installed, not the cache directory
Sibling: src/kiro_crew/apps/registry_pipeline/sources.py:784 -- not affected -- reads the bundled registry file shipped with the package, not the cache directory
Sibling: src/kiro_crew/apps/registry.py:145 -- not affected -- reads the app's own package.json during its build, not the cache directory

In the two changed files, the readers #22300 added or changed (_read_installed_manifest_cache, _read_unobtainable_art, _stale_row_art_present) already list RecursionError, and the fresh clone's app.json read in store_art.py runs inside the prewarm worker, whose per-row handler logs and skips any exception.

Pattern harvest

Rule candidate: review-prompt
Pattern: json.loads of a file from an agent-writable directory inside an except that lists ValueError or JSONDecodeError but not RecursionError

Checklist

  • At most two commits (one is the norm), with a Conventional Commits title (feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)
  • Existing tests pass and new tests added for new functionality
  • Self-review completed; code follows project style guidelines
  • Documentation updated (if applicable)
  • No secrets, credentials, or internal references in the diff

@bolichen97
bolichen97 requested review from a team and KiroCrewCaptain as code owners November 6, 2026 20:34
@bolichen97
bolichen97 requested a review from Zedmor November 6, 2026 20:34
@github-actions github-actions Bot added the readiness: checking Automated validation is still running label Nov 6, 2026
@bolichen97
bolichen97 enabled auto-merge (squash) November 6, 2026 20:43
@github-actions github-actions Bot added readiness: action required A blocking check or review needs attention and removed readiness: checking Automated validation is still running labels Nov 6, 2026
@bolichen97
bolichen97 force-pushed the fix/22359-registry-cache-recursion branch from f386ccc to 014fb71 Compare November 7, 2026 01:02
@github-actions

github-actions Bot commented Nov 7, 2026 •

Copy link
Copy Markdown
Contributor

UX Review (Opus 5.5) — ⏭️ skipped

Revision ea917b575c44cd8aee12819149e3b6635849957a touches no user-facing surface (no changes under website/ or committed screenshots), so the UX review was skipped. Does not block merge.

@github-actions

github-actions Bot commented Nov 7, 2026 •

Copy link
Copy Markdown
Contributor

Design Review (Opus 5.5) — ✅ PASS

Design-level review of ea917b575c44cd8aee12819149e3b6635849957a — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS does not.

Design-Verdict: PASS

Nothing blocks: this closes a small, real gap at the right layer. The three cache readers now treat a JSON body nested too deeply to decode as "absent", the same way they already treat every other malformed body.

[DESIGN-REVIEWED] ea917b5

Description read

[DESCRIPTION-READ] 43ecdf795a79797cdf196bfa8e039878ce0f0aeee0e4d60ca9c31e55582a9448

That sha256 names everything this verdict read: the PR description, plus the 1 evidence file(s) the workflow collected from it and handed this review. It covers that evidence because the media strip replaces every attachment URL with the same placeholder, so an edit swapping one attachment for another would leave the description's captured text identical while what this review judged changed. Recompute it with .github/scripts/pr-description-capture.sh over the same inputs; if it differs, the description or that evidence changed after this verdict was formed and any finding drawn from either is unproven.

@github-actions

github-actions Bot commented Nov 7, 2026 •

Copy link
Copy Markdown
Contributor

First Principles Review (Opus 5.5) — ✅ PASS

Premise-level review of ea917b575c44cd8aee12819149e3b6635849957a — why this exists and whether the shipped surface is the smallest honest version. Updated in place on each push. A BLOCK verdict blocks PR readiness; PASS does not.

First-Principles-Verdict: PASS

Nothing to check.

What this change ships

Inventory (4 items) — 4 justified

Intent: a corrupted or planted registry cache file that is nested too deeply should count as "no cached copy" instead of crashing the App Store listing or the store-art prewarm. This is a FIX (#22359).

  1. A manifest cache file nested past the decoder's stack now reads as absent instead of raising — justified
  2. An external registry cache file nested the same way now reads as absent, so that registry re-fetches instead of its apps dropping out of the listing — justified
  3. A clone-failure record nested the same way now reads as absent, so the store-art prewarm batch keeps going — justified
  4. Tests cover all three readers with a probed nesting depth from too_deep_to_decode() — justified

[FIRST-PRINCIPLES-REVIEWED] ea917b5

Description read

[DESCRIPTION-READ] ce931cf69d3aa063fb89f8d6921284806e120a0c53a212fd1785a2bdf756aee6

That sha256 names the PR description this verdict read. Recompute it with .github/scripts/pr-description-capture.sh; if it differs, the description changed after this verdict was formed and any finding drawn from the description is unproven.

@github-actions

github-actions Bot commented Nov 7, 2026 •

Copy link
Copy Markdown
Contributor

Opus 5.5 Review — ✅ no blocking findings

Reviewed ea917b575c44cd8aee12819149e3b6635849957a — this comment is updated in place on each push.

Review details

No findings.

[OPUS-REVIEWED] ea917b5

Verdict parsed from the review's SHA-scoped output markers for commit ea917b575c44cd8aee12819149e3b6635849957a.

False positive or not applicable? A repository writer can comment:
/ai-review override fable ea917b575c44cd8aee12819149e3b6635849957a false-positive: <reason, 20 to 500 characters>

@github-actions

github-actions Bot commented Nov 7, 2026 •

Copy link
Copy Markdown
Contributor

GPT 6.1 Review — ✅ no blocking findings

GPT 6.1 completed its review of ea917b575c44cd8aee12819149e3b6635849957a and found no blocking issues.

This comment is updated in place on each push.

Review details

No findings.
[GPT-REVIEWED] ea917b5

False positive or not applicable? A repository writer can comment:
/ai-review override gpt ea917b575c44cd8aee12819149e3b6635849957a false-positive: <reason, 20 to 500 characters>

@github-actions github-actions Bot added readiness: passed Eligible automated validation passed for the current revision and removed readiness: action required A blocking check or review needs attention labels Nov 7, 2026
@bolichen97
bolichen97 force-pushed the fix/22359-registry-cache-recursion branch from 014fb71 to dcb8843 Compare November 7, 2026 05:11
@bolichen97

Copy link
Copy Markdown
Contributor Author

Rebased: main moved in src/kiro_crew/apps/update_status.py since this head went green (f71f5dd -> e4611c5); CI re-running.

[operator: bolichen97]

@github-actions github-actions Bot added readiness: action required A blocking check or review needs attention and removed readiness: passed Eligible automated validation passed for the current revision labels Nov 7, 2026
@bolichen97
bolichen97 force-pushed the fix/22359-registry-cache-recursion branch from dcb8843 to e0d3e7e Compare November 7, 2026 07:55
@bolichen97

Copy link
Copy Markdown
Contributor Author

Rebased: main moved in test/test_apps_registry_coverage_manifests.py and src/kiro_crew/apps/installed_app_tips.py since this head went green (e4611c5 -> 5f7f8d1); CI re-running.

[operator: bolichen97]

Three readers of the agent-writable registry cache directory (the
manifest cache, the external registry cache and the clone-failure
record) let RecursionError from json.loads escape. A body nested deeply
enough to exhaust the decoder's stack then dropped a registry from the
App Store listing or ended the store-art prewarm batch, instead of
reading as "no record" as every other malformed body does. Each
reader's except now lists RecursionError, matching the readers #22300
already guarded.

Closes #22359
@bolichen97
bolichen97 force-pushed the fix/22359-registry-cache-recursion branch from e0d3e7e to ea917b5 Compare November 7, 2026 13:07
@github-actions github-actions Bot added readiness: checking Automated validation is still running readiness: passed Eligible automated validation passed for the current revision and removed readiness: action required A blocking check or review needs attention readiness: checking Automated validation is still running labels Nov 7, 2026

@KiroCrewCaptain KiroCrewCaptain 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.

Approved: PR Readiness passed on ea917b5, and all five review lanes (Opus 5.5, GPT 6.1, Design, UX, First Principles) report no blocking finding on this head. No conflict and no open change request.

@bolichen97
bolichen97 merged commit 94de517 into main Nov 7, 2026
99 of 107 checks passed
@bolichen97
bolichen97 deleted the fix/22359-registry-cache-recursion branch November 7, 2026 19:47
@github-actions github-actions Bot removed the readiness: passed Eligible automated validation passed for the current revision label Nov 7, 2026
buluoray pushed a commit that referenced this pull request Nov 8, 2026
Three readers of the agent-writable registry cache directory (the
manifest cache, the external registry cache and the clone-failure
record) let RecursionError from json.loads escape. A body nested deeply
enough to exhaust the decoder's stack then dropped a registry from the
App Store listing or ended the store-art prewarm batch, instead of
reading as "no record" as every other malformed body does. Each
reader's except now lists RecursionError, matching the readers #22300
already guarded.

Closes #22359

(cherry picked from commit 94de517)
buluoray pushed a commit that referenced this pull request Nov 8, 2026
Three readers of the agent-writable registry cache directory (the
manifest cache, the external registry cache and the clone-failure
record) let RecursionError from json.loads escape. A body nested deeply
enough to exhaust the decoder's stack then dropped a registry from the
App Store listing or ended the store-art prewarm batch, instead of
reading as "no record" as every other malformed body does. Each
reader's except now lists RecursionError, matching the readers #22300
already guarded.

Closes #22359

(cherry picked from commit 94de517)
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.

apps: two registry cache readers let a deeply nested JSON body raise RecursionError instead of reading as absent

2 participants