Skip to content

fix(core): parse continued Dockerfile CMD instructions - #1532

Open
GoldArowana wants to merge 2 commits into
openenv:mainfrom
GoldArowana:mac-depth-20261029-d05-openenv
Open

GoldArowana wants to merge 2 commits into
openenv:mainfrom
GoldArowana:mac-depth-20261029-d05-openenv

Conversation

@GoldArowana

@GoldArowana GoldArowana commented Oct 29, 2026 •

Copy link
Copy Markdown

Summary

Dockerfile CMD instructions continued onto another physical line currently produce a truncated server command in the shared Modal/Daytona parser. Assemble logical instructions before extracting the last CMD, including comments, CRLF, whitespace after the escape character, and a valid top-level escape directive. Preserve the existing single-line, JSON-array joining, and invalid-JSON fallback behavior.

Type of Change

  • Bug fix

Alignment Checklist

  • Read .claude/docs/PRINCIPLES.md; this change preserves the existing runtime interfaces.
  • Checked .claude/docs/INVARIANTS.md; no API, isolation, serialization, or architectural boundary changes.
  • Ran the presubmit hooks and checked the changed files. Existing whole-tree lint diagnostics and the test-hook time limit are disclosed below.

RFC Status

  • Not required: internal parser bug fix and regression tests.

Test Plan

  • The actual parser reproduction fails on current main and passes on this branch.
  • Added 23 regression/control cases for continued shell/JSON commands, comments and blank lines, escape directives, continued non-CMD instructions, and existing fallback behavior.
  • The repository test hook reached its built-in 300-second limit without a test failure. The same test selection was then run to completion with a 600-second outer limit. Special optional environments, integration, network and Docker tests remain excluded by the hook's selection.
  • Both changed files pass Ruff lint, Ruff formatting and usort.
  • The whole-tree lint hook reports the same diagnostics on the base and this branch: 47 pre-existing formatting findings and the existing import-sort findings. The only output difference is one additional correctly formatted test file.
  • Local tests use Python 3.13; upstream Python 3.11/3.12 CI remains the separate compatibility check.

Claude Code Review

N/A — prepared with Codex assistance. An independent review checked the parser behavior, baseline reproduction, compatibility controls, and the final diff.


Note

Low Risk
Internal Dockerfile text parsing only; fixes command extraction without changing public APIs or runtime interfaces.

Overview
parse_dockerfile_cmd no longer stops at the first physical line of a CMD, so multi-line Dockerfiles no longer yield truncated server commands for Daytona/runtime config.

The parser now stitches logical Dockerfile instructions using line-ending escapes (respecting an optional top-level # escape= directive), then picks the last CMD as before. Exec-form JSON joining and invalid-JSON fallback are unchanged.

Adds tests/test_core/test_server_config.py with regression cases (continuations, CRLF, comments, escape directives, and non-CMD continuations) loaded directly from the module so optional container packages are not required.

Reviewed by Cursor Bugbot for commit b57842e. Bugbot is set up for automated code reviews on this repo. Configure here.

This branch has not been deployed

No deployments
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