Skip to content

fix(evidence): preserve JSON ownership across metadata rebinding - #7036

Merged
gensokyo-dev merged 1 commit into
mainfrom
fix/managed-projection-sharing-20261024
Oct 24, 2026
Merged

gensokyo-dev merged 1 commit into
mainfrom
fix/managed-projection-sharing-20261024

Conversation

@gensokyo-dev

@gensokyo-dev gensokyo-dev commented Oct 24, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Main CI fails its low-headroom managed Evidence test because adding caller-path metadata loses the shared JSON sealing proof. Error projection then clones the completed report precisely when memory admission has refused more work.

Change and scope

Seal rebound Evidence through the existing JSON owner as well as the Evidence owner. Borrow each already-sealed source member before sealing the small changed envelope, so large result/parameter/location trees are shared. Use that single path for both caller-input metadata and snapshot subject-path rebinding; remove their separate shallow-freeze registrations.

The fix belongs to the domain Evidence owner. CLI/MCP, snapshot identity, raw caller paths, complete retained Evidence and error schemas are unchanged. Ordinary repair within existing contribution scope; a maintainer capability decision is not applicable. No new target execution, mutation authority, provider, configuration, package or generated-metadata changes. Tests read authored fixtures, launch CLI processes and create/delete temporary bundles.

Evidence and validation

  • Main CI 40120484609, shard 8: managedBundleReadGuards.test.ts fails at the original strict reference assertion. Local latest-main base 3f168af2 reproduces 1 failed / 10 passed. The existing test and admission limit remain unchanged.

  • Two new domain regressions fail on the original implementation for both rebinding producers: projected partial Evidence must retain its reference, payload references and semantic identity. Both pass after the owner fix; generic JSON parsing also reuses the sealed result.

  • Four exact test files covering Evidence, error projection, immutable JSON and the unchanged low-headroom integration test: 129 tests passed.

  • Snapshot/bundle/ledger: 30 passed, including a graph with >125,000 dependents. Real compiled CLI managed bundle/paging and cancellation/finalization: 16 passed. MCP managed member/artifact summary handlers: 5 passed. In total 180 tests in 10 files passed in serial batches (153.17 s wall / 173.56 s family CPU / 2031.3 MiB maximum sampled family RSS), build excluded.

  • Runtime build passed. Linux local fixtures exercise the actual managed parser and compiled CLI plus MCP handlers, not a new real external-provider claim. The low-headroom failure is injected at the production admission boundary with a simulated provider.

  • Rebased onto latest main 31fc9762 (independent Go parsing changes); runtime compilation and npm run check passed on the updated base (41.38 s wall / 70.46 s CPU / 2367.2 MiB sampled family RSS). git diff --check passed.

Measured bounds

A bounded source-level microbenchmark creates sealed Evidence, alternates both public rebinding operations, projects six resource errors, and serializes/hashes every complete response. Three fresh processes per variant, two CPUs, Node 24.22.1, 768 MiB V8 heap. All equivalent response bytes and SHA-256 digests match before/after; no token reduction is claimed.

Rows Median whole-process wall / family CPU, before → after Maximum sampled family RSS, before → after
100,000 2.289 / 2.604 s → 1.190 / 1.399 s 331.8 → 240.8 MiB
1 0.507 / 0.668 s → 0.471 / 0.596 s 116.9 → 111.5 MiB

The six warm projection/serialization operations take a median 1296 → 206 ms on the large input; the table also includes fresh imports and input construction. OS caches were uncontrolled. This isolates envelope/projection costs, not complete provider analysis; agent tokens/catalog/transport costs were not measured. An initial benchmark fixture used an invalid architecture and was rejected before analysis; its failed attempt is retained outside the repository and excluded from measurements. RSS sums descendants approximately every 100 ms and may double-count shared pages or miss short-lived/reparented children. Local test/benchmark runs use a 3 GiB sampled stop; no host OOM occurred.

Published head c65d19d5 passed complete selected CI: 32,815 tests passed, zero failed, 234 skipped, all eight built shards and the final CI required gate passed. Greptile review completed successfully with no actionable inline findings. Codex's separate review still reports running at merge preparation; it is not counted as completed. The final diff and both producing boundaries were manually inspected by the agent, and the original low-headroom assertion is unchanged.

Post-merge main 03ed0c63 passed actual main CI: 32,835 passed, zero failed, 234 skipped, all eight built shards, Windows/native package/real verification lanes and the final gate passed.

Author readiness

Human owner: @gensokyo-dev

The owner explicitly delegated readiness declarations and agent-managed review. Inspection and execution were performed by Codex; no separate human inspection is claimed.

  • I reviewed the final diff and relevant existing code, understand the change and its edge cases, and take responsibility for the complete PR, including AI-assisted work.
  • I checked the evidence above, confirmed it supports the current change, and recorded meaningful validation gaps.
  • I declare this PR ready for initial maintainer review.

@chatgpt-codex-connector

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 🔄 Running since 2026-10-24T18:47:51.507015Z c65d19d 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.

@greptile-apps

greptile-apps Bot commented Oct 24, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge; no actionable issues were found.

Summary

Both metadata-rebinding paths now use one helper to preserve JSON ownership. The helper shares sealed payloads and seals the new envelope, letting error projection reuse complete Evidence without copying it.

  • Rebound Evidence keeps its shared JSON payloads.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart LR
  A[Authenticated immutable Evidence] --> B[Borrow sealed source members]
  B --> C[Seal changed envelope]
  C --> D[Register Evidence ownership]
  C --> E[Register JSON ownership]
  E --> F[Error projection reuses complete Evidence]
Loading

Reviews (1) · Last reviewed commit: "fix(evidence): preserve JSON ownership a..." · Reviewed by Greptile

@gensokyo-dev
gensokyo-dev merged commit 03ed0c6 into main Oct 24, 2026
44 checks passed
@gensokyo-dev
gensokyo-dev deleted the fix/managed-projection-sharing-20261024 branch October 24, 2026 19:11
@morluto morluto added area: evidence Evidence, artifacts, and reconstruction bug Something isn't working labels Nov 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: evidence Evidence, artifacts, and reconstruction bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants