fix: Migrate review-pr.sh to SDK + pr-lifecycle (#800)

Move SID_FILE recovery into agent_recover_session() in lib/agent-sdk.sh
to eliminate remaining duplicate block between dev-agent.sh and
review-pr.sh.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
openhands 2026-03-28 06:34:26 +00:00
parent c2e95799a0
commit 8f41230fa0
3 changed files with 12 additions and 10 deletions

View file

@ -243,10 +243,7 @@ if [ -n "$PR_NUMBER" ]; then
fi
# Recover session_id from .sid file (crash recovery)
if [ -f "$SID_FILE" ]; then
_AGENT_SESSION_ID=$(cat "$SID_FILE")
log "recovered session_id: ${_AGENT_SESSION_ID:0:12}..."
fi
agent_recover_session
# =============================================================================
# WORKTREE SETUP

View file

@ -12,13 +12,21 @@
# agent_run [--resume SESSION_ID] [--worktree DIR] PROMPT
#
# After each call, _AGENT_SESSION_ID holds the session ID (also saved to SID_FILE).
# Recover a previous session on startup:
# if [ -f "$SID_FILE" ]; then _AGENT_SESSION_ID=$(cat "$SID_FILE"); fi
# Call agent_recover_session() on startup to restore a previous session.
set -euo pipefail
_AGENT_SESSION_ID=""
# agent_recover_session — restore session_id from SID_FILE if it exists.
# Call this before agent_run --resume to enable session continuity.
agent_recover_session() {
if [ -f "$SID_FILE" ]; then
_AGENT_SESSION_ID=$(cat "$SID_FILE")
log "agent_recover_session: ${_AGENT_SESSION_ID:0:12}..."
fi
}
# agent_run — synchronous Claude invocation (one-shot claude -p)
# Usage: agent_run [--resume SESSION_ID] [--worktree DIR] PROMPT
# Sets: _AGENT_SESSION_ID (updated each call, persisted to SID_FILE)

View file

@ -135,10 +135,7 @@ if [ -n "$PREV_REV" ] && [ "$PREV_REV" != "null" ]; then
fi
# Recover session_id from .sid file (re-review continuity)
if [ -f "$SID_FILE" ]; then
_AGENT_SESSION_ID=$(cat "$SID_FILE")
log "recovered session_id: ${_AGENT_SESSION_ID:0:12}..."
fi
agent_recover_session
# =============================================================================
# FETCH DIFF