Skip to content

Add Docker-backed application runtime - #335

Merged
kfiramar merged 7 commits into
integration/consolidate-open-prs-20260711from
codex/docker-application-runtime
Jul 11, 2026
Merged

kfiramar merged 7 commits into
integration/consolidate-open-prs-20260711from
codex/docker-application-runtime

Conversation

@kfiramar

@kfiramar kfiramar commented Jul 10, 2026 •

Copy link
Copy Markdown
Collaborator

What changed

  • run backend, frontend, and declarative additional app services as Docker containers with --docker
  • build from service Dockerfiles or use configured images, with cached builds, explicit command/port/workdir controls, host-gateway env projection, and container-backed state/health/logs/restart/stop behavior
  • prevent duplicate or cross-runtime container ownership loss, safely replace tracked services on --no-resume, preserve ports, and clean interrupted log followers
  • serialize each repository's complete startup lifecycle so simultaneous starts cannot orphan an older process or overwrite its state pointer
  • keep lock files on a stable inode after release, preventing a third contender from bypassing an already-waiting lock holder
  • require --yes or --force for multi-project commit --all, pr --all, ship --all, and migrate --all
  • make --entire-system stop application and dependency containers, including isolated Supabase compose stacks
  • document the Docker runtime configuration and refresh generated runtime contracts
  • prefer dev when opening PRs, falling back to main and then master when those branches do not exist

Why

--docker previously covered infrastructure dependencies but not repository-owned application services. Application startup still used host processes, and repeated/fresh starts could leave services or port leases behind.

A Pele stress test also proved that two simultaneous fresh starts could both return success, start separate backends, and leave the latest-state pointer tracking only one. Broad action targeting could similarly mutate every linked worktree without explicit confirmation. These changes close both ownership gaps.

Validation

  • Pele process-runtime E2E: normal duplicate start resumed the same run and PID; --no-resume replaced the old PID on the same port; backend health passed
  • Pele concurrent-start race, reproduced before the fix: two successful processes on ports 38300/38301 with only one tracked
  • same concurrent race after the fix: normal starts produced one run plus one resume; concurrent fresh starts serialized replacement, killed the old PID, and left exactly one tracked listener
  • Pele Docker E2E: resume retained container identity, fresh start replaced and removed the old container, backend health passed, and stop left zero managed containers
  • corrupt/truncated state failed cleanly without a traceback
  • live bulk-action safety: ship --trees --all discovered 17 projects, refused without confirmation, and all worktree HEADs remained unchanged
  • cleanup inventory: zero audit listeners and zero envctl-managed containers remained
  • complete local suite: 3,913 passed, 16 skipped, 675 subtests passed; the sole expected failure was an existing migrate --all test updated to include deliberate --yes
  • final focused validation after that contract update: 56 passed, 30 subtests passed
  • startup/action/debug regression matrix: 437 passed, 38 subtests passed
  • Ruff clean, git diff --check clean, and basedpyright reports zero errors on changed paths

@kfiramar
kfiramar marked this pull request as ready for review July 10, 2026 21:46

@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: 876dda8701

ℹ️ 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".

@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: 9ba77115db

ℹ️ 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".

Copy link
Copy Markdown
Collaborator Author

Addressed all six unresolved review findings in 7d80787:

  • image/default Docker services bypass host command resolution;
  • verified stops reject foreign or unmanaged runtime-scope containers;
  • direct resume restores preserve Docker mode from saved state;
  • native Supabase cleanup falls back to its recorded concrete container;
  • remote images are pulled before EXPOSE-based port detection;
  • PR base selection falls back to the actual origin/HEAD after dev, main, and master.

Validation: 102 focused and integration tests passed with 5 subtests, Ruff passed, git diff --check passed, targeted type-checking passed for five production modules, and all three GitHub checks passed.

Copy link
Copy Markdown
Collaborator Author

@codex review

@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: 7d807874c5

ℹ️ 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".

Copy link
Copy Markdown
Collaborator Author

Addressed all seven second-round review findings in 593e35a, plus an adjacent explicit Docker-command edge:

  • Docker-only plan/start paths now treat image/default and explicit ENVCTL_*_DOCKER_COMMAND as container-provided commands, while service/host mode still resolves host commands;
  • malformed reuse counters normalize instead of aborting resume;
  • the startup lock is released before entering the interactive dashboard;
  • full stop-all/blast-all dependency cleanup warns and purges when Docker is unavailable, while targeted cleanup remains fail-closed;
  • Docker log cursors advance even before a local snapshot exists;
  • fresh replacement honors only-backend, only-frontend, no-infra, no-deps, and additional-service selection boundaries.

Validation: 246 related tests passed with 25 subtests, 39 additional startup integration tests passed, Ruff passed, targeted type checks passed on changed production modules (apart from documented pre-existing finalization protocol errors), git diff --check passed, and all three GitHub checks passed.

Copy link
Copy Markdown
Collaborator Author

@codex review

@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: 593e35a653

ℹ️ 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".

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

Copy link
Copy Markdown
Collaborator Author

Addressed the four latest review findings in 8e3b1341:

  • failed optional Docker readiness now removes the container before degradation, retaining ownership only when removal fails so a later stop can retry;
  • Supabase dependency cleanup derives the Compose project from the DB container name and still falls back to exact native-container removal;
  • PR base detection checks local dev/main/master refs before any remote probe;
  • Docker env projection preserves generated/configured browser-facing CORS and frontend URLs while still rewriting internal DB/Redis localhost endpoints.

Validation: 29 focused tests; 110 related tests plus 5 subtests; 66 structure tests plus 72 subtests; Ruff and git diff --check; all GitHub pytest/Ruff/build checks green. The automated reviewer is currently refusing new runs due to its account review limit, so this patch was additionally inspected locally.

@kfiramar
kfiramar changed the base branch from main to integration/consolidate-open-prs-20260711 July 11, 2026 21:01
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@kfiramar
kfiramar changed the base branch from integration/consolidate-open-prs-20260711 to main July 11, 2026 21:10
@kfiramar kfiramar closed this Jul 11, 2026
@kfiramar kfiramar reopened this Jul 11, 2026

Copy link
Copy Markdown
Collaborator Author

Final consolidation reconciliation is complete in fb34adcc.

Validation: 145 conflict tests + 10 subtests; 158 action/ship tests + 24 subtests; 508 Docker/lifecycle/reuse/state tests + 59 subtests; Ruff across staged Python paths; compileall; cached diff integrity; full combined GitHub pytest/Ruff/build/shipability run 29168353557 green. The resolved tree differs from prototype v3 only in the 14 expected latest-delta files.

@kfiramar
kfiramar changed the base branch from main to integration/consolidate-open-prs-20260711 July 11, 2026 21:13
@kfiramar
kfiramar merged commit aa1e72d into integration/consolidate-open-prs-20260711 Jul 11, 2026
3 checks passed
@kfiramar
kfiramar deleted the codex/docker-application-runtime branch July 11, 2026 21:13
kfiramar added a commit that referenced this pull request Jul 12, 2026
Consolidates #335, #336, #337, and #341 after review closure, adversarial E2E validation, and final green local/GitHub gates.
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