Skip to content

Harden devcontainer MongoDB startup to prevent transient postCreate failures#1

Closed
Copilot wants to merge 2 commits intomainfrom
copilot/fix-codespace-creation-issue
Closed

Harden devcontainer MongoDB startup to prevent transient postCreate failures#1
Copilot wants to merge 2 commits intomainfrom
copilot/fix-codespace-creation-issue

Conversation

Copy link
Copy Markdown

Copilot AI commented Mar 3, 2026

Codespace creation was failing during postCreateCommand because the MongoDB shell readiness check could return non-zero while mongod was still coming up. This made container setup brittle even when startup was otherwise successful.

  • Root cause in setup flow

    • .devcontainer/postCreate.sh invokes .devcontainer/startMongoDB.sh.
    • startMongoDB.sh treated mongosh --eval ... as mandatory and failed the whole post-create step on transient startup timing.
  • Targeted fix

    • Updated the MongoDB shell check to be non-fatal, preserving visibility while avoiding container creation failure from temporary readiness lag.
  • Behavioral impact

    • Codespace provisioning now continues when mongod is started but mongosh is not immediately ready.
    • Existing startup behavior is unchanged once MongoDB is available.
# .devcontainer/startMongoDB.sh
echo "Current databases:"
mongosh --eval "db.getMongo().getDBNames()" || echo "MongoDB shell is not ready yet; continuing setup."
Original prompt

This section details on the original issue you should resolve

<issue_title>[Bug] Codespace not creating properly</issue_title>
<issue_description>### Summary

Dev Container postcreateCommand is failing.

How to reproduce

  1. Copy Exersice
  2. Click Use Codepaces
  3. See error appear in Creation log

See below:
Image
</issue_description>

Comments on the Issue (you are @copilot in this section)

@FidelusAleksander Thanks for reporting

This should have been fixed by skills#16

If the issue persists please open another issue</comment_new>


🔒 GitHub Advanced Security automatically protects Copilot coding agent pull requests. You can protect all pull requests by enabling Advanced Security for your repositories. Learn more about Advanced Security.

Co-authored-by: FidelusAleksander <63016446+FidelusAleksander@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix Codespace not creating properly due to postcreateCommand failure Harden devcontainer MongoDB startup to prevent transient postCreate failures Mar 3, 2026
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.

[Bug] Codespace not creating properly

2 participants