fix: chat model switcher via websocket, entrypoint permissions, and docker compose fixes#657
Conversation
…ns check, and deploy config adjustments
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 7fb4f74407
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| const handleModelChange = useCallback((newModelId: string | null) => { | ||
| setOverrideModelId(newModelId); | ||
| if (!id || !newModelId || newModelId === agent?.primary_model_id) return; | ||
| if ((agent as any)?.access_level !== 'manage') return; | ||
| try { | ||
| await agentApi.update(id, { primary_model_id: newModelId }); | ||
| queryClient.invalidateQueries({ queryKey: ['agent', id] }); | ||
| } catch { | ||
| setOverrideModelId(agent?.primary_model_id || null); | ||
| } | ||
| }, [id, agent?.primary_model_id, (agent as any)?.access_level, queryClient]); | ||
| }, []); |
There was a problem hiding this comment.
Key the chat model override by session
When a user switches from one chat session to another on the same agent page, this unkeyed overrideModelId is carried over and sendChatMsg sends it as modelId, so a model selected for one session silently affects later messages in a different session. Since the picker is presented as a per-session switch, reset or store the override per activeSession.id when handling changes.
Useful? React with 👍 / 👎.
| if [ -d "${TARGET_DIR}" ]; then | ||
| CURRENT_OWNER=$(stat -c '%U:%G' "${TARGET_DIR}" 2>/dev/null || echo "") | ||
| if [ "${CURRENT_OWNER}" != "clawith:clawith" ]; then | ||
| echo "[entrypoint] Directory ${TARGET_DIR} owner is '${CURRENT_OWNER}', fixing permissions..." | ||
| chown -R clawith:clawith "${TARGET_DIR}" |
There was a problem hiding this comment.
Keep fixing child ownership, not just the parent
If the mounted agent data directory itself is already owned by clawith:clawith but any nested files or session/workspace subdirectories are still root-owned from a previous run, this new owner check skips the recursive chown and the process drops privileges before it can read/write those children. This regresses the old unconditional recursive fix for partially-owned volumes; check a representative writable child or still repair descendants when the tree is mixed.
Useful? React with 👍 / 👎.
Summary
This PR addresses minor release and deployment issues:
model_idpayload) for session-specific model overrides rather than updating the agent's primary configuration globally via PATCH API.chowninentrypoint.shto prevent performance overhead on large mounted directories.privileged: truefor the backend service.