Skip to content

feat: Detect outdated CLI versions and auto-prompt/suggest upgrade path to users.#456

Merged
blainekasten merged 9 commits into
mainfrom
cursor/cli-version-upgrade-00e1
Jul 22, 2026
Merged

feat: Detect outdated CLI versions and auto-prompt/suggest upgrade path to users.#456
blainekasten merged 9 commits into
mainfrom
cursor/cli-version-upgrade-00e1

Conversation

@blainekasten

@blainekasten blainekasten commented Jul 20, 2026

Copy link
Copy Markdown
Contributor

Summary

  • start the cached PyPI version lookup immediately before command execution so setup failures cannot leak background-task errors
  • call VersionCheck.inform() after command completion and resource cleanup, with a bounded wait for version resolution
  • prompt only when stdin, stdout, and stderr are TTYs; keep redirected and JSON output clean
  • suppress prompts after failed/interrupted commands while still printing upgrade guidance
  • preserve command exit status when the user interrupts the upgrade prompt
  • cache successful checks for 24 hours and fail open on network/cache errors
  • compare Together's major.minor.patch releases without adding a runtime dependency
  • detect uv-tool and pipx installs when selecting the upgrade command
  • preserve the latest light/dark CLI theme behavior while routing update notices to stderr

Testing

  • 34 passed across version-check, launcher, and console-theme tests
  • full Ruff and formatting checks pass
  • targeted Pyright and mypy pass
  • uv build succeeds

Linear: DX-774

Linear Issue: DX-774

Open in Web Open in Cursor 

Co-authored-by: Blaine Kasten <blainekasten@gmail.com>
@broly-code-security-scanner

broly-code-security-scanner Bot commented Jul 20, 2026

Copy link
Copy Markdown

Broly Security Scan

Note

Clean scan
No vulnerabilities detected in this PR.

Note

Re-scan this PR anytime with /broly scan — useful after /broly undismiss, or to refresh findings without a new push.

Broly — SAST (zai-org/GLM-5.2) · Secrets · SCA · GH Actions (zizmor) · Containers · SBOM · Powered by Together AI

Co-authored-by: Blaine Kasten <blainekasten@gmail.com>
Comment thread pyproject.toml Outdated
Comment thread src/together/lib/cli/__init__.py Outdated
cursoragent and others added 3 commits July 20, 2026 18:06
Co-authored-by: Blaine Kasten <blainekasten@gmail.com>
Co-authored-by: Blaine Kasten <blainekasten@gmail.com>
Comment thread src/together/lib/cli/utils/_version_check.py Outdated
cursoragent and others added 2 commits July 21, 2026 20:36
Co-authored-by: Blaine Kasten <blainekasten@gmail.com>
… into cursor/cli-version-upgrade-00e1

# Conflicts:
#	src/together/lib/cli/__init__.py
#	src/together/lib/cli/utils/_version_check.py
#	tests/cli/test_main.py
#	tests/cli/test_version_check.py

Co-authored-by: Blaine Kasten <blainekasten@gmail.com>
@blainekasten blainekasten changed the title Detect outdated CLI versions and offer upgrades feat: Detect outdated CLI versions and auto-prompt/suggest upgrade path to users. Jul 21, 2026
@blainekasten

Copy link
Copy Markdown
Contributor Author

@cursoragent resolve conflicts

@cursor

cursor Bot commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

Conflicts resolved and pushed. PR is now mergeable.

Preserved the new light/dark console architecture plus stderr update notices. 30 tests, lint, type checks, and build pass.

Open in Web Open in Cursor 

@blainekasten
blainekasten marked this pull request as ready for review July 21, 2026 21:07
…grade-00e1

# Conflicts:
#	src/together/lib/cli/utils/_console.py

Co-authored-by: Blaine Kasten <blainekasten@gmail.com>
Comment thread src/together/lib/cli/__init__.py Outdated
Parameter(name="json", group=global_options, negative=(), help="Output the response in JSON format"),
] = False,
) -> None:
version_check = VersionCheck()

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

if anything fails between here and the try at L346 ie. missing API key, project resolve we'll get noise on stderr.

lets move this right before the try?

return

try:
latest_version = await self._latest_version

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

theres no timeout on this await, should we wrap this in a asyncio.wait_for

Comment thread src/together/lib/cli/__init__.py Outdated
if not no_auth_command and client.project_id is None:
client.project_id = await _resolve_project_id(client)

is_interactive = sys.stdin.isatty() and sys.stderr.isatty() and not _is_agent_or_ci()

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

stdout isn't checked here, but the prompt writes to stdout - so together models list | grep foo gets escape codes in the pipe. add sys.stdout.isatty()?

flush_pending_events()
await client.close()
try:
flush_pending_events()

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

this runs even when the command failed, so users get an upgrade prompt right after an error. and ctrl-C at the prompt clobbers the exit code. maybe just print the notice, no prompt, on failure?

@blainekasten

Copy link
Copy Markdown
Contributor Author

@cursoragent address all the feedback from Zain. Either respond on the comments if you disagree, or push changes addressing his concerns.

@cursor

cursor Bot commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

Addressed all Zain feedback and pushed:

  • Delayed checker creation until command execution.
  • Added bounded resolution timeout.
  • Added stdout TTY detection.
  • Disabled prompts after failures/interruption.
  • Preserved exit status on prompt Ctrl-C.

34 tests pass; lint, types, and build pass.

Open in Web Open in Cursor 

Co-authored-by: Blaine Kasten <blainekasten@gmail.com>
@blainekasten
blainekasten merged commit e870160 into main Jul 22, 2026
11 of 12 checks passed
@github-actions github-actions Bot mentioned this pull request Jul 22, 2026

@cursor cursor Bot 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.

Docs update opened: https://github.com/togethercomputer/mintlify-docs/pull/1303

View PR

Open in Web View Automation 

Sent by Cursor Automation: Update mintlify-docs from code changes

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