Repository navigation
correct: Poll the deadline inside structural traversals - #137
Open
BenWestgate wants to merge 1 commit into
Open
BenWestgate wants to merge 1 commit into
BenWestgate wants to merge 1 commit into
Conversation
BenWestgate
force-pushed
the
claude/indel-deadline
branch
from
October 7, 2026 09:47
07cc26b to
86a789d
Compare
BenWestgate
marked this pull request as ready for review
October 7, 2026 09:57
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 86a789d0f4
ℹ️ 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".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
BenWestgate
force-pushed
the
claude/indel-deadline
branch
from
October 7, 2026 10:11
86a789d to
f1d223c
Compare
BenWestgate
force-pushed
the
claude/remove-unused-api
branch
from
October 8, 2026 01:51
0c5d3f0 to
c8bedfd
Compare
BenWestgate
force-pushed
the
claude/indel-deadline
branch
from
October 8, 2026 01:56
f1d223c to
3fe58cd
Compare
_search_target checked the deadline once per layer and once per 32
yielded alignments. indel._views skips duplicate edits inside a run of
one symbol, so on repeated-symbol input some layers did millions of
steps between yields: a 126-character all-q string spent 237 s in one
('I', 'I', 'I', 'AT') traversal without yielding, and correct() on
"ms10tests" + "q" * 122 returned after 14.2 s instead of 10 s.
Pass the deadline into _views and poll it before each edit or swap,
including swaps of equal symbols that are then skipped, and every 1024
deletion choices, as _competitors._known_swaps already does; once it
passes, every level returns without touching its remaining siblings.
A search whose last layer stops at the deadline now reports itself
incomplete. The same input now returns at 10.00 s, and a 1,023-symbol
all-q distant swap layer stops at once instead of 0.5 s past the
deadline.
Fixes #136
Claude-Session: https://claude.ai/code/session_01T233rKgZqE5wzDm3EVTHL1
BenWestgate
force-pushed
the
claude/indel-deadline
branch
from
October 8, 2026 07:45
3fe58cd to
56bba33
Compare
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Before:
correct(CorrectionContext(Profile.MS), "ms10tests" + "q" * 122)returned after 14.2 s, despite the documented ten-second deadline. Some alignment traversals on repeated-symbol input did minutes of work without yielding, so_search_targetnever reached its deadline check: one traversal on a 126-character all-qstring ran 237 s.After: the same call returns at 10.00 s. A search that stops at the deadline in its last layer now reports itself incomplete.
How:
indel._viewstakes the deadline. It checks it before each edit or swap, including swaps of two equal symbols that are then skipped, and every 1024 deletion choices, the way_competitors._known_swapsalready does. Once the deadline passes, every level returns without visiting its remaining siblings, so a traversal stops within a millisecond of the deadline._search_targetreturnsFalsewhen the deadline has passed by the end of its layers. One consequence is deliberate: a search that finishes just after the deadline is now reported as incomplete instead of complete, which errs on the safe side.Swap and insertion traversals on ordinary input show no measurable slowdown. On all-repeated input, where most edits are skipped, the deletion loop is about 20% slower (3.6 s to 4.4 s for one pathological layer) and so is a swap layer (0.52 s to 0.62 s at 1,023 symbols).
Security review (focused): ACK.
bestcutoff path,_search_manyand_search_competitorsall see the deadline as passed.qswap layer ran 0.5 s past an expired deadline; the poll now comes before that skip and it stops at once. That follow-up only moves the check earlier, so the completeness argument above covers it unchanged.Tests: four deterministic clock tests cover both traversal branches, the skipped equal swaps and the incomplete result. All four fail on the current code. The full suite passes (911 tests).
Stacked on #130: on
reviewability-v1this change would push the package past the 5,200-line budget, and #130 brings it down to 4,959. With this change it is 4,971.Fixes #136. Found by Codex on #94.
🤖 Generated with Claude Code
https://claude.ai/code/session_01T233rKgZqE5wzDm3EVTHL1