Repository navigation
fix(platform): show the real reason when a queued deploy is refused - #908
Open
Brooooooklyn wants to merge 1 commit into
Open
Brooooooklyn wants to merge 1 commit into
Brooooooklyn wants to merge 1 commit into
Conversation
When the deploy handler refused an admitted deploy at run time (for example a Zero Trust flip that won the race, or a canceled build), the stream always said "Admitted deployment is no longer authorized or valid". Read the handler's small JSON body and pass on its message, keeping the generic text as a fallback. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
When a queued deploy is refused at the last check, the deploy stream now shows the real reason (for example "Zero Trust protection for this project is not ready … then retry") instead of always saying "Admitted deployment is no longer authorized or valid".
How it was found
Found during a live end-to-end run of a self-hosted platform while testing the security-audits work (PR #886). The bug is not part of that feature: it is in the existing durable deploy path, so it gets its own PR.
In the test, a project was flipped to public with
void project zero-trust publicwhile avoid deploywas still waiting for admission. The flip won the race, as expected. The deploy then failed, which is also expected, but the stream said:The user cannot tell from this that a plain retry is the fix. A retry right after did succeed.
Repro
void deployfor that project.void project zero-trust publicfor the same project.authorizationZero Trust protection for this project is not ready: The project public exception is still reconciling. … then retry.Admitted deployment is no longer authorized or validThe same happens for any other refusal at run time, such as a build that was canceled while its deploy sat in the queue ("This build is no longer active. Start a new build to deploy the current version.").
Root cause
platform/packages/api/src/routes/deploy.ts:585-607(on main) runs the deploy handler again for the queued work. When the handler answers anything other than 204, the code marks the deployment failed and appends anerrorevent with a fixed text. It never reads the response body, so the handler's ownmessage(orerror) is dropped.Fix
platform/packages/api/src/routes/deploy.ts: newrejectedAdmissionReason()reads the handler's response when it is JSON, up to 8 KiB, and takesmessage, orerrorwhen there is nomessage. The result (cut to 4096 characters) is used both for the deployment'serror_messageand for theerrorevent. If the body is missing, not JSON, too large, or has neither field, the old generic text is still used.authorizationand the status staysfailed, so nothing else in the flow changes.These messages are the same ones a direct (non-queued) deploy already returns to the CLI, so no new information is exposed.
Tests
platform/packages/api/test/integration/deployment-execution.test.ts:error_messageand the lasterrorevent carry the Zero Trust reason with the retry hint.authorization.Both fail on main (they get the generic text) and pass with this change. Ran:
vp test run --project 'platform-api-integration*' platform/packages/api/test/integration/deployment-execution.test.ts: 55 passedvp run --filter ./platform/packages/api typecheckvp check: format and lint pass; the only errors are missing generatedtsconfigfiles in playgrounds that this worktree did not buildvp run test: still running when this PR was opened; CI covers the full suite🤖 Generated with Claude Code