Skip to content

fix(messages): accumulate temporary tool declarations linearly - #6656

Merged
lidge-jun merged 2 commits into
lidge-jun:devfrom
luvs01:codex/upstream-linear-native-tool-declarations-20261006
Oct 6, 2026
Merged

lidge-jun merged 2 commits into
lidge-jun:devfrom
luvs01:codex/upstream-linear-native-tool-declarations-20261006

Conversation

@luvs01

@luvs01 luvs01 commented Oct 6, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Temporary inline tool declarations with the same name repeatedly copy the declarations already collected. A chain of temporary additions therefore makes collection work grow quadratically.

Append to checker-owned declaration arrays instead. Permanent replacement still starts a new list; temporary declarations retain denied shadows, and removal, re-offer, anonymous declarations and caller immutability retain their existing behavior.

Add deterministic traversal, frozen-input and production-handler regressions to the existing scope suite, and update the owning protocol contract. Linear collection does not bound Advisor authorization-list lookups, total request memory or elapsed time.

Verification

Base: f92482065217bae891a88e27fd6c00012f212042.
Prepared candidate tree: 60d50c73f42b90314fd5675789b906373fbe4f7b.
Published head: 9389827a03f43a658622dd521a0b9dae936f2d35.

Current-head hosted result — checked 2026-10-06

Cross-platform CI 37412319289 and React Doctor 37412319254 completed successfully for this head. Candidate-head hosted CI is no longer pending. These are workflow conclusions, not a claim that every possible platform, skipped job, live-provider test or native application path ran.

A bounded CodeRabbit review was requested in the author follow-up. Review completion and required independent review remain outstanding. No new local test execution or approval is asserted by this metadata update.

Offline and reused evidence

Fresh offline checks on this candidate:

  • Execute the production scope checker and unchanged upstream checker under Node 24.19.0 with TypeScript types stripped: 13 explicit semantic checks and 5,000 deterministic lifecycle comparisons pass with frozen inputs.
  • Execute the two pure regression callbacks from the submitted test file unchanged: both pass.
  • A fixture with 1,024 temporary additions counts values yielded by array iterators whose first element is the frozen seed declaration. This measures traversal of the seed input and matched collected/active declaration arrays. The original checker yields 526,851 entries; the candidate yields 2,051 against an allowance of 3,075. The original fails that allowance. This measures the repeated-prefix cost, not every checker operation, total authorization work, memory use or runtime. Advisor model/provider-list lookups remain unchanged.
  • Run scripts/structure-ssot.ts, scripts/privacy-scan.ts and scripts/file-size-ratchet.ts with Node type stripping and an adapter for their read-only Bun.spawnSync calls: all pass.
  • git diff --check <base-tree> <candidate-tree>: passes.

Reused validation on the source tree, with the same patch on an older base, reported 164 passing focused Bun tests across 11 files, plus TypeScript, privacy and structure checks. Inspected hosted CI associated with that source head has successful Linux test shards, typecheck, privacy and structure jobs. These results remain reused source evidence, separate from the current-head hosted results above. Windows/macOS test shards and docs build were skipped in that previously inspected source CI.

Bun and project dependencies are unavailable locally. The production-handler regression, complete Bun/import-connected suite and root TypeScript check were not rerun locally; no downloads, live provider calls, installed configuration or services were used for those offline checks. Current-head hosted execution is recorded separately above and does not erase the local coverage limits. Keep this PR in draft pending review and an accurate review-readiness attestation.

Checklist

  • Scope stays focused and avoids unrelated cleanup.
  • Docs or release notes were updated when needed.
  • Security-sensitive changes were reviewed for secrets, auth, and unsafe defaults.

Review readiness checklist

  • Required local validation passed with its scope documented.
  • Branch is on the latest dev commit.
  • All correct Codex and CodeRabbit findings are resolved.
  • Ready for review.

Summary by CodeRabbit

  • Performance
    • Temporary tool declarations now accumulate more efficiently, reducing repeated processing as declarations are added. Existing behavior for permanent replacements, denied declarations, and shadow checks remains unchanged.
  • Tests
    • Added coverage for long chains of temporary declarations, denied declarations, and permanent replacements, including checks that input data remains unchanged.
  • Documentation
    • Clarified how temporary declarations are accumulated and noted that this improvement does not guarantee request-size or processing-time limits.

Maintainer lane verification (sweep lane A, head 8d2c224)

  • Merged origin/dev 38455fb into the branch (no force push); no source change.
  • Independent gpt-6.1-sol review: PASS. The traversal regression distinguishes implementations (old checker 526,851 visits vs the 3,075 allowance); caller arrays and declaration objects stay untouched.
  • bun test tests/claude-integration/messages-native-scope.test.ts tests/ci-workflows/file-size-ratchet.test.ts: 41 pass / 0 fail.
  • bun run typecheck: exit 0. bun run structure:check: passed.
  • The full local suite was not run because parallel lanes share this machine; remaining coverage is left to exact-head hosted CI.

@coderabbitai

coderabbitai Bot commented Oct 6, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Important

Review skipped

Review was skipped as selected files did not have any reviewable changes.

⚙️ Run configuration
  • Configuration used: Repository: lidge-jun/opencodex/.coderabbit.yaml
  • Review profile: ASSERTIVE
  • Plan: Advanced
  • Run ID: aca3de78-e7ee-4e0e-85d8-6e660fda39e4
📥 Commits

Reviewing files that changed from the base of the PR and between 9389827 and 8d2c224.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository: lidge-jun/opencodex/.coderabbit.yaml
  • Review profile: ASSERTIVE
  • Plan: Advanced
  • Run ID: 7de3d02e-4c04-476a-b4b0-4a8604f5e7b9
📥 Commits

Reviewing files that changed from the base of the PR and between f924820 and 9389827.

📒 Files selected for processing (3)
  • src/server/messages-native-scope.ts
  • structure/data-planes/protocol-paths.md
  • tests/claude-integration/messages-native-scope.test.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 7 remain after this review.


📝 Walkthrough

Walkthrough

Temporary native Messages tool declarations now append to the existing declaration list instead of copying that list for each addition. Tests cover traversal counts, denied declarations, permanent replacement, and production-handler behavior.

Changes

Native Messages tool scope

Layer / File(s) Summary
Declaration accumulation behavior
src/server/messages-native-scope.ts:39-42, structure/data-planes/protocol-paths.md:300-303
Temporary additions append to the existing declarations; permanent additions start a new list. The documentation describes linear collection work and notes that replacement, withdrawal, and denied-shadow checks are unchanged.
Accumulation and denial tests
tests/claude-integration/messages-native-scope.test.ts:9, 172-240
Tests check traversal counts for 1,024 additions, denied-shadow behavior across a 2,048-block chain, permanent replacement, frozen input preservation, and production-handler acceptance or rejection.

Priority: ⬇️ Low

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix

Merge Risk: ⚪ Minimal · up to 93898

No merge-blocking issue was identified in this change; normal readiness checks still apply.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 1 functions across 2 files. (1 skipped: 1 …
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: accumulating temporary Messages tool declarations linearly.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create a new PR
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions

github-actions Bot commented Oct 6, 2026

Copy link
Copy Markdown
Contributor

✅ Deterministic PR hygiene checks passed.

@github-actions github-actions Bot added the bug Something isn't working label Oct 6, 2026

luvs01 commented Oct 6, 2026

Copy link
Copy Markdown
Collaborator Author

@coderabbitai review

Please perform one review of published head 9389827a03f43a658622dd521a0b9dae936f2d35; automatic review was skipped while Draft.

Current-head CI update (2026-10-06): Cross-platform CI 37412319289 and React Doctor 37412319254 have completed successfully. The description's candidate-head hosted-CI-pending statement is superseded. Local Node execution and reused older-tree Bun evidence remain separately scoped; no new local test or full native-platform result is claimed here.

Please check permanent replacement versus temporary accumulation, denied-shadow preservation, lifecycle/re-offer behavior, caller ownership and the production-handler regression. The traversal measurement is not a bound on total authorization work or request memory. Draft remains pending review and readiness attestation; no merge or policy expansion is requested.

@coderabbitai

coderabbitai Bot commented Oct 6, 2026 •

Copy link
Copy Markdown
Contributor
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@lidge-jun
lidge-jun marked this pull request as ready for review October 6, 2026 12:29
@lidge-jun

Copy link
Copy Markdown
Owner

Maintainer integration into dev (MAINTAINERS.md dev-only maintainer integration; not a self-approval or an independent review).

  • Exact head: 8d2c2249b615106e46c9977d3b325c59391dec55
  • Hosted CI on that head: every applicable check completed successfully (ci, test 1-4/4, structure gate, gates, docker smoke, storage policy, api usage, npm-global, keyring, enforce-target, hygiene). Skipped jobs are gated off by their own path/event conditions. The only open item is the CodeRabbit-status resolve-pr wake of enforce-target, whose PR-event run on this head already succeeded.
  • Review: independent gpt-6.1-sol review in the compat sweep lane, folded; no unresolved review threads, no maintainer change requests.
  • Scope: bug fix in src/server/messages-native-scope.ts with its structure doc and focused test; no gui/ paths.
  • Full local suite not run (parallel lanes share one machine); focused tests and typecheck ran in the lane, remaining coverage is the hosted matrix above.

@lidge-jun
lidge-jun merged commit 36fa092 into lidge-jun:dev Oct 6, 2026
34 of 38 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants