Skip to content

Fix: distinguish timeouts from usage limits, enable seamless resumption#52

Merged
max-tet merged 1 commit intomainfrom
fix/timeout-vs-usage-limit
Mar 24, 2026
Merged

Fix: distinguish timeouts from usage limits, enable seamless resumption#52
max-tet merged 1 commit intomainfrom
fix/timeout-vs-usage-limit

Conversation

@max-tet
Copy link
Copy Markdown
Collaborator

@max-tet max-tet commented Mar 22, 2026

Summary

  • Timeouts were misclassified as UsageLimitError, causing false "usage limit hit" log messages (observed on Speed up tests FreeshardBase/freeshard#45) and — for CLI backend — losing all session state so retries started from scratch
  • Introduces InvocationTimeoutError as a separate exception with accurate logging ("Timed out" vs "Usage limit hit")
  • API backend: catches TimeoutError from the tool loop, saves conversation state + commits WIP before raising
  • CLI backend: pre-generates a UUID session ID via --session-id and saves it before subprocess.run, so it survives timeouts and the next cycle can --resume seamlessly
  • All task files (implement.py, plan.py, review.py) updated to catch both exception types

Test plan

  • All 283 existing tests pass
  • New tests for InvocationTimeoutError behavior in both backends
  • New test verifying session ID is saved even when CLI times out on first invocation
  • New test verifying timeout sets interrupted status with cost accumulation in implement task

🤖 Generated with Claude Code

Timeouts were misclassified as UsageLimitError, causing false "usage
limit hit" log messages and — for CLI backend — losing all session
state so retries started from scratch. This introduces
InvocationTimeoutError as a separate exception and ensures conversation
state is saved before the timeout propagates:

- API backend: catch TimeoutError, save conversation + commit WIP
- CLI backend: pre-generate session ID via --session-id and save it
  before subprocess.run, so it survives timeouts
- Task files: catch InvocationTimeoutError with accurate log messages

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@max-tet max-tet merged commit 270bb8c into main Mar 24, 2026
2 checks passed
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.

1 participant