fix(core): escape backslash in sed CRLF-stripping command in Dockerfile template#152
Conversation
Adding .gitkeep for PR creation (default mode). This file will be removed when the task is complete. Issue: ProverCoderAI#151
…erfile template The sed pattern 's/\r$//' in a TypeScript template string was being interpreted as a literal carriage return (\r), producing invalid shell syntax in the generated Dockerfile. Escaping to '\\r' ensures the generated Dockerfile contains the literal text '\r', correctly stripping Windows-style CRLF line endings from entrypoint.sh. INVARIANT: ∀ generated Dockerfile: sed pattern renders as 's/\r$//' in shell PURITY: CORE - pure template transformation, no side effects Fixes ProverCoderAI#151 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This reverts commit 856dbf3.
🤖 Solution Draft LogThis log file contains the complete execution trace of the AI solution draft process. 💰 Cost estimation:
🤖 Models used:
Now working session is ended, feel free to review and add any feedback on the solution draft. |
🔄 Auto-restart triggered (attempt 1)Reason: CI failures detected Starting new session to address the issues. Auto-restart-until-mergeable mode is active. Will continue until PR becomes mergeable. |
Pin opencode to version 1.2.27 by passing --version flag to the install script. Without a pinned version, the installer fetches the latest version from the GitHub API (api.github.com/repos/anomalyco/opencode/releases/latest), which fails with "Failed to fetch version information" when rate-limited or network-throttled during Docker builds in CI. This is the root cause of the E2E (Clone cache) CI failure. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
🔄 Auto-restart-until-mergeable Log (iteration 1)This log file contains the complete execution trace of the AI solution draft process. 💰 Cost estimation:
🤖 Models used:
Now working session is ended, feel free to review and add any feedback on the solution draft. |
🔄 Auto-restart triggered (attempt 2)Reason: Uncommitted changes detected Starting new session to address the issues. Auto-restart-until-mergeable mode is active. Will continue until PR becomes mergeable. |
🔄 Auto-restart-until-mergeable Log (iteration 2)This log file contains the complete execution trace of the AI solution draft process. 💰 Cost estimation:
🤖 Models used:
Now working session is ended, feel free to review and add any feedback on the solution draft. |
✅ Ready to mergeThis pull request is now ready to be merged:
Monitored by hive-mind with --auto-restart-until-mergeable flag |
Summary
Fixes #151
This PR contains two fixes:
Fix 1: Escape backslash in sed CRLF-stripping command in Dockerfile template
The
sedpattern in the Dockerfile template for stripping Windows-style CRLF line endings fromentrypoint.shwas broken due to a TypeScript template string escape issue.Root Cause: In
packages/lib/src/core/templates/dockerfile.ts, the template string contained\\rwhich TypeScript interprets as a carriage return character, not the two-character sequence\r. The generated Dockerfile therefore contained a literal carriage return instead of the sed pattern.Fix: Escape as
\\\\rso the generated Dockerfile outputs the literal text\r.Fix 2: Pin opencode version to avoid GitHub API rate limit failures in Docker builds
The E2E (Clone cache) CI check was failing because the opencode installer fetches the latest version from GitHub API (
api.github.com/repos/anomalyco/opencode/releases/latest), which fails with "Failed to fetch version information" when rate-limited or network-throttled during Docker builds.Root Cause: Without a pinned version, the
opencode.ai/installscript makes a GitHub API call that intermittently fails in CI Docker build environments.Fix: Pin opencode to version
1.2.27by passing--version 1.2.27to the install script, bypassing the GitHub API lookup.Mathematical Guarantees
Invariant (Fix 1)
∀ generated Dockerfile: sed pattern = 's/\r$//' ∧ strips_CRLF(entrypoint.sh)Invariant (Fix 2)
∀ Docker build: opencode_version = "1.2.27" ∧ no_network_api_call_requiredTest plan
entrypoint.shexecutes correctly on Linux with CRLF source files🤖 Generated with Claude Code