Skip to content

feat: surface critical dockerd and sysbox output in startup logs - #182

Draft
robo-coderai wants to merge 4 commits into
mainfrom
robo/core-423-surface-critical-dockerdsysbox-child
Draft

robo-coderai wants to merge 4 commits into
mainfrom
robo/core-423-surface-critical-dockerdsysbox-child

Conversation

@robo-coderai

@robo-coderai robo-coderai commented Nov 25, 2026 •

Copy link
Copy Markdown

When dockerd or sysbox fails at startup, the cause is only written to the envbox container's logs. In a recent incident dockerd exited with failed to start daemon: ... mkdir /var/lib/docker/100000.100000/tmp: no space left on device, but the workspace startup logs only showed Failed to create Container-based Virtual Machine: kill cmd: kill proc: os: process already finished, so the cause was only visible through kubectl logs.

Child process output that matches a short list of actionable failures is now logged at error level and sent to the workspace startup logs, prefixed with the process name. The list covers no space left on device, dockerd's failed to start daemon, sysbox-mgr and sysbox-fs startup failures, and level=fatal. Other child output still only goes to the container's logs.

  • Forwarding runs on its own goroutine, so a slow Coder connection never blocks the child's output.
  • Each process run forwards a line at most once and at most 10 lines.
  • A process exit is not reported until its matched lines are sent (bounded at 5s), so the cause appears before envbox's own failure message.

The misleading kill proc: os: process already finished message comes from a separate bug: Restart fails on a dockerd that has already exited, so the vfs fallback never runs. That fix will be a follow-up PR.

Testing: unit tests in background/process_test.go use real sh processes. A new integration test, TestDocker/CriticalOutputInStartupLogs, gives dockerd a 64 KiB tmpfs data root and checks that the no space left on device line reaches a fake Coder before the failure message. It uses a new CreateDockerCVMConfig.OuterTmpfs option, because dockertest's TempfsOptions serializes under the wrong JSON key and Docker ignores its size limit.

Note

The CI integration job never sets CODER_TEST_INTEGRATION, so TestDocker skips in CI today. This branch enabled it temporarily and the full integration suite passed (run), then reverted it. Enabling it permanently is probably worth a separate PR. The OSV Image Scanner failure is unrelated: the scanner errors with unknown field "source" and fails on main too.

Refs:
https://linear.app/codercom/issue/CORE-423

🤖 Generated with Claude Code

robo-coderai and others added 2 commits November 24, 2026 19:27
dockerd and sysbox failures were only written to the envbox container's
logs. For example, when dockerd ran out of disk at startup, the workspace
startup logs only showed a later, misleading error.

Child process lines that match a short list of actionable failures (no
space left on device, dockerd and sysbox startup failures, logrus fatal)
are now logged at error level and forwarded to the workspace startup
logs. Forwarding runs off the output path so it never blocks the child,
is deduplicated and capped per process run, and completes before the
process exit is reported so the cause appears before envbox's own
failure message.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Temporary commit so CI exercises the new integration test. The job never
sets CODER_TEST_INTEGRATION, so TestDocker and TestDocker_Nvidia skip.
Drop before marking the PR ready.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@linear-code

linear-code Bot commented Nov 25, 2026

Copy link
Copy Markdown

CORE-423

robo-coderai and others added 2 commits November 25, 2026 19:43
…artupLogs

docker.TempfsOptions serializes as "TempfsOptions", but the Docker API
expects "TmpfsOptions", so the 64 KiB limit was dropped and dockerd
started normally. Add CreateDockerCVMConfig.OuterTmpfs, which sets
HostConfig.Tmpfs, and use it for /var/lib/docker.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
CI passed with TestDocker enabled (run 45687984937), so the temporary
change is no longer needed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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