Skip to content

fix(history): ignore non-finite checkpoint timestamps - #1563

Closed
Bluuok wants to merge 4 commits into
TencentCloud:developfrom
Bluuok:fix/nonfinite-checkpoint-timestamps
Closed

Bluuok wants to merge 4 commits into
TencentCloud:developfrom
Bluuok:fix/nonfinite-checkpoint-timestamps

Conversation

@Bluuok

@Bluuok Bluuok commented Oct 3, 2026

Copy link
Copy Markdown

Summary

NaN or positive infinity in a checkpoint timestamp makes integer conversion raise. History projection then silently drops the message, while API history serialization raises instead of falling back to the row timestamp. Treat non-finite floats as missing timestamps so message content is retained and the existing fallback/live-stamping paths work. Integer inputs keep their existing behavior.

Target branch

  • Base is develop
  • Base is main

Type of change

  • Bug fix
  • Refactor / chore

Test plan

  • uv run pytest tests/unit/history/test_nonfinite_checkpoint.py tests/unit/history/test_projection.py tests/unit/api/test_chat_polish.py -q: 50 passed. The corrected regression suite on unchanged base source gives 4 failed/3 passed: NaN and positive-infinity cases fail; negative infinity and the integer case already pass.
  • make all: backend lint/typecheck and the non-live suite passed; 4047 passed, 137 skipped, 34 warnings.
  • Enabled repository hook: make precommit and dashboard production build passed.
  • Windows uses Python 3.12, PYTHONUTF8=1, and Git Bash. Live tests/external-provider calls were not run; Linux validation is left to PR CI.
  • make all passes locally
  • Added/updated tests

Checklist

  • Updated CHANGELOG.md (if user-facing)
  • README / docs updated (if needed)

Bluuok added 2 commits October 3, 2026 21:35
Merge develop 709f998 while preserving the non-finite checkpoint fix and all upstream release notes.

@dangzitou dangzitou left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Reviewed 8740abe559c286818055b98edff2d40cea209863 against upstream develop at 709f9986d26de8ba13134859e42aedced1d21977 in an isolated worktree (macOS, Python 3.12.14, dependencies installed with uv sync --locked --python 3.12).

The shared parser guard fixes both history projection and API timestamp fallback for NaN/+Infinity. Negative infinity was already rejected by the existing non-positive check. Restricting math.isfinite to floats also preserves the existing integer behavior, including integers too large for float conversion.

Independent validation:

  • Ran the PR's seven regression cases against unchanged upstream source: 4 failed, 3 passed. The NaN/+Infinity projection and serialization cases fail before the fix.
  • On this head, ran uv run pytest tests/unit/history/test_nonfinite_checkpoint.py tests/unit/history/test_projection.py tests/unit/api/test_chat_polish.py -q together with 21 additional reviewer cases: 71 passed. The extra cases cover normal seconds/milliseconds, invalid inputs, huge integers, human/assistant batch projection, deduplication, fallback timestamps, and preserving the original message when live-stamping a copy.
  • make all PYTEST_JOBS=2 (using RUN="uv run --no-sync" after locked installation): passed, including lint/typecheck and 4172 passed, 18 skipped in the non-live suite. The checkout remained clean.

No blocking findings for this change. Real-provider calls were not exercised; GitHub returned no CI checks for this head at review time.

Bluuok added 2 commits October 4, 2026 10:23
Merge develop c928ddc and retain the non-finite checkpoint fix after the new FnOS release note.
@jubaoliang jubaoliang closed this Oct 5, 2026
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.

3 participants