Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions backend/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,17 @@ role_contains() {

# --- Permission fixing and privilege dropping ---
if [ "$(id -u)" = '0' ]; then
echo "[entrypoint] Detected root user, fixing permissions..."
chown -R clawith:clawith ${AGENT_DATA_DIR}
echo "[entrypoint] Detected root user, checking permissions..."
TARGET_DIR="${AGENT_DATA_DIR:-/data/agents}"
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}"
Comment on lines +21 to +25

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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 👍 / 👎.

else
echo "[entrypoint] Directory ${TARGET_DIR} is already owned by clawith:clawith, skipping chown."
fi
fi

echo "[entrypoint] Dropping privileges to 'clawith' and re-executing..."
exec gosu clawith /bin/bash "$0" "$@"
Expand Down
7 changes: 3 additions & 4 deletions deploy/docker-compose-multi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ services:

backend-api:
build:
context: ./backend
context: ../backend
args:
CLAWITH_PIP_INDEX_URL: ${CLAWITH_PIP_INDEX_URL:-}
CLAWITH_PIP_TRUSTED_HOST: ${CLAWITH_PIP_TRUSTED_HOST:-}
Expand Down Expand Up @@ -79,10 +79,10 @@ services:
PUBLIC_BASE_URL: ${PUBLIC_BASE_URL:-}
PASSWORD_RESET_TOKEN_EXPIRE_MINUTES: ${PASSWORD_RESET_TOKEN_EXPIRE_MINUTES:-30}
volumes:
- ./backend:/app
- ./backend/agent_data:/data/agents
- /var/run/docker.sock:/var/run/docker.sock
- ./ss-nodes.json:/data/ss-nodes.json:ro
privileged: true
cap_add:
- SYS_ADMIN
security_opt:
Expand All @@ -106,7 +106,7 @@ services:

backend-trigger:
build:
context: ./backend
context: ../backend
args:
CLAWITH_PIP_INDEX_URL: ${CLAWITH_PIP_INDEX_URL:-}
CLAWITH_PIP_TRUSTED_HOST: ${CLAWITH_PIP_TRUSTED_HOST:-}
Expand Down Expand Up @@ -137,7 +137,6 @@ services:
PUBLIC_BASE_URL: ${PUBLIC_BASE_URL:-}
PASSWORD_RESET_TOKEN_EXPIRE_MINUTES: ${PASSWORD_RESET_TOKEN_EXPIRE_MINUTES:-30}
volumes:
- ./backend:/app
- ./backend/agent_data:/data/agents
- /var/run/docker.sock:/var/run/docker.sock
- ./ss-nodes.json:/data/ss-nodes.json:ro
Expand Down
6 changes: 3 additions & 3 deletions deploy/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ services:

backend:
build:
context: ./backend
context: ../backend
args:
CLAWITH_PIP_INDEX_URL: ${CLAWITH_PIP_INDEX_URL:-}
CLAWITH_PIP_TRUSTED_HOST: ${CLAWITH_PIP_TRUSTED_HOST:-}
Expand Down Expand Up @@ -59,10 +59,10 @@ services:
# Password reset token lifetime in minutes (default: 30)
PASSWORD_RESET_TOKEN_EXPIRE_MINUTES: ${PASSWORD_RESET_TOKEN_EXPIRE_MINUTES:-30}
volumes:
- ./backend:/app
- ./backend/agent_data:/data/agents
- /var/run/docker.sock:/var/run/docker.sock
- ./ss-nodes.json:/data/ss-nodes.json:ro
privileged: true
cap_add:
- SYS_ADMIN
security_opt:
Expand All @@ -80,7 +80,7 @@ services:
max-size: "10m"
max-file: "3"
frontend:
build: ./frontend
build: ../frontend
restart: unless-stopped
ports:
- "${FRONTEND_PORT:-3008}:3000"
Expand Down
12 changes: 2 additions & 10 deletions frontend/src/pages/agent-detail/AgentDetailPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2005,17 +2005,9 @@ export default function AgentDetailPage() {
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [agent?.primary_model_id]);

const handleModelChange = useCallback(async (newModelId: string | null) => {
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]);
}, []);
Comment on lines +2008 to +2010

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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 👍 / 👎.


// Track onboarding kickoff per (agent, session) so the agent only greets
// once per session. The agent opens the conversation itself — no visible
Expand Down