[PR #1021] [MERGED] Fix Claude Subscription Docker HOME handling #4889

Closed
opened 2026-10-22 04:11:28 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/1021
Author: @cha1latte
Created: 5/19/2026
Status: ✅ Merged
Merged: 5/19/2026
Merged by: @cha1latte

Base: staging ← Head: fix/issue-1020-claude-docker-home


📝 Commits (2)

  • 7ae9137 Fix Claude subscription Docker HOME handling
  • c25f3cb Add Claude Docker HOME proof

📊 Changes

8 files changed (+116 additions, -1 deletions)

View changed files

📝 docker-compose.yml (+0 -1)
📝 docs/TROUBLESHOOTING.md (+5 -0)
➕ docs/pr-evidence/issue-1020/README.md (+7 -0)
➕ docs/pr-evidence/issue-1020/docker-home.txt (+10 -0)
➕ docs/pr-evidence/issue-1020/repro-after.json (+34 -0)
➕ docs/pr-evidence/issue-1020/repro-before.json (+19 -0)
📝 packages/server/src/services/llm/providers/claude-subscription.provider.ts (+22 -0)
📝 scripts/docker-entrypoint.mjs (+19 -0)

📄 Description

Linked issue

Closes #1020

Why this change

  • Docker compose preserved HOME=/app while the entrypoint dropped the server to the node user, so claude login and the server-side Claude Agent SDK could look in different credential directories.
  • When the Claude Agent SDK completed successfully but produced no usable text, the provider yielded nothing and the route showed a generic empty-response message with no actionable upstream diagnostic.

What changed

  • Removes the compose-level HOME=/app override and resets HOME to the dropped runtime user's passwd home inside the Docker entrypoint.
  • Throws a specific Claude Subscription provider error when the SDK completes without any emitted text, including model, token, fast-mode, billed-model, and HOME diagnostics in the server log/error path.
  • Adds Docker/Claude Subscription troubleshooting guidance and committed repro evidence for the before/after behavior.

Validation

  • pnpm check passes locally
  • Container (Docker / Podman) built and ran without issue
  • Ran the app, clicked through the changes manually
  • Checked edge cases (light + dark mode, mobile viewport, empty states, error paths)
  • Above manual verification completed (describe below)
  • Read and followed CONTRIBUTING.md

Manual verification notes

Docs and release impact

  • No docs changes needed
  • Updated docs (README / CONTRIBUTING / android/README / CHANGELOG) as needed
  • Version/release files updated (only if this PR includes a version bump)

UI evidence (if applicable)

N/A - backend/container behavior only.

Summary by CodeRabbit

  • Documentation

    • Added Docker troubleshooting guidance for authentication issues, including instructions to re-authenticate inside containers.
  • Bug Fixes

    • Improved error messaging and diagnostics when encountering empty API responses in containerized environments.
    • Enhanced Docker container environment handling to properly resolve credentials and home directories.

Review Change Stack


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/Pasta-Devs/Marinara-Engine/pull/1021 **Author:** [@cha1latte](https://github.com/cha1latte) **Created:** 5/19/2026 **Status:** ✅ Merged **Merged:** 5/19/2026 **Merged by:** [@cha1latte](https://github.com/cha1latte) **Base:** `staging` ← **Head:** `fix/issue-1020-claude-docker-home` --- ### 📝 Commits (2) - [`7ae9137`](https://github.com/Pasta-Devs/Marinara-Engine/commit/7ae91371e09d51c2abec665f86bb9be40ea41c51) Fix Claude subscription Docker HOME handling - [`c25f3cb`](https://github.com/Pasta-Devs/Marinara-Engine/commit/c25f3cba06b0170e2042fdb6dd6e5472cd6de5f4) Add Claude Docker HOME proof ### 📊 Changes **8 files changed** (+116 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `docker-compose.yml` (+0 -1) 📝 `docs/TROUBLESHOOTING.md` (+5 -0) ➕ `docs/pr-evidence/issue-1020/README.md` (+7 -0) ➕ `docs/pr-evidence/issue-1020/docker-home.txt` (+10 -0) ➕ `docs/pr-evidence/issue-1020/repro-after.json` (+34 -0) ➕ `docs/pr-evidence/issue-1020/repro-before.json` (+19 -0) 📝 `packages/server/src/services/llm/providers/claude-subscription.provider.ts` (+22 -0) 📝 `scripts/docker-entrypoint.mjs` (+19 -0) </details> ### 📄 Description <!-- Target branch: `staging`. The default base in this UI is `main` (release branch). --> <!-- Change the base to `staging` before submitting unless this is a maintainer-approved mainline change. --> <!-- See CONTRIBUTING.md § Branches. --> ## Linked issue <!-- Every PR should reference a feature request or issue report. If there isn't one yet, open one first to gather opinions: --> <!-- https://github.com/Pasta-Devs/Marinara-Engine/issues/new/choose --> Closes #1020 ## Why this change <!-- What user problem, bug, or goal does this solve? --> - Docker compose preserved `HOME=/app` while the entrypoint dropped the server to the `node` user, so `claude login` and the server-side Claude Agent SDK could look in different credential directories. - When the Claude Agent SDK completed successfully but produced no usable text, the provider yielded nothing and the route showed a generic empty-response message with no actionable upstream diagnostic. ## What changed <!-- List the key changes in this PR --> - Removes the compose-level `HOME=/app` override and resets `HOME` to the dropped runtime user's passwd home inside the Docker entrypoint. - Throws a specific Claude Subscription provider error when the SDK completes without any emitted text, including model, token, fast-mode, billed-model, and HOME diagnostics in the server log/error path. - Adds Docker/Claude Subscription troubleshooting guidance and committed repro evidence for the before/after behavior. ## Validation <!-- Required: include commands run and/or manual checks performed --> - [ ] `pnpm check` passes locally - [ ] Container (Docker / Podman) built and ran without issue - [ ] Ran the app, clicked through the changes manually - [ ] Checked edge cases (light + dark mode, mobile viewport, empty states, error paths) - [ ] Above manual verification completed (describe below) - [ ] Read and followed `CONTRIBUTING.md` ### Manual verification notes <!-- Describe exactly what you tested in a real browser/app, step by step. --> <!-- ⚠️ If an AI agent filled out or ticked these boxes for you, treat them --> <!-- as a TO-DO LIST, not as proof the work is done. Verify each item yourself --> <!-- before submitting. If you haven't verified it, untick the box. --> - Codex verification: `pnpm --filter @marinara-engine/server exec tsx C:\tmp\Marinara-Engine-issue-1020\scratch\issue-1020-repro.ts scratch\issue-1020-before.json` reproduced the pre-fix failure. - Codex verification: `pnpm --filter @marinara-engine/server exec tsx C:\tmp\Marinara-Engine-issue-1020\scratch\issue-1020-repro.ts scratch\issue-1020-after.json` passed after the fix, including edge cases for final `result` fallback, non-streaming assistant text, and SDK error-result propagation. - Codex verification: `docker run --rm -v C:\tmp\Marinara-Engine-issue-1020:/app -w /app -e HOME=/app node:24-slim node scripts/docker-entrypoint.mjs node -e "console.log(JSON.stringify({uid:process.getuid?.(),home:process.env.HOME}))"` printed `{"uid":1000,"home":"/home/node"}`. - Codex verification: `pnpm check` passed. - Evidence: before repro output at https://raw.githubusercontent.com/cha1latte/Marinara-Engine/c25f3cba06b0170e2042fdb6dd6e5472cd6de5f4/docs/pr-evidence/issue-1020/repro-before.json - Evidence: after repro output at https://raw.githubusercontent.com/cha1latte/Marinara-Engine/c25f3cba06b0170e2042fdb6dd6e5472cd6de5f4/docs/pr-evidence/issue-1020/repro-after.json - Evidence: Docker HOME proof at https://raw.githubusercontent.com/cha1latte/Marinara-Engine/c25f3cba06b0170e2042fdb6dd6e5472cd6de5f4/docs/pr-evidence/issue-1020/docker-home.txt - Limitation: I did not run a live Claude OAuth chat inside Docker because this environment does not have a Claude subscription session. The container HOME path and provider empty-stream behavior are covered by machine proof above. ## Docs and release impact - [ ] No docs changes needed - [x] Updated docs (README / CONTRIBUTING / android/README / CHANGELOG) as needed - [ ] Version/release files updated (only if this PR includes a version bump) ## UI evidence (if applicable) N/A - backend/container behavior only. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Documentation** * Added Docker troubleshooting guidance for authentication issues, including instructions to re-authenticate inside containers. * **Bug Fixes** * Improved error messaging and diagnostics when encountering empty API responses in containerized environments. * Enhanced Docker container environment handling to properly resolve credentials and home directories. <!-- review_stack_entry_start --> [![Review Change Stack](https://storage.googleapis.com/coderabbit_public_assets/review-stack-in-coderabbit-ui.svg)](https://app.coderabbit.ai/change-stack/Pasta-Devs/Marinara-Engine/pull/1021?utm_source=github_walkthrough&utm_medium=github&utm_campaign=change_stack) <!-- review_stack_entry_end --> <!-- end of auto-generated comment: release notes by coderabbit.ai --> --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-22 04:11:28 +07:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Pasta-Devs/Marinara-Engine#4889
No description provided.