Skip to content

Recover word prediction from one slow call without needing Retry - #925

Merged
enaboapps merged 3 commits into
mainfrom
924-slow-call-recovery
Sep 27, 2026
Merged

enaboapps merged 3 commits into
mainfrom
924-slow-call-recovery

Conversation

@enaboapps

@enaboapps enaboapps commented Sep 27, 2026 •

Copy link
Copy Markdown
Contributor

Closes #924

Problem

Word prediction turned itself off after a single slow moment and stayed off until the person selected Retry predictions. One call over 1.5 seconds in the worker, or one reply over two seconds in the main process, was enough.

Change

  • Worker: a slow call still returns its suggestions. Three slow calls in a row mark the model unavailable. A call at normal speed clears the count. A model error is still fatal at once.
  • Main process: the first missed reply deadline kills the worker and its text context, and a new worker starts on the next poll. A second missed deadline within 60 seconds of that replacement fails prediction and offers Retry predictions as before, whatever the replacement answered in between. A third missed deadline while the same keyboard is open also fails.
  • An acceptance waiting on the missed reply still fails and types nothing.

No protocol interface or persisted schema changes.

Validation

All run locally on Windows and passing:

  • npm run prediction-model
  • npm run lint
  • npm test
  • npm run build
  • cargo fmt --manifest-path src-tauri/Cargo.toml --check
  • cargo clippy --manifest-path src-tauri/Cargo.toml --all-targets -- -D warnings
  • cargo test --manifest-path src-tauri/Cargo.toml: 574 passed

New tests use fake models and sleeping subprocesses and inject no input.

Not verified: behaviour in the running app under a real stall.

🤖 Generated with Claude Code

The worker tolerates a slow call and gives up only after three in a
row. The main process replaces a worker that misses the reply deadline
once, and fails if the replacement stalls before suggesting anything.

Closes #924

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@enaboapps enaboapps added this to the v1.0.0-rc.16 milestone Sep 27, 2026
OwenMcGirr and others added 2 commits September 27, 2026 15:10
Review follow-up: a second missed deadline within 60 seconds of a
replacement now fails for good, which closes two restart loops. The
recovery path no longer flips the keyboard's failed state, and the
tests prove the kill, cover an acceptance in flight and use wide timing
margins.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Review follow-up: a keyboard gets two replacements however far apart,
so a machine that stalls on every call reaches Retry. The badge shows
loading straight after a replacement, and the test now delivers the
replacement's answer before the second miss.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@enaboapps
enaboapps marked this pull request as ready for review September 27, 2026 14:15
@enaboapps
enaboapps merged commit 369d833 into main Sep 27, 2026
6 checks passed
@enaboapps
enaboapps deleted the 924-slow-call-recovery branch September 27, 2026 15:21
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.

Recover word prediction from one slow call without needing Retry

2 participants