fix(ci): wait for postCreateCommand before running the command - #774
Merged
Conversation
devsy ci ran the user command immediately after RunHeadless returned, without waiting for deferred lifecycle hooks (postCreateCommand) to finish. With the default waitFor=updateContentCommand, postCreate runs in a detached background process, so the command could execute before the container was fully provisioned (e.g. secrets injected by a postCreateCommand were missing). ci now floors the effective waitFor at postCreateCommand so provisioning hooks run synchronously. The floor never lowers a later waitFor a user configured, per the devcontainer spec. postStartCommand stays deferred to avoid blocking ci on long-running start commands. Collapse RunPreAttachHooks parameters into a PreAttachOptions struct.
✅ Deploy Preview for images-devsy-sh canceled.
|
✅ Deploy Preview for devsydev canceled.
|
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (7)
📝 WalkthroughWalkthroughThe change adds ChangesLifecycle wait phase propagation
Estimated code review effort: 3 (Moderate) | ~20 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
skevetter
marked this pull request as ready for review
July 27, 2026 06:07
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
devsy cicould run the user command before the container was fully provisioned. It executed the command immediately afterRunHeadlessreturned, but with the devcontainer defaultwaitFor=updateContentCommand,postCreateCommandruns in a detached, unawaited background process — so the command raced that process. Symptom: apostCreateCommandthat writes state (e.g. injecting a secret from--secrets-file) hadn't run yet, so the command saw missing files/data.Fix
cinow floors the effectivewaitForatpostCreateCommand, so provisioning hooks run synchronously before the run command. Sinceciis a batch operation with no interactive attach, there's no reason to defer hooks (deferral exists to makedevsy upattach fast).Key details:
waitFora user explicitly configured (e.g.postStartCommand/postAttachCommand), mirroring the existingpromoteDotfilesWaitForbehavior.postCreateCommand, notpostStartCommand—postStartCommandstays deferred so a long-running/blocking start command can't hangci.upis unchanged — the override is empty forup, so its fast-attach deferral behavior is preserved.RunPreAttachHooks's parameters into aPreAttachOptionsstruct (also brings it back underrevive'sargument-limit) and uses the typedLifecyclePhaseend-to-end.Tests
Existing lifecycle-hook tests updated for the new signature; added
TestResolveWaitForFloorcovering floor semantics (raise, never lower;initializeCommandpromoted topostCreate; empty/invalid floor ignored). Builds on Linux + Windows;go vetandgolangci-lintclean.Summary by CodeRabbit
New Features
waitForphase.Refactor
Tests