Skip to content

fix(release): keep the desktop planner's source gate inside the App token's 60-minute life - #11575

Merged
kodjima33 merged 1 commit into
mainfrom
kodjima33/release-planner-token-safe-wait
Aug 15, 2026
Merged

kodjima33 merged 1 commit into
mainfrom
kodjima33/release-planner-token-safe-wait

Conversation

@kodjima33

@kodjima33 kodjima33 commented Aug 14, 2026 •

Copy link
Copy Markdown
Collaborator

Problem

Every scheduled desktop auto-release run on Aug 14 2026 went red and no beta candidates were cut. Two stacked causes:

  1. Desktop PRs merged during the morning window when the check workflows were disabled carry no "Release Eligibility"/"Desktop Swift" check-runs on their merge commits, ever. The planner requires those checks on the newest desktop SHA.
  2. The planner's source gate waited up to 90 minutes on a GitHub App installation token minted once at job start — those expire after 60 minutes. Every poll past expiry failed with gh: Bad credentials (401), which (a) reported a misleading credentials error instead of the real gate state, and (b) killed the newest-green fallback scan that exists precisely to route around a blocked newest SHA. The 90-minute waits also overlapped the next hourly tick, getting runs cancelled by concurrency.

Fix

Clamp the source-gate wait to 45 minutes at every configuration source (planner default, CI_GATE_TIMEOUT_SECONDS, CLI flag) via clamp_source_check_wait_seconds, and mirror the clamp in the workflow shell so logs stay honest. A Swift CI run that needs longer defers to the next hourly train tick, which re-reads the finished checks instantly.

Release cadence guarantees after this fix (per Nik's ask):

  • Every desktop update ships: the hourly train picks the newest desktop SHA; if it is blocked, the (now-functional) fallback releases the newest green SHA, and the blocked commits ride in the first green successor.
  • Never more than once per hour: unchanged — scheduled runs pass --min-tag-interval-seconds 3300, keyed to the last candidate's publication time, plus the hourly cron.

Failure-Class: FC-assumed-credential-lifetime

Verification

Review in cubic

…oken's 60-minute life

The plan-release job mints one Omi Bot installation token and then let the
exact-SHA source gate wait up to 90 minutes on it. Installation tokens
expire after 60 minutes, so every poll past expiry — and the newest-green
fallback scan the blocked path depends on — failed with 'gh: Bad
credentials (401)'. Result on Aug 14 2026: every hourly auto-release run
red, the fallback dead, and the reported reason a misleading credentials
error (issue #11574); overlapping 90-minute waits also got the next tick's
runs cancelled by concurrency.

Clamp the wait to 45 minutes at every configuration source (default, env,
CLI) in the planner, and mirror the clamp in the workflow shell for honest
logs. A Swift CI run that needs longer defers to the next hourly train
tick, which re-reads the finished checks instantly — cadence stays hourly
(min-tag-interval 3300s on schedule), and every desktop update ships in
the first tick whose checks are green.

Verification: .github/scripts/test_plan_desktop_release.py — 26 tests
pass, including the new clamp regression test; clamp exercised via
CI_GATE_TIMEOUT_SECONDS=5400 -> 2700 on the real script.

Failure-Class: FC-assumed-credential-lifetime

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

3 issues found across 3 files

Confidence score: 2/5

  • In .github/scripts/plan-desktop-release.py, the new 45-minute timeout can be treated like a completed check block, so the planner may select and tag an older green SHA while the newest SHA is still pending; that can publish from stale code — keep timeout state distinct from pass/fail so pending SHAs are not bypassed.
  • In .github/workflows/desktop_auto_release.yml, recheck and replan share one Omi Bot app-token while both use raw ${CI_GATE_TIMEOUT_SECONDS}, which creates a risk that token lifetime and long waits drift apart and cause mid-flow auth failures or inconsistent planning — mint fresh tokens per long-running phase or bound each phase timeout to token validity.
  • In .github/workflows/desktop_auto_release.yml, the plan-release job comments and timeout-minutes: 105 still describe a 90-minute gate even though waits are now capped at 45 minutes, which can mislead operators during incidents and troubleshooting — align the header text and job timeout with the new cap.
Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name=".github/scripts/plan-desktop-release.py">

<violation number="1" location=".github/scripts/plan-desktop-release.py:31">
P1: When the newest SHA's checks are still missing or in progress at the new 45-minute cap, the planner treats the timeout as a completed block and can tag an older green SHA. Keep timeout distinct from a failed check and defer it to the next hourly tick before entering the fallback branch.</violation>
</file>

<file name=".github/workflows/desktop_auto_release.yml">

<violation number="1" location=".github/workflows/desktop_auto_release.yml:55">
P3: This change caps the source-check wait at 2700s (45m), but the plan-release job header still says the job allows "the full desktop CI gate wait (up to 90m)" and still grants `timeout-minutes: 105`. The 90m claim (and the 105m budget sized for it) no longer reflects the effective 45m cap and will mislead operators reading the workflow. Update the header comment to the 45m ceiling and note the job now has large slack, or tighten the timeout accordingly.</violation>

<violation number="2" location=".github/workflows/desktop_auto_release.yml:61">
P2: The 45-minute clamp only covers the hour scheduler's `plan` step. In the tag-release job a single Omi Bot token (one `app-token` step) backs both `recheck` and `replan`, each passing the raw `${CI_GATE_TIMEOUT_SECONDS}` (default 5400 → clamped 45 min). Since `recheck` can wait up to 45 min and `replan` can wait another 45 min after the changelog/merge work, the cumulative polling on one 60-minute token can still exceed its life and hit the same 401 the PR is fixing. Account for the token budget across the whole job (clamp in `recheck`/`replan` too, or bound the aggregate wait), or note that this path can still wedge.</violation>
</file>

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

Re-trigger cubic

# issue #11574). So the wait must stay safely inside the token's life; a Swift
# CI run that needs longer simply defers to the next hourly train tick, which
# re-evaluates the finished checks instantly.
TOKEN_SAFE_WAIT_CEILING_SECONDS = 45 * 60

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: When the newest SHA's checks are still missing or in progress at the new 45-minute cap, the planner treats the timeout as a completed block and can tag an older green SHA. Keep timeout distinct from a failed check and defer it to the next hourly tick before entering the fallback branch.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At .github/scripts/plan-desktop-release.py, line 31:

<comment>When the newest SHA's checks are still missing or in progress at the new 45-minute cap, the planner treats the timeout as a completed block and can tag an older green SHA. Keep timeout distinct from a failed check and defer it to the next hourly tick before entering the fallback branch.</comment>

<file context>
@@ -20,10 +20,16 @@
+# issue #11574). So the wait must stay safely inside the token's life; a Swift
+# CI run that needs longer simply defers to the next hourly train tick, which
+# re-evaluates the finished checks instantly.
+TOKEN_SAFE_WAIT_CEILING_SECONDS = 45 * 60
+SOURCE_CHECK_WAIT_SECONDS = TOKEN_SAFE_WAIT_CEILING_SECONDS
 SOURCE_CHECK_POLL_SECONDS = 30
</file context>

if (( requested_timeout > 5400 )); then
echo "Clamping source-check wait from ${requested_timeout}s to 5400s for the 105m job ceiling"
requested_timeout=5400
if (( requested_timeout > 2700 )); then

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: The 45-minute clamp only covers the hour scheduler's plan step. In the tag-release job a single Omi Bot token (one app-token step) backs both recheck and replan, each passing the raw ${CI_GATE_TIMEOUT_SECONDS} (default 5400 → clamped 45 min). Since recheck can wait up to 45 min and replan can wait another 45 min after the changelog/merge work, the cumulative polling on one 60-minute token can still exceed its life and hit the same 401 the PR is fixing. Account for the token budget across the whole job (clamp in recheck/replan too, or bound the aggregate wait), or note that this path can still wedge.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At .github/workflows/desktop_auto_release.yml, line 61:

<comment>The 45-minute clamp only covers the hour scheduler's `plan` step. In the tag-release job a single Omi Bot token (one `app-token` step) backs both `recheck` and `replan`, each passing the raw `${CI_GATE_TIMEOUT_SECONDS}` (default 5400 → clamped 45 min). Since `recheck` can wait up to 45 min and `replan` can wait another 45 min after the changelog/merge work, the cumulative polling on one 60-minute token can still exceed its life and hit the same 401 the PR is fixing. Account for the token budget across the whole job (clamp in `recheck`/`replan` too, or bound the aggregate wait), or note that this path can still wedge.</comment>

<file context>
@@ -47,17 +47,20 @@ jobs:
-          if (( requested_timeout > 5400 )); then
-            echo "Clamping source-check wait from ${requested_timeout}s to 5400s for the 105m job ceiling"
-            requested_timeout=5400
+          if (( requested_timeout > 2700 )); then
+            echo "Clamping source-check wait from ${requested_timeout}s to 2700s for the 60m token life"
+            requested_timeout=2700
</file context>

# newest-green fallback scan — fail with 401 and wedge the train
# (issue #11574). The planner clamps too; this keeps the log honest
# when a repository variable is configured higher. A Swift CI run
# that needs longer defers to the next hourly tick.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P3: This change caps the source-check wait at 2700s (45m), but the plan-release job header still says the job allows "the full desktop CI gate wait (up to 90m)" and still grants timeout-minutes: 105. The 90m claim (and the 105m budget sized for it) no longer reflects the effective 45m cap and will mislead operators reading the workflow. Update the header comment to the 45m ceiling and note the job now has large slack, or tighten the timeout accordingly.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At .github/workflows/desktop_auto_release.yml, line 55:

<comment>This change caps the source-check wait at 2700s (45m), but the plan-release job header still says the job allows "the full desktop CI gate wait (up to 90m)" and still grants `timeout-minutes: 105`. The 90m claim (and the 105m budget sized for it) no longer reflects the effective 45m cap and will mislead operators reading the workflow. Update the header comment to the 45m ceiling and note the job now has large slack, or tighten the timeout accordingly.</comment>

<file context>
@@ -47,17 +47,20 @@ jobs:
+          # newest-green fallback scan — fail with 401 and wedge the train
+          # (issue #11574). The planner clamps too; this keeps the log honest
+          # when a repository variable is configured higher. A Swift CI run
+          # that needs longer defers to the next hourly tick.
           requested_timeout="${CI_GATE_TIMEOUT_SECONDS}"
           if ! [[ "${requested_timeout}" =~ ^[0-9]+$ ]]; then
</file context>

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