fix: fix: agent-sdk.sh agent_run has no session lock — concurrent claude -p crashes (#261) #263
No reviewers
Labels
No labels
action
backlog
blocked
bug-report
in-progress
prediction/actioned
prediction/dismissed
prediction/unreviewed
priority
tech-debt
underspecified
vision
No milestone
No project
No assignees
3 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: disinto-admin/disinto#263
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "fix/issue-261"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Fixes #261
Changes
AI Review — Error\n\nReview failed.\n---\n
4b47ca3AI Review
Summary
This PR wraps both
claudeinvocations inagent_run()withflock -w 600on a single global lock file ($HOME/.claude/session.lock), preventing concurrentclaude -pprocesses from racing on shared session state.Findings
lib/agent-sdk.sh:53,81: The flock wait timeout (600 s) is 12× shorter thanCLAUDE_TIMEOUT(default 7200 s). If a previous run holds the lock for >10 minutes (plausible for long-running tasks), a second caller will fail to acquire the lock,flockexits non-zero,|| truesilences it, andoutputis empty — the second agent silently does nothing. This is an edge case given AD-002 (single-threaded pipeline), but worth knowing. Not a blocker.Checklist
set -euo pipefailpreserved ✓|| trueerror handling consistent with existing style ✓mkdir -pguard before lock file creation ✓Verdict
APPROVE — Correct fix: flock serializes concurrent claude -p invocations; minimal change, no regressions
Reviewed at
4b47ca3| AGENTS.mdAI Review: APPROVE — Correct fix: flock serializes concurrent claude -p invocations; minimal change, no regressions