Skip to content

Commit e6571df

Browse files
fix: enhance session validation logic in start script to ensure user messages are prioritized over warmup messages
1 parent 6a927f2 commit e6571df

File tree

1 file changed

+8
-2
lines changed
  • registry/coder/modules/claude-code/scripts

1 file changed

+8
-2
lines changed

registry/coder/modules/claude-code/scripts/start.sh

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,14 @@ has_session_for_workdir() {
5454
if [ -d "$project_sessions_dir" ]; then
5555
for file in "$project_sessions_dir"/*.jsonl; do
5656
[ -f "$file" ] || continue
57-
if ! grep -q '"content":"Warmup"' "$file" 2> /dev/null; then
58-
return 0
57+
58+
if grep -q '"type":"user"' "$file" 2> /dev/null; then
59+
local user_msg_count=$(grep -c '"type":"user"' "$file" 2> /dev/null || echo "0")
60+
local warmup_count=$(grep -c '"content":"Warmup"' "$file" 2> /dev/null || echo "0")
61+
62+
if [ "$user_msg_count" -gt "$warmup_count" ]; then
63+
return 0
64+
fi
5965
fi
6066
done
6167
fi

0 commit comments

Comments
 (0)