Skip to content

fix: devcontainer setup failures (Copilot home permissions + migration 0039)#518

Merged
madebygps merged 2 commits into
mainfrom
fix/devcontainer-setup-fixes
May 29, 2026
Merged

fix: devcontainer setup failures (Copilot home permissions + migration 0039)#518
madebygps merged 2 commits into
mainfrom
fix/devcontainer-setup-fixes

Conversation

@madebygps

@madebygps madebygps commented May 29, 2026

Copy link
Copy Markdown
Collaborator

Problem

Two issues were breaking fresh devcontainer builds:

  1. Copilot home directory permissions: The Docker volume copilot_home mounted at /home/vscode/.copilot was created owned by root because the directory did not exist in the image. The vscode user could not write to it, so copilot plugin commands failed, and because on-create.sh uses set -e, the entire setup aborted.

  2. Migration 0039 crash: Migration 0039 requires POSTGRES_VERIFICATION_FUNCTIONS_ROLE to be set, but this env var only exists in production (Azure). Migration 0038 handles this gracefully by returning None and skipping the grant, but 0039 was written to crash with a RuntimeError. This broke alembic upgrade head during postCreateCommand.

Fix

Copilot home (Dockerfile + on-create.sh):

  • Dockerfile now pre-creates /home/vscode/.copilot owned by vscode, so Docker copies that ownership when creating the named volume.
  • on-create.sh plugin install steps now warn and continue instead of aborting the entire setup.

Migration 0039:

  • Changed to match 0038's pattern: return None and skip the grant when the env var is not set. Production already ran this migration (it is stamped as applied and will never execute again). Only fresh dev databases are affected.

How to verify

Rebuild the devcontainer from scratch. All migrations should run to completion and the setup should finish without errors.

Note: If you have an existing copilot_home volume owned by root, you need to delete it once so a correctly owned one is recreated.

madebygps and others added 2 commits May 29, 2026 23:15
The devcontainer setup (onCreateCommand) was failing on a fresh machine.
The cause was a Docker volume ownership problem, not architecture or login.

docker-compose.yml mounts a named volume (copilot_home) at
/home/vscode/.copilot so the Copilot CLI login and plugins survive
container rebuilds. The Dockerfile never created that directory, so when
Docker first created the volume it made it owned by root. The vscode user
could not write to it, so the very first "copilot plugin ..." command in
on-create.sh failed silently with exit code 1. Because the script uses
"set -e", that one silent failure aborted the entire devcontainer setup,
so Python environments, Playwright, and other tooling never installed.

Two changes:

1. Dockerfile now pre-creates /home/vscode/.copilot owned by the vscode
   user. Docker copies that ownership when it first creates the named
   volume, so the vscode user can write to it. Verified by building the
   image and mounting a fresh volume: the directory is owned by vscode
   and is writable.

2. on-create.sh no longer lets a Copilot plugin hiccup take down the
   whole setup. The marketplace and plugin steps now warn and continue
   instead of aborting, matching how the Firecrawl step already behaves.

Note: anyone who already has the old root-owned copilot_home volume must
delete that volume once so a correctly owned one is recreated. A plain
container rebuild reuses the existing volume and will not fix it.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…ar is unset

Migration 0038 treats POSTGRES_VERIFICATION_FUNCTIONS_ROLE as optional
and skips the grant when unset. Migration 0039 does the same grant but
was written to crash if the env var is missing. This breaks fresh
devcontainer setups where the role does not exist.

Changed 0039 to match 0038: return None and skip when the env var is
not set. Production already ran this migration so it will never execute
there again. Only fresh dev databases are affected.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@madebygps madebygps changed the title Fix/devcontainer setup fixes fix: devcontainer setup failures (Copilot home permissions + migration 0039) May 29, 2026
@madebygps madebygps merged commit 7840fdc into main May 29, 2026
15 checks passed
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