Skip to content

fix(app): confirm before applying project from terminal#256

Open
konard wants to merge 4 commits intoProverCoderAI:mainfrom
konard:issue-255-0f74bc3da840
Open

fix(app): confirm before applying project from terminal#256
konard wants to merge 4 commits intoProverCoderAI:mainfrom
konard:issue-255-0f74bc3da840

Conversation

@konard
Copy link
Copy Markdown
Contributor

@konard konard commented May 9, 2026

Summary

Pressing Apply on the terminal screen used to silently restart the project container, which terminated active SSH sessions and the in-container browser (MCP Playwright). The user reported that their browser connection broke immediately after they pressed Apply, with no chance to cancel.

This PR adds a confirmation prompt to applyProjectById, mirroring the pattern already used by Down, Delete, Down All, and Apply All. The message names the project and explicitly states that the action ends active SSH sessions and in-container browsers, so the user can knowingly opt in or back out.

Fixes #255

Root cause

applyProjectById in packages/app/src/web/actions-projects.ts immediately invoked applyProject(projectId) without any guard. Apply runs docker compose up --force-recreate, which tears down the running container along with every process inside it (sshd, the MCP Playwright browser, etc.). Other destructive actions (runDownProject, runDeleteProject, runDownAllProjects, runApplyAllProjects) already gate themselves behind confirmAction; Apply was the outlier.

Fix

packages/app/src/web/actions-projects.ts

  • Added applyProjectConfirmMessage(label) that renders: Apply docker-git config to <label>? This restarts the container and ends active SSH sessions and in-container browsers.
  • applyProjectById now resolves the project label (using projectActionLabel when the action targets the currently-selected project, otherwise the project id) and short-circuits if confirmAction(...) returns false. The rest of the flow is unchanged.

Tests

packages/app/tests/docker-git/actions-projects.test.ts

  • Updated the existing happy-path test to stub globalThis.confirm returning true and assert the dialog was shown with the new message.
  • Added a new test that asserts no state is mutated and the API is not called when the user declines (confirm returns false).
Test Files  1 passed (1)
Tests       5 passed (5)

Full suite: vitest run in packages/app reports 249 passing tests; tsc --noEmit passes.

Test plan

  • bunx vitest run tests/docker-git/actions-projects.test.ts (5 passed)
  • bun run typecheck
  • Manual reasoning: Apply All, Down, Down All, Delete, and Apply now all share the same confirmation pattern; only Apply was missing it.

konard added 2 commits May 9, 2026 06:39
Adding .gitkeep for PR creation (default mode).
This file will be removed when the task is complete.

Issue: ProverCoderAI#255
Apply restarts the container, which kills active SSH sessions and any
in-container browser (e.g. MCP Playwright). The Apply button on the
terminal screen used to trigger this restart with no warning, leaving
users surprised when their browser connection dropped.

Match the confirmation pattern already used by Down, Delete, Down All,
and Apply All: prompt the user with a message that names the project
and explicitly calls out that SSH sessions and in-container browsers
will end. If the user declines, no state is changed.

Fixes ProverCoderAI#255
@konard konard changed the title [WIP] Почему после нажатия на кнопку "apply" у меня легла связка с MCP Playright. Я больше не могу открыть браузер fix(app): confirm before applying project from terminal May 9, 2026
@konard konard marked this pull request as ready for review May 9, 2026 07:00
@konard
Copy link
Copy Markdown
Contributor Author

konard commented May 9, 2026

Working session summary

CI is running in the background. PR #256 is updated, marked ready, and the fix is in: #256

Summary of what shipped:

  • Source fix (packages/app/src/web/actions-projects.ts): applyProjectById now calls confirmAction with a message that warns the action restarts the container and ends active SSH sessions and in-container browsers — matching the pattern used by Down/Delete/Down All/Apply All.
  • Tests (packages/app/tests/docker-git/actions-projects.test.ts): existing happy-path test asserts the prompt is shown; new test verifies declining the prompt prevents any state mutation.
  • PR: title and body updated, marked ready for review; CI is watching in the background.

This summary was automatically extracted from the AI working session output.

@konard
Copy link
Copy Markdown
Contributor Author

konard commented May 9, 2026

🤖 Solution Draft Log

This log file contains the complete execution trace of the AI solution draft process.

💰 Cost: $7.966522

📊 Context and tokens usage:

Claude Opus 4.7: (3 sub-sessions)

  1. 116.6K / 1M (12%) input tokens, 7.9K / 128K (6%) output tokens
  2. 113.7K / 1M (11%) input tokens, 17.6K / 128K (14%) output tokens
  3. 46.0K / 1M (5%) input tokens, 3.9K / 128K (3%) output tokens

Total: (24.1K new + 269.8K cache writes + 10.3M cache reads) input tokens, 39.9K output tokens, $7.966522 cost

🤖 Models used:

  • Tool: Anthropic Claude Code
  • Requested: opus
  • Model: Claude Opus 4.7 (claude-opus-4-7)

📎 Log file uploaded as Gist (3591KB)


Now working session is ended, feel free to review and add any feedback on the solution draft.

@konard
Copy link
Copy Markdown
Contributor Author

konard commented May 9, 2026

🔄 Auto-restart 1/5

Detected uncommitted changes from previous run. Starting new session to review and commit or discard them.

Uncommitted files:

?? issue-images/

Auto-restart will stop after changes are committed or discarded, or after 4 more iterations. Please wait until working session will end and give your feedback.

@konard
Copy link
Copy Markdown
Contributor Author

konard commented May 9, 2026

Working session summary

Cleaned up the leftover issue-images/ research artifact. Working tree is clean, PR #256 is mergeable, and all CI checks have passed except one E2E job still in progress.

PR: #256


This summary was automatically extracted from the AI working session output.

@konard
Copy link
Copy Markdown
Contributor Author

konard commented May 9, 2026

🔄 Auto-restart 1/5 Log

This log file contains the complete execution trace of the AI solution draft process.

💰 Cost: $0.304874

📊 Context and tokens usage:

  • 35.3K / 1M (4%) input tokens, 1.3K / 128K (1%) output tokens

Total: (21 new + 29.2K cache writes + 178.8K cache reads) input tokens, 1.3K output tokens, $0.304874 cost

🤖 Models used:

  • Tool: Anthropic Claude Code
  • Requested: opus
  • Model: Claude Opus 4.7 (claude-opus-4-7)

📎 Log file uploaded as Gist (4013KB)


Now working session is ended, feel free to review and add any feedback on the solution draft.

@konard
Copy link
Copy Markdown
Contributor Author

konard commented May 9, 2026

CI status: 14 of 15 checks passed. The one failure — E2E (Local package CLI) — is an infrastructure flake in the Install dependencies step, not related to this change.

apt-get update against azure.archive.ubuntu.com/ubuntu hung for ~14 minutes before the job hit its 15-minute timeout. Last successful download (line 325) at 07:01:42; cancellation (line 326) at 07:15:52. Other E2E jobs in the same workflow (Browser, Clone auto-open SSH, Clone cache, Login context, OpenCode, Runtime volumes + SSH) all passed using the same setup.

Could a maintainer re-run the failed job? I lack rerun permission on this repo.

Job log: https://github.com/ProverCoderAI/docker-git/actions/runs/25594786549/job/75138761442

@konard
Copy link
Copy Markdown
Contributor Author

konard commented May 9, 2026

🔄 Auto-restart triggered (iteration 1)

Reason: Uncommitted changes detected

Starting new session to address the issues.


Auto-restart-until-mergeable mode is active. This run will stop after 5 restart iterations.

@konard
Copy link
Copy Markdown
Contributor Author

konard commented May 9, 2026

Working session summary

Done. Summary of this session:

  • Discarded the leftover ci-logs/ research artifact (a job log saved while diagnosing the unrelated apt-mirror flake on the previous run; not part of the fix).
  • Merged upstream/main (4 new commits, including PR fix(web): preserve local terminal image previews #253 which also touched actions-projects.ts and the test file). Auto-merge resolved cleanly; my applyProjectConfirmMessage function and both tests survived intact.
  • Verified locally: bunx vitest run tests/docker-git/actions-projects.test.ts → 5/5 passing.
  • Pushed merge commit bc61080 to issue-255-0f74bc3da840. CI is now re-running on a current base; PR fix(app): confirm before applying project from terminal #256 is MERGEABLE, marked ready.

The fix itself is unchanged: applyProjectById now gates on confirmAction("Apply docker-git config to <label>? This restarts the container and ends active SSH sessions and in-container browsers."), matching the pattern already used by Down / Delete / DownAll / ApplyAll. PR: #256


This summary was automatically extracted from the AI working session output.

@konard
Copy link
Copy Markdown
Contributor Author

konard commented May 9, 2026

🔄 Auto-restart-until-mergeable Log (iteration 1)

This log file contains the complete execution trace of the AI solution draft process.

💰 Cost: $0.941975

📊 Context and tokens usage:

  • 69.6K / 1M (7%) input tokens, 5.4K / 128K (4%) output tokens

Total: (25 new + 63.2K cache writes + 826.1K cache reads) input tokens, 5.4K output tokens, $0.941975 cost

🤖 Models used:

  • Tool: Anthropic Claude Code
  • Requested: opus
  • Model: Claude Opus 4.7 (claude-opus-4-7)

📎 Log file uploaded as Gist (4668KB)


Now working session is ended, feel free to review and add any feedback on the solution draft.

@konard
Copy link
Copy Markdown
Contributor Author

konard commented May 9, 2026

✅ Ready to merge

This pull request is now ready to be merged:

  • All CI checks have passed
  • No merge conflicts
  • No pending changes

Monitored by hive-mind with --auto-restart-until-mergeable flag

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant