feat(kugetsu): implement fire-and-forget delegation (#41) #42

Merged
shoko merged 3 commits from feat/issue-41-fire-and-forget-delegation into main 2026-03-31 10:17:20 +02:00
Owner

Summary

Implement fire-and-forget delegation as specified in issue #41.

Changes

cmd_delegate (Non-blocking)

# Before (blocking)
opencode run --continue --session "$pm_session" "$message" 2>&1

# After (fire-and-forget)
mkdir -p "$LOGS_DIR"
local log_file="$LOGS_DIR/delegate-$(date +%s).log"
nohup opencode run --continue --session "$pm_session" "$message" > "$log_file" 2>&1 &
disown
echo "Delegated to PM agent (logged to $(basename "$log_file"))"

New cmd_logs Command

  • View recent delegation logs
  • Default: 10 most recent
  • Optional: kugetsu logs 20 for more
  • Auto rotation: deletes logs older than 7 days

Testing

Manual verification:

kugetsu delegate "ping"
# Should return immediately
kugetsu logs
# Should show recent delegations

Issue #41: #41

## Summary Implement fire-and-forget delegation as specified in issue #41. ## Changes ### cmd_delegate (Non-blocking) ```bash # Before (blocking) opencode run --continue --session "$pm_session" "$message" 2>&1 # After (fire-and-forget) mkdir -p "$LOGS_DIR" local log_file="$LOGS_DIR/delegate-$(date +%s).log" nohup opencode run --continue --session "$pm_session" "$message" > "$log_file" 2>&1 & disown echo "Delegated to PM agent (logged to $(basename "$log_file"))" ``` ### New cmd_logs Command - View recent delegation logs - Default: 10 most recent - Optional: `kugetsu logs 20` for more - Auto rotation: deletes logs older than 7 days ## Testing Manual verification: ```bash kugetsu delegate "ping" # Should return immediately kugetsu logs # Should show recent delegations ``` Issue #41: https://git.fbrns.co/shoko/kugetsu/issues/41
shoko added 1 commit 2026-03-31 08:12:32 +02:00
- cmd_delegate now runs in background with nohup + disown
- Output logged to ~/.kugetsu/logs/delegate-<timestamp>.log
- Added cmd_logs to view recent delegation logs
- Log rotation: logs older than 7 days auto-deleted

Issue #41: #41
shoko added 2 commits 2026-03-31 09:25:41 +02:00
- Added MAX_CONCURRENT_AGENTS env var (default: 3)
- Implemented acquire_agent_slot() and release_agent_slot() with flock
- Wrapped cmd_start, cmd_continue, and cmd_delegate with slot management
- cmd_delegate holds slot until background process completes (fire-and-forget + blocking)
- Added concurrency tests to test-kugetsu-v2.sh
- Add MAX_CONCURRENT_AGENTS (default: 3) to limit concurrent agents
- Implement acquire_agent_slot() and release_agent_slot() with flock
- Wrap cmd_start, cmd_continue, and cmd_delegate with slot management
- cmd_delegate holds slot until background task completes (fire-and-forget + blocking)
- Add basic concurrency tests to test suite
shoko force-pushed feat/issue-41-fire-and-forget-delegation from 83a4b1243d to 3c15d8df1d 2026-03-31 09:26:12 +02:00 Compare
shoko added 1 commit 2026-03-31 10:12:52 +02:00
Ignore __pycache__/, results/, and *.pyc files
Remove already tracked test results from git tracking
shoko merged commit faff525bfc into main 2026-03-31 10:17:20 +02:00
Sign in to join this conversation.