Skip to content

[PR] fix: keep canonical pointer upkeep working on long histories - #6658

Closed
Afloat16 wants to merge 1 commit into
ranxianglei:masterfrom
Afloat16:2026-11-14_incremental-pointer-frontier
Closed

Afloat16 wants to merge 1 commit into
ranxianglei:masterfrom
Afloat16:2026-11-14_incremental-pointer-frontier

Conversation

@Afloat16

@Afloat16 Afloat16 commented Nov 14, 2026 •

Copy link
Copy Markdown
Contributor

Duplicate resolution

This PR overlaps the canonical-pointer fix already included in #6492. The independent public-handler regression has been moved into that original PR in commit 04f998bbfdf02d7ed31f40ee5028e5a257e8939e, where it passes against the existing two-argument reduction. The combined canonical-pointer suites pass 5/5.

Closing this PR as a duplicate. The original fix and the extra coverage will follow #6492; this is not a separate new improvement.


Closes #6657

Problem

Canonical pointer maintenance computes its settled-row frontier with Math.max(...ptrs). Once the existing history exceeds the engine's argument limit, the completed turn's wrap-up logs a RangeError and never advances the durable pointers. Later turns keep failing this maintenance, and a cold rebuild uses the stale canonical prefix until the client resynchronizes.

Change

Find the highest row with a loop. The empty-list frontier stays -1, and reordered pointers still use their maximum rather than their last entry.

Validation

  • The new handler-level regression restores 250,000 distinct message IDs and applies one new assistant delta through handleIncrementalTurn(). On the upstream source it emits RangeError: Maximum call stack size exceeded, performs no tail query and saves no extended pointer list.
  • With this change it queries strictly above the maximum existing row (placed first in the fixture) and saves the complete 250001-pointer list.
  • All 6 tests in tests/inc-canonical-pointers.test.ts and tests/incremental-content-clusters.test.ts pass. The existing cases include the local proxy's cold reconstruction and shared-prefix resync paths.
  • Focused strict TypeScript checking of the changed module and pointer tests passes using the repository compiler settings.
  • npm run build and git diff --check pass.

The full repository typecheck/test suite and a real-provider Codex end-to-end run were not run for this branch; those remain for CI and the integration gate before merge.

Scope and comparison

No kernel, public configuration, message identity, wire payload or compression-policy changes.

  • Upstream base: e5e1647ba0f92dfc36a96220f3e5c0d454218e2f.
  • Head: 5aadd52760e25aa8a517883e0eeb249831d0b731.
  • Published tree 0ae5229fa29da13a7b6f70bceb9e76bbf49fedc8 matches tested local commit e04db2b5.

Hosted CI follow-up

CI run 43566360335 finished with 25 successful jobs, two failed Windows test jobs and one skipped job. All Linux test shards and both Windows/Ubuntu static gates passed, including the full typecheck and build. The overall CI result remains red.

The two failed jobs report only the existing SQLite teardown-lock failures:

  • Windows 22 shard 3: three persist-metadata-fold-gate cases cannot remove their open index.db files (EBUSY), also reproduced by the runner's automatic retry.
  • Windows 22 shard 5: ten persist-zstd cases fail on the same open-file cleanup, also reproduced by the automatic retry.

Both suites still remove their temporary directory without closing all SessionStore instances. These exact suites and failure causes are addressed by the existing upstream issue #6547 and open fix PR #6561. This contribution does not duplicate that work. The new large-pointer regression did not fail in either job's log.

@ranxianglei

Copy link
Copy Markdown
Owner

🤖 Powered by ework · qwen3.8-27b

[bot] 🏷 (ai: vllm-qwen/qwen3.8-27b)

Progress update — review in flight, no verdict yet:

  • Duplicate check (查重): not a duplicate — this PR directly implements the fix requested by its source issue Incremental canonical pointers stop advancing when the history exceeds the JavaScript argument limit #6657 (same symptom, same mechanism, no parallel work found in open/closed issues or PRs).
  • PR head 5aadd52760 fetched; diff is 2 files: a 4-line change in src/incremental-lane.ts (Math.max(...ptrs) → iterative max) plus a new 57-line handler-level regression test in tests/inc-canonical-pointers.test.ts.
  • Source issue Incremental canonical pointers stop advancing when the history exceeds the JavaScript argument limit #6657 verified on GitHub: its repro/expected-behavior matches the PR's change and test exactly.
  • Audited every other Math.max(...)/Math.min(...) spread in the repo: the calibration-ring and host-list sites are bounded; the repo already carries two precedent fixes for this exact V8 argument-limit trap (src/export.ts:55, kernel/src/search/algorithms/hybrid.ts:32, both with explanatory comments). One more potentially unbounded host-side site found: src/fold-reconcile.ts:1390-1391 (claimedIdx) — same mechanism family, will address per triage rules.
  • Local validation is in progress: dependencies installed; the first test run needs the in-repo kernel built first (acp-kernel dist missing in a fresh checkout) — building now, then I will run the new regression at the PR head and reproduce the RangeError at the base commit.

Full verdict (8-question checklist) follows once the runs complete.

@Afloat16

Copy link
Copy Markdown
Contributor Author

One cross-reference for the duplicate/site audit: #6492 already covers both the claimedIdx spread in src/fold-reconcile.ts and the recordCanonicalPointers spread in src/incremental-lane.ts. Its current head is 6f7916fa, synced with master at 9495c76.

The pointer implementation there uses a two-argument reduction; this PR uses a loop. Both compute the maximum over the validated non-negative safe-integer pointers and keep -1 for an empty list. The tests are complementary: #6492 has a 150,000-pointer case with the real SessionStore plus the long-history reconciliation cases, while this PR adds the 250,000-pointer handler case with the maximum deliberately out of order and checks that the new tail is persisted.

Flagging the overlap so the claimedIdx fix is not duplicated and the extra handler coverage can be retained in whichever landing path you prefer.

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.

Incremental canonical pointers stop advancing when the history exceeds the JavaScript argument limit

2 participants