Skip to content

Add GPTel sync timeout and fallbacks#384

Closed
tninja wants to merge 0 commit into
mainfrom
kang_feat
Closed

Add GPTel sync timeout and fallbacks#384
tninja wants to merge 0 commit into
mainfrom
kang_feat

Conversation

@tninja

@tninja tninja commented Jun 9, 2026

Copy link
Copy Markdown
Owner

Summary

Fixes #383 by making synchronous GPTel helper calls fail faster and degrade gracefully in the places where GPTel is only used as an enhancement.

Details

ai-code-call-gptel-sync now has a configurable 10 second default timeout through ai-code-gptel-sync-timeout-seconds, plus per-call :timeout and :fallback options. Calls without a fallback keep the previous error behavior, while callers that can safely continue now provide explicit fallback values.

The fallbacks are tailored by use case: prompt headlines skip the generated text, filename generation uses deterministic local cleanup, shell command generation returns an empty command instead of risking a bad command, and GPTel classifiers fall back to UNKNOWN or keyword-based classification.

Verification

  • emacs -Q -batch -L . -l test/test_00-bootstrap.el -l ert --eval "(mapc #'load-file (file-expand-wildcards \"test/test_*.el\"))" -f ert-run-tests-batch-and-exit
  • emacs -Q -batch -L . -l test/test_00-bootstrap.el -f batch-byte-compile ai-code-prompt-mode.el ai-code-file.el ai-code-harness.el ai-code-behaviors.el ai-code-discussion.el
  • checkdoc-file for touched Emacs Lisp files

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.

ai-code-call-gptel-sync should have timeout and fallback solution

1 participant