Skip to content

Add desktop update policy banner - #8834

Merged
Git-on-my-level merged 1 commit into
mainfrom
codex/desktop-update-policy-banner
Jul 2, 2026
Merged

Git-on-my-level merged 1 commit into
mainfrom
codex/desktop-update-policy-banner

Conversation

@Git-on-my-level

@Git-on-my-level Git-on-my-level commented Jul 2, 2026 •

Copy link
Copy Markdown
Member

Summary

  • Add a server-controlled desktop update policy endpoint backed by Firestore so we can show future macOS update banners or required-update prompts.
  • Add a macOS client policy manager with dismissible banner support, blocking required-update prompt support, and app version/build request headers.
  • Add a desktop update policy runbook and backend tests.
  • Marked the latest stable macOS GitHub release as mandatory so the live stable appcast emits a Sparkle critical update for the current stable build.

Review Fixes

  • Use get_firestore_client() inside the update-policy helper with a keyword-only firestore_client override for tests.
  • Disable BYOK headers on the unauthenticated update-policy GET request.
  • Restrict update CTA URLs to http/https before opening them.
  • Rename the operator-facing build ceiling to maximum_build_number; the backend still accepts the old minimum_build_number alias for compatibility.
  • Rewrite the changelog fragment from the user's perspective.

Current Recovery Notes

  • Stable v0.11.507+11507-macos now has mandatory: true in release metadata, and the live stable appcast includes <sparkle:criticalUpdate /> for 0.11.507+11507.
  • Sampled old 4xx macOS tags (v0.11.400+11400-macos, v0.11.450+11450-macos, v0.11.480+11480-macos, v0.11.507+11507-macos) include CrispManager, backend /v1/crisp/unread, and DesktopHomeView startup of Crisp, so Crisp support-message prompts should be available for signed-in/running clients.
  • This PR does not send the Crisp message itself; that still needs to be sent via Crisp/support ops if we want the extra manual-install prompt for affected users.

Tests

  • cd backend && uv run --with pytest --with pytest-asyncio --with httpx --with fastapi pytest tests/unit/test_desktop_updates.py tests/unit/test_announcement_malformed_type.py
  • cd backend && uv run python -m py_compile database/desktop_update_policy.py routers/updates.py
  • git diff --check HEAD
  • Pre-push hook passed, including selected backend update tests and OpenAPI contract check.

Local Desktop Build Note

  • Attempted cd desktop/macos && xcrun swift build -c debug --package-path Desktop, but this local toolchain is blocked by existing #Preview macro / PreviewsMacros.SwiftUIView plugin errors across unrelated desktop files before a full desktop build can complete.

@mintlify

mintlify Bot commented Jul 2, 2026

Copy link
Copy Markdown

Preview deployment for your docs. Learn more about Mintlify Previews.

Project Status Preview Updated (UTC)
deepeninc 🟡 Building – Jul 2, 2026, 4:45 AM

💡 Tip: Enable Workflows to automatically generate PRs for you.

@mintlify

mintlify Bot commented Jul 2, 2026 •

Copy link
Copy Markdown

Preview deployment for your docs. Learn more about Mintlify Previews.

Project Status Preview Updated (UTC)
omi 🟢 Ready View Preview Jul 2, 2026, 4:46 AM

💡 Tip: Enable Workflows to automatically generate PRs for you.

@cubic-dev-ai cubic-dev-ai 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.

4 issues found across 8 files

Confidence score: 3/5

  • In backend/database/desktop_update_policy.py, the new helper bypasses the usual get_firestore_client() pattern and can reintroduce import-time Firestore client access, which makes tests harder to isolate and increases regression risk around initialization behavior—refactor it to acquire the client inside get_desktop_update_policy before merging.
  • In desktop/macos/Desktop/Sources/DesktopUpdatePolicyManager.swift, downloadURL is treated as trusted Firestore string data and may allow non-HTTP(S) URL schemes to be opened, which could trigger unintended app/system actions from the update CTA—validate and restrict schemes to http/https before calling NSWorkspace.shared.open.
  • In docs/runbooks/desktop-update-policy.md, the minimum_build_number name conflicts with its documented ceiling behavior, which can cause operator misconfiguration and incorrect policy rollout decisions—rename it to a ceiling-style term (for example maximum_build_number) and align wording before rollout.

Reply with feedback, questions, or to request a fix.

Re-trigger cubic

Comment thread docs/runbooks/desktop-update-policy.md Resolved

@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: fda9e6ae0a

ℹ️ 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".

if let currentBuild {
endpoint += "&current_build=\(currentBuild)"
}
return try await get(endpoint, requireAuth: false)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Avoid attaching BYOK keys to policy polling

When BYOK is enabled, this new unauthenticated policy poll still goes through get, which calls buildHeaders(requireAuth:) with its default includeBYOK: true; that attaches the user's provider API keys even though /v2/desktop/update-policy does not need LLM/STT credentials. Because refresh() runs this on launch and app activation, BYOK users will repeatedly send their secrets to a public update-policy endpoint where they can be exposed in request logs or intermediaries. Add an includeBYOK: false path for GETs or build this request without BYOK headers.

Useful? React with 👍 / 👎.

@Git-on-my-level
Git-on-my-level force-pushed the codex/desktop-update-policy-banner branch from fda9e6a to 0295aa3 Compare July 2, 2026 05:21
@Git-on-my-level

Copy link
Copy Markdown
Member Author

Addressed the review comments in 0295aa3: switched the policy helper to lazy get_firestore_client() with a test override, disabled BYOK headers for the unauthenticated policy poll, restricted CTA URLs to http/https, renamed the rollout ceiling to maximum_build_number while keeping the old field as an accepted alias, and rewrote the changelog copy from the user perspective. Re-ran backend tests/py_compile/diff-check; pre-push hooks also passed. The desktop Swift build is still blocked locally by the existing unrelated #Preview macro plugin issue.

@Git-on-my-level

Copy link
Copy Markdown
Member Author

@codex review

1 similar comment
@Git-on-my-level

Copy link
Copy Markdown
Member Author

@codex review

@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: 0295aa3b65

ℹ️ 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".

}
.onAppear {
log("DesktopHomeView: Showing mainContent (signed in and onboarded)")
updatePolicyManager.refresh(force: true)

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 Start update checks before sign-in gates

Because the only forced refresh is inside the signed-in/onboarded mainContent branch, users who are stuck on sign-in or onboarding on an affected build never call the unauthenticated /v2/desktop/update-policy endpoint and therefore cannot see a required manual-update prompt. If this policy is used to recover from an auth/onboarding regression in an old desktop build, those users remain stranded; start the manager at a top-level view and render required prompts across all auth states.

Useful? React with 👍 / 👎.

Comment on lines +68 to +69
private func dismissedKey(for policy: DesktopUpdatePolicyResponse) -> String {
dismissedPrefix + policy.id

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 Avoid reusing one dismissal key for unnamed banners

Dismissal is keyed only by policy.id; when ops updates the single Firestore document without adding/changing an id (the new runbook sample omits one, so the backend defaults it to current), every optional banner shares this same key. A user who dismisses one banner will silently suppress later update banners with different copy or build ceilings until their defaults are cleared; include the policy/build version in the key or require a unique id for dismissible policies.

Useful? React with 👍 / 👎.

@Git-on-my-level
Git-on-my-level force-pushed the codex/desktop-update-policy-banner branch from cd194d7 to c0bd17e Compare July 2, 2026 06:33
@Git-on-my-level
Git-on-my-level merged commit 2002e6f into main Jul 2, 2026
5 checks passed
@Git-on-my-level
Git-on-my-level deleted the codex/desktop-update-policy-banner branch July 2, 2026 06:45

This branch was successfully deployed

1 active deployment
staging - docs — c0bd17e8 Deployed Jul 2, 2026 by mintlify[bot]
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