fix: session ID collision in cmd_start by excluding pm_agent_session_id
When cmd_start forks a new session, the session detection logic now excludes both base_session_id AND pm_agent_session_id to prevent forked sessions from being misidentified as the pm-agent session. This addresses issue #81 where forked sessions were showing the same session ID as the pm-agent.
This commit is contained in:
@@ -27,6 +27,27 @@ cp skills/kugetsu/scripts/kugetsu ~/.local/bin/kugetsu
|
||||
chmod +x ~/.local/bin/kugetsu
|
||||
```
|
||||
|
||||
## Configuration
|
||||
|
||||
User overrides can be set in `~/.kugetsu/config`. This file is sourced on each kugetsu command call, so changes take effect immediately without re-initialization.
|
||||
|
||||
A default config file is created during `kugetsu init` with commented examples:
|
||||
|
||||
```bash
|
||||
# User configuration overrides
|
||||
# Values set here take precedence over defaults
|
||||
# Changes take effect immediately (no re-init needed)
|
||||
|
||||
# Max concurrent dev agents (default: 3)
|
||||
# MAX_CONCURRENT_AGENTS=5
|
||||
```
|
||||
|
||||
### Available Config Options
|
||||
|
||||
| Variable | Default | Description |
|
||||
|----------|---------|-------------|
|
||||
| `MAX_CONCURRENT_AGENTS` | 3 | Maximum number of concurrent dev agents |
|
||||
|
||||
## Architecture
|
||||
|
||||
### Session Pattern
|
||||
|
||||
@@ -10,6 +10,11 @@ NOTIFICATIONS_FILE="$KUGETSU_DIR/notifications.json"
|
||||
LOGS_DIR="$KUGETSU_DIR/logs"
|
||||
MAX_CONCURRENT_AGENTS="${MAX_CONCURRENT_AGENTS:-3}"
|
||||
|
||||
# Load user config overrides (~/.kugetsu/config)
|
||||
if [ -f "$KUGETSU_DIR/config" ]; then
|
||||
source "$KUGETSU_DIR/config"
|
||||
fi
|
||||
|
||||
count_active_dev_sessions() {
|
||||
local count=0
|
||||
if [ -d "$SESSIONS_DIR" ]; then
|
||||
@@ -681,6 +686,18 @@ cmd_init() {
|
||||
|
||||
ensure_dirs
|
||||
|
||||
if [ ! -f "$KUGETSU_DIR/config" ]; then
|
||||
cat > "$KUGETSU_DIR/config" << 'EOF'
|
||||
# User configuration overrides
|
||||
# Values set here take precedence over defaults
|
||||
# Changes take effect immediately (no re-init needed)
|
||||
|
||||
# Max concurrent dev agents (default: 3)
|
||||
# MAX_CONCURRENT_AGENTS=5
|
||||
EOF
|
||||
echo "Created config file: $KUGETSU_DIR/config"
|
||||
fi
|
||||
|
||||
local existing_base=$(get_base_session_id)
|
||||
local existing_pm=$(get_pm_agent_session_id)
|
||||
|
||||
@@ -835,7 +852,7 @@ cmd_start() {
|
||||
local after_sessions=$(opencode session list 2>/dev/null | grep -oP '^ses_\w+' | sort)
|
||||
local new_session_id=""
|
||||
while IFS= read -r sess; do
|
||||
if [[ ! "$before_set" =~ \|${sess}\| ]] && [[ "$sess" != "$base_session_id" ]]; then
|
||||
if [[ ! "$before_set" =~ \|${sess}\| ]] && [[ "$sess" != "$base_session_id" ]] && [[ "$sess" != "$pm_agent_session_id" ]]; then
|
||||
new_session_id="$sess"
|
||||
break
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user