fix: update AD-002 docs and stale comments to reflect CLAUDE_CONFIG_DIR isolation (#647)
All checks were successful
ci/woodpecker/push/ci Pipeline was successful
ci/woodpecker/pr/ci Pipeline was successful

- AGENTS.md AD-002: document per-session CLAUDE_CONFIG_DIR as primary
  OAuth concurrency guard, CLAUDE_EXTERNAL_LOCK as rollback flag
- docker/agents/entrypoint.sh: update stale flock comment
- lib/agent-sdk.sh: move mkdir inside CLAUDE_EXTERNAL_LOCK branch

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Claude 2026-04-11 21:38:52 +00:00
parent 810b083d53
commit 16477e69b0
3 changed files with 5 additions and 5 deletions

View file

@ -137,13 +137,12 @@ agent_run() {
local run_dir="${worktree_dir:-$(pwd)}"
local lock_file="${HOME}/.claude/session.lock"
mkdir -p "$(dirname "$lock_file")"
local output rc
log "agent_run: starting (resume=${resume_id:-(new)}, dir=${run_dir})"
# Acquire lock separately (flock cannot exec bash functions)
# External flock is redundant once CLAUDE_CONFIG_DIR rollout is verified (#647).
# Gate behind CLAUDE_EXTERNAL_LOCK for rollback safety; default off.
if [ -n "${CLAUDE_EXTERNAL_LOCK:-}" ]; then
mkdir -p "$(dirname "$lock_file")"
output=$(cd "$run_dir" && ( flock -w 600 9 || exit 1; claude_run_with_watchdog claude "${args[@]}" ) 9>"$lock_file" 2>>"$LOGFILE") && rc=0 || rc=$?
else
output=$(cd "$run_dir" && claude_run_with_watchdog claude "${args[@]}" 2>>"$LOGFILE") && rc=0 || rc=$?