Skip to content

Harden preview capacity lifecycle state - #350

Merged
kfiramar merged 2 commits into
mainfrom
codex/harden-preview-capacity-state
Jul 15, 2026
Merged

kfiramar merged 2 commits into
mainfrom
codex/harden-preview-capacity-state

Conversation

@kfiramar

@kfiramar kfiramar commented Jul 15, 2026 •

Copy link
Copy Markdown
Collaborator
  • Harden preview capacity lifecycle state (6de1127)

View with Codesmith Autofix with Codesmith
Need help on this PR? Tag /codesmith with what you need. Autofix is disabled.

@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: 6de1127f6b

ℹ️ 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 on lines +1916 to +1920
self.expire_overdue_previews(
self.active_prs_with_label(),
now=utc_now(),
exclude_pr_numbers={pr.number},
)

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 Make stale-preview expiry best-effort during start

In the pull_request_target start path, this new pre-admission expiry pass makes every label/synchronize start depend on active_prs_with_label(), which ultimately runs gh pr list through CommandRunner.json with check=True. If that GitHub list call has a transient failure, the controller raises before deploying the PR already present in the event payload and before posting the normal failure comment; stale-preview expiry is an optimization, so it should be caught/logged as best-effort rather than aborting all new preview starts during a list API hiccup.

Useful? React with 👍 / 👎.

Comment on lines +104 to +106
"public_route_cleanup_failed",
"public_route_unhealthy",
"start_cleanup_failed",

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 Clear cleanup-failed state after retry cleanup

When a PR is already in start_cleanup_failed or public_route_cleanup_failed, adding these values to FAILED_START_STATUSES makes a retry run cleanup_failed_start_preview() and then continue. If that cleanup succeeds but the retry fails before saving a replacement state, such as an envctl import failure, the old cleanup-failed state remains on disk and is still capacity-consuming even though the runtime was just blasted and leases may have been released, so unrelated previews can keep being denied. Clear/save the state after successful retry cleanup before proceeding.

Useful? React with 👍 / 👎.

@kfiramar
kfiramar merged commit 5bd5a84 into main Jul 15, 2026
3 checks passed
@kfiramar
kfiramar deleted the codex/harden-preview-capacity-state branch July 15, 2026 22:57
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