Skip to content

fix(core): escape backslash in sed CRLF-stripping command in Dockerfile template#152

Merged
skulidropek merged 4 commits intoProverCoderAI:mainfrom
konard:issue-151-fdbc80a12746
Mar 17, 2026
Merged

fix(core): escape backslash in sed CRLF-stripping command in Dockerfile template#152
skulidropek merged 4 commits intoProverCoderAI:mainfrom
konard:issue-151-fdbc80a12746

Conversation

@konard
Copy link
Copy Markdown
Contributor

@konard konard commented Mar 17, 2026

Summary

Fixes #151

This PR contains two fixes:

Fix 1: Escape backslash in sed CRLF-stripping command in Dockerfile template

The sed pattern in the Dockerfile template for stripping Windows-style CRLF line endings from entrypoint.sh was broken due to a TypeScript template string escape issue.

Root Cause: In packages/lib/src/core/templates/dockerfile.ts, the template string contained \\r which 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 \\\\r so 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/install script makes a GitHub API call that intermittently fails in CI Docker build environments.

Fix: Pin opencode to version 1.2.27 by passing --version 1.2.27 to 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_required

Test plan

  • Lint passes with 0 errors
  • E2E (Clone cache) CI check passes with pinned version
  • Build a Docker image and verify entrypoint.sh executes correctly on Linux with CRLF source files

🤖 Generated with Claude Code

konard and others added 2 commits March 17, 2026 18:10
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>
@konard konard changed the title [WIP] Добавить такой фикс fix(core): escape backslash in sed CRLF-stripping command in Dockerfile template Mar 17, 2026
@konard konard marked this pull request as ready for review March 17, 2026 18:11
@konard
Copy link
Copy Markdown
Contributor Author

konard commented Mar 17, 2026

🤖 Solution Draft Log

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

💰 Cost estimation:

  • Public pricing estimate: $0.263229
  • Calculated by Anthropic: $0.243977 USD
  • Difference: $-0.019252 (-7.31%)

🤖 Models used:

  • Tool: Claude
  • Requested: sonnet
  • Main model: Claude Sonnet 4.6 (ID: claude-sonnet-4-6, Anthropic, cutoff: 2025-08)
    📎 Log file uploaded as Gist (251KB)
    🔗 View complete solution draft log

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 Mar 17, 2026

🔄 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>
@konard
Copy link
Copy Markdown
Contributor Author

konard commented Mar 17, 2026

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

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

💰 Cost estimation:

  • Public pricing estimate: $1.146723
  • Calculated by Anthropic: $0.916129 USD
  • Difference: $-0.230594 (-20.11%)

🤖 Models used:

  • Tool: Claude
  • Requested: sonnet
  • Main model: Claude Sonnet 4.6 (ID: claude-sonnet-4-6, Anthropic, cutoff: 2025-08)
    📎 Log file uploaded as Gist (1018KB)
    🔗 View complete solution draft log

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 Mar 17, 2026

🔄 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.

@konard
Copy link
Copy Markdown
Contributor Author

konard commented Mar 17, 2026

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

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

💰 Cost estimation:

  • Public pricing estimate: $0.283831
  • Calculated by Anthropic: $0.151817 USD
  • Difference: $-0.132014 (-46.51%)

🤖 Models used:

  • Tool: Claude
  • Requested: sonnet
  • Main model: Claude Sonnet 4.6 (ID: claude-sonnet-4-6, Anthropic, cutoff: 2025-08)
    📎 Log file uploaded as Gist (1219KB)
    🔗 View complete solution draft log

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 Mar 17, 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

@skulidropek skulidropek merged commit 550caed into ProverCoderAI:main Mar 17, 2026
12 checks passed
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.

Добавить такой фикс

2 participants