Skip to content

add: background upgrade hint at startup (rate-limited, non-blocking)#42

Merged
ianalloway merged 3 commits into
mainfrom
claude/startup-upgrade-hint
Jun 30, 2026
Merged

add: background upgrade hint at startup (rate-limited, non-blocking)#42
ianalloway merged 3 commits into
mainfrom
claude/startup-upgrade-hint

Conversation

@ianalloway

Copy link
Copy Markdown
Owner

Summary

  • background_update_hint() in solvent/upgrade.py fires a daemon thread on startup
  • Thread checks PyPI at most once per 24 h (timestamp gate: data_dir/.upgrade_check)
  • Prints a one-liner to stderr only when a newer version is available
  • Skipped entirely when SOLVENT_NO_UPDATE_CHECK=1 is set
  • Daemon thread — never blocks process exit
  • Called automatically when solvent runs with no subcommand (the interactive demo path)

Test plan

  • python3 -m pytest tests/test_upgrade_hint.py -v → 8 passed
  • python3 -m pytest -q → 324 passed, 6 skipped
  • SOLVENT_NO_UPDATE_CHECK=1 solvent — no PyPI call, no hint
  • solvent when outdated → stderr hint within a few seconds
  • solvent twice within 24 h → hint only on first run

🤖 Generated with Claude Code

https://claude.ai/code/session_01SGjM79GJpSksy9wSSBa7e6


Generated by Claude Code

claude added 2 commits June 30, 2026 16:38
Calls background_update_hint() when solvent runs with no subcommand.
A daemon thread checks PyPI at most once per 24h and prints a one-liner
to stderr if a newer version is available. Skipped via
SOLVENT_NO_UPDATE_CHECK=1. Timestamp gate lives in data_dir/.upgrade_check.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SGjM79GJpSksy9wSSBa7e6
@ianalloway ianalloway marked this pull request as ready for review June 30, 2026 16:39
Copilot AI review requested due to automatic review settings June 30, 2026 16:39

Copilot AI 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.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: f8fe29b620

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread solvent/upgrade.py
if time.time() - last < _CHECK_INTERVAL:
return
latest = latest_pypi_version()
stamp_path.write_text(str(time.time()))

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Keep the update stamp out of the git worktree

In source checkouts, solvent.paths.data_dir() resolves to <repo>/data, and .gitignore does not ignore data/.upgrade_check, so this write makes the repository dirty just by running the no-subcommand CLI path (I also hit it when the routing test exercised entry.main()). Store the rate-limit stamp in an already-ignored/cache location or add this file to the ignore rules so normal CLI/test usage does not leave untracked files behind.

Useful? React with 👍 / 👎.

In source checkouts data_dir() resolves to <repo>/data; writing the
rate-limit stamp there without a gitignore entry dirtied the tree on
every no-subcommand CLI run.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SGjM79GJpSksy9wSSBa7e6
@ianalloway ianalloway merged commit d3915d0 into main Jun 30, 2026
5 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.

3 participants