Harden typing path against character-eat races and AX lag - #1
Merged
Conversation
Stop generating on host-publish ceiling misses (arm late-publish instead), refresh before destructive replace/accept, replay Tab when a queued post-exhaustion accept fails, keep the pending-insertion sentinel in sync with typed-match, reuse fresh AX snapshots during host-publish polls, and cache per-token spellcheck verdicts. Co-authored-by: Sebastian <sudosebastian@users.noreply.github.com>
sudosebastian
added a commit
that referenced
this pull request
Jul 24, 2026
…trieval (#5) * fix(runtime): repair KV trim defer and share prompt budget override Swift forbids transferring control out of defer, so replace guard/return with if when finishing a generate. Widen llamaPromptTokenBudgetOverrideIfNeeded so Input can apply the same shrink on field-entry prewarm. Co-authored-by: Cursor <cursoragent@cursor.com> * chore: bump marketing version to 1.0.1 Keep project.yml and the generated pbxproj in sync so the next XcodeGen run does not revert the display version. Co-authored-by: Cursor <cursoragent@cursor.com> * perf(runtime): skip doomed KV reuse at load and cut first-token stream delay Catalog hybrid/SWA models now advertise rejectsPartialKVTrims so request #1 already uses the compact prompt budget and skips useless prewarm/trim work. Deliver the first streamed partial immediately, and accumulate decode text by appending pieces instead of rebuilding from bytes each token. Co-authored-by: Cursor <cursoragent@cursor.com> * feat(context): add writing memory, ambient screen index, and retrieval hooks Introduce on-device writing-memory and multi-display OCR index models, settings toggles, fast/accurate OCR levels, and prompt glossary wiring so retrieved rare terms and screen context can condition completions. Co-authored-by: Cursor <cursoragent@cursor.com> * chore(context): finish retrieval wiring and layout docs Keep SOURCE_LAYOUT and prompt renderer tests aligned with the writing-memory glossary and ambient retrieval surface. Co-authored-by: Cursor <cursoragent@cursor.com> --------- Co-authored-by: Cursor <cursoragent@cursor.com>
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.
Summary
Hardens residual AX-lag races that can intermittently eat characters or batch keystrokes: stop stale host-publish generation, refresh before destructive replace/accept, replay Tab when a queued post-exhaustion accept fails, keep the typed-match insertion sentinel in sync, and cut stacked MainActor AX walks on the per-keystroke path.
Validation
Could not run
xcodebuildin this Linux cloud environment (no Xcode toolchain). Added/extended unit tests covering:pendingInsertionConsumedCountPlease run on macOS:
xcodebuild -project Cotabby.xcodeproj -scheme Cotabby -destination 'platform=macOS' build-for-testing \ -derivedDataPath build/DerivedDataTargeted:
SuggestionCoordinatorInputTests,SuggestionCoordinatorAcceptanceTests,SuggestionCoordinatorPredictionTests,SuggestionStateHelperTests.Linked issues
Refs intermittent character-eat / typing lag reports (reproduction unclear; residual races after FuJacob#376/FuJacob#381/FuJacob#382/FuJacob#668).
Risk / rollout notes
refreshNow()inside the consuming tap — correct but adds one AX walk per Tab.