Skip to content

#832 Treat an overflowing iOS retry-after as no hint - #835

Merged
ivanfenenko merged 1 commit into
mainfrom
fix/832-ios-retry-after-overflow
Oct 25, 2026
Merged

ivanfenenko merged 1 commit into
mainfrom
fix/832-ios-retry-after-overflow

Conversation

@ivanfenenko

@ivanfenenko ivanfenenko commented Oct 25, 2026 •

Copy link
Copy Markdown
Collaborator

Refs #832

What

This adds the iOS overflow guard that missed the merge of #834. Commit 15d2dc9 was pushed to the 834 branch two minutes after the PR merged, so it never reached main.

SessionFailure.retryAtEpochMs() returned recordedAtEpochMs + retryAfterMs. In Swift, an Int64 addition that overflows crashes the app. A real opencode server can't send a retryAfterMs that large, but a buggy or hostile one could. The addition now uses addingReportingOverflow. On overflow it returns nil, so the failure mark shows no "Try again" line.

Android is unchanged. Kotlin Long addition wraps to a negative time, and the existing code already shows no hint in that case.

Checks

  • iOS xcodebuild test -only-testing:"OpenCode MobileTests" on an iPhone 17 simulator: ** TEST SUCCEEDED **, 2726 tests in 262 suites.
  • New test overflowingRetryAfterIsNoHint() in SessionFailureTests.swift uses retryAfterMs: Int64.max and expects retryAtEpochMs() to be nil, with no crash.
  • No PR evidence page: this is a guard for input a real server never sends, and the unit test covers it.

Risks / Follow-ups

  • None. The countdown label math after this point can't overflow for any time that passes the guard.

🤖 Generated with Claude Code


View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith with what you need.

recordedAtEpochMs + retryAfterMs traps on Int64 overflow, so a bogus
retryAfterMs from a buggy or hostile server would crash the app. Use
addingReportingOverflow and return nil instead.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Automated review: no finding that 2+ of 3 passes agreed on.

opencode pr-review · passes: muse-spark-1.3-contributor, glm-5.3-flash, deepseek-v4.1-flash · $0.017

@ivanfenenko
ivanfenenko merged commit f083701 into main Oct 25, 2026
2 checks passed
@ivanfenenko
ivanfenenko deleted the fix/832-ios-retry-after-overflow branch October 25, 2026 21:25
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