feat: merge chat container into edge — run chat server inside edge container with full permissions (reverts sandbox from #706) #1083
Labels
No labels
action
backlog
blocked
bug-report
cannot-reproduce
in-progress
in-triage
needs-triage
prediction/actioned
prediction/dismissed
prediction/unreviewed
priority
rejected
reproduced
tech-debt
underspecified
vision
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: disinto-admin/disinto#1083
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Goal
Merge the
chatcontainer into theedgecontainer. Run the chat Python server as a background process insidedisinto-edgealongside Caddy. Reverts the sandboxing in #706.Rationale (from operator): chat needs broad access to project files, ops repo, and docker socket anyway to be useful for "drive the factory from a chat window" — which is the #623 vision. The sandbox isolation adds operational complexity (separate container, separate lifecycle, shared-secret forward_auth) without preventing the actual blast radius. Move it inside edge and give it the same permissions as edge's existing supervisor-run + collect-engagement processes.
The change
Remove
docker-compose.yml— delete thechat:service block (currently lines 384-430) and thechat-confignamed volumedocker/chat/entrypoint-chat.sh— delete (sandbox sanity checks no longer apply)docker/chat/Dockerfile— delete (chat is no longer a standalone image)Move into edge
docker/chat/server.py→ keep in place; copy into edge image instead of chat imagedocker/chat/ui/→ keep in place; copy into edge imagedocker/edge/Dockerfile— add:nodejs/npmvia aptnpm install -g @anthropic-ai/claude-code@2.1.84COPY docker/chat/server.py /usr/local/bin/chat-server.pyCOPY docker/chat/ui/ /var/chat/ui/docker/edge/entrypoint-edge.sh— launch server as a background process beforecaddy run, same pattern as the existingcollect-engagementloop: Caddy must stay the foreground process (its exit triggers container restart).Caddyfile update
lib/generators.shemitshandle /chat/*blocks — change the reverse_proxy target fromchat:8080to127.0.0.1:8080. Same for/chat/loginand/chat/oauth/callbackhandles.forward_auth chat:8080in the/chat/*block →forward_auth 127.0.0.1:8080. Keep theFORWARD_AUTH_SECRETheader (still useful for intra-container path isolation).Environment
Edge inherits chat's env vars. Move these from the deleted
chat:service into theedge:service:CHAT_OAUTH_CLIENT_ID,CHAT_OAUTH_CLIENT_SECRETDISINTO_CHAT_ALLOWED_USERSFORWARD_AUTH_SECRET(already on edge — verify)CHAT_HOST,CHAT_PORT(default127.0.0.1:8080— NOT0.0.0.0anymore, since edge is the only consumer)CHAT_HISTORY_DIR— bind mount moves to edge service as well:${CHAT_HISTORY_DIR:-./state/chat-history}:/var/lib/chat/historyAcceptance criteria
docker compose up -dstands up the stack with nochatcontainer;docker psshows 1 fewer container than beforedocker exec disinto-edge ps -efshows the python3 chat server process running alongside Caddycurl -sI http://localhost/chat/still returns 401 (forward_auth) when no session cookie is presentCHAT_OAUTH_CLIENT_ID/SECRETand a Forgejo login,/chat/serves index.html; POST/chatcan spawn Claudedocker compose restart edge(viaCHAT_HISTORY_DIRbind mount on edge)tests/smoke-edge-subpath.shpasses for all/chat/*assertions (login/callback/forward_auth 401 on root)docker/chat/Dockerfileanddocker/chat/entrypoint-chat.shdeleted from the treeshellcheckclean onentrypoint-edge.shafter changesSide effects to handle
server.py_validate_session etc). An edge container restart invalidates all sessions. Previously users would log in again after a chat restart; now they log in again after any edge restart (which is more frequent due to Caddy config reloads). Consider moving sessions to disk if this becomes annoying, but not required for this issue.#1027(Claude workspace scope) — mostly obsolete since edge already has/opt/disintomounted. Close #1027 after this lands, or re-scope it narrowly to "set Claude cwd to the project staging checkout" (~10 lines inhandle_chat).Related