Skip to content

fix(docker): PTY container ref-count, exec error propagation, Docker-wizard i18n#99

Merged
cnjack merged 1 commit into
mainfrom
fix/docker-pty-ref-exec-i18n
Jun 23, 2026
Merged

fix(docker): PTY container ref-count, exec error propagation, Docker-wizard i18n#99
cnjack merged 1 commit into
mainfrom
fix/docker-pty-ref-exec-i18n

Conversation

@cnjack

@cnjack cnjack commented Jun 23, 2026

Copy link
Copy Markdown
Owner

Follow-up fixes for the merged Docker-workspace PR (#97), from the CodeRabbit review cross-checked with an adversarial verification pass. Scope B: the confirmed High + Medium + i18n items; the config-lock standardization is intentionally left to its own PR.

Fixes

  • 🔴 High — terminal-killing container stop. A Docker PTY held no container reference. switch_env releasing the engine's last ref would ContainerStop a container we started while a live terminal was still attached, killing the user's shell. The PTY backend now acquires its own ref via AcquireDockerContainer for its lifetime and releases it on Close(). For a container the user already had running this takes no ref and Close() is a no-op (we still never stop the user's own container). internal/web/pty.go, internal/web/server.go.
  • 🟠 Medium — silent exec failures. DockerExecutor.run() discarded the stdcopy.StdCopy stream error and swallowed ContainerExecInspect errors (ierr == nil && …), so a broken/partial exec could be reported as success — and the edit tools (read-modify-write) could then persist truncated content. Both errors are now surfaced. internal/tools/docker_exec.go.
  • 🟡 i18n. The 8 Docker-wizard keys (container, dockerConnection, dockerDesc, selectContainer, noContainers, refresh, running, stopped) existed only in en.ts; added to zh-Hans, zh-Hant, ja, ko (parity verified across all 5 locales).

Deferred / verified non-issues

  • Deferred (own PR): config read-modify-write lock split (s.mu vs s.cfgMu) across remote/channel/MCP handlers — real, but repo-wide with deadlock-ordering care needed.
  • False positives: "input starting with { is swallowed" (user input arrives as binary frames; the JSON check only runs on resize TextMessages); docker/docker deprecation CVEs (daemon-side, this code is client-only).
  • Low / optional: threading ctx into the PTY create/attach handshake; closing parked pending remote connections on graceful shutdown.

Verification

go build ./..., go vet, go test ./internal/web ./internal/tools, vue-tsc type-check, oxlint, eslint, vite build — all green.

🤖 Generated with Claude Code

…te i18n

Follow-up fixes from the PR #96/#97 review (CodeRabbit + adversarial verification).

- HIGH: a Docker terminal held no container reference, so an env switch that
  released the engine's last ref would stop the container out from under a live
  terminal. The PTY backend now acquires its own ref via AcquireDockerContainer
  for its lifetime and releases it on Close (a no-op for a container the user
  already had running). (internal/web/pty.go, internal/web/server.go)
- MED: `docker exec` discarded the StdCopy stream error and swallowed
  ContainerExecInspect errors, so a broken/partial exec could be reported as
  success and persisted by the edit tools. Both are now surfaced.
  (internal/tools/docker_exec.go)
- i18n: the 8 Docker-wizard keys existed only in en.ts; added them to zh-Hans,
  zh-Hant, ja, ko so non-English users no longer see English fallback text.

Deferred to a separate PR: config read-modify-write lock standardization
(s.mu vs s.cfgMu). Verified as non-issues / acknowledged: the "{-input swallowed"
claim (input arrives as binary frames), the docker/docker CVEs (daemon-side,
client-only usage), pty-cancel, and the pending-conn shutdown sweep.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Jun 23, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@cnjack, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 4 minutes. Learn how PR review limits work.

Your organization has used up its prepaid credits, and credit purchases are no longer available. Enable the review add-on in the billing tab to keep reviews running — you're only billed for reviews past your plan's rate limits ($0.25/file).

⌛ How to resolve this issue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based credits.

🚦 How do rate limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan refill rate.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, the refill rate gradually slows as usage increases. The highest same-day bursts are limited more strictly.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 949cfc4f-84a7-45d5-b095-2aa6574f0256

📥 Commits

Reviewing files that changed from the base of the PR and between 20fa596 and 2d4dbb5.

📒 Files selected for processing (7)
  • internal/tools/docker_exec.go
  • internal/web/pty.go
  • internal/web/server.go
  • web/src/i18n/locales/ja.ts
  • web/src/i18n/locales/ko.ts
  • web/src/i18n/locales/zh-Hans.ts
  • web/src/i18n/locales/zh-Hant.ts
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/docker-pty-ref-exec-i18n

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@cnjack cnjack merged commit 672ac28 into main Jun 23, 2026
3 checks passed
@cnjack cnjack deleted the fix/docker-pty-ref-exec-i18n branch June 23, 2026 02:12
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