Skip to content

feat(agents): add session resumption for interrupted deployments#118

Open
lukemurraynz wants to merge 4 commits into
Azure:mainfrom
lukemurraynz:main
Open

feat(agents): add session resumption for interrupted deployments#118
lukemurraynz wants to merge 4 commits into
Azure:mainfrom
lukemurraynz:main

Conversation

@lukemurraynz
Copy link
Copy Markdown

Summary

  • Adds tracking/phase-state.json under each deployment directory so an interrupted Copilot Chat session can be resumed rather than restarted from scratch
  • On startup, the orchestrator scans for deployments in suspended, blocked, or awaiting-confirmation state and offers an R/N/V prompt before asking what to deploy
  • Phase state is written before and after every subagent delegation, covering all 7 pipeline stages through to final completed
  • Special-cases blocked (security gate) and awaiting-confirmation (deploy confirmation) so resume re-presents the right prompt rather than re-running the stage

What changes

Single file: .github/agents/git-ape.agent.md

  1. Session Resumption section — new section before ## Workflow Stages. Runs a bash scan on startup using a jq + python3 fallback (handles environments where jq is not installed, including Windows/VS Code without jq in PATH)
  2. Phase State Tracking block — added to the State Management section. Documents the write pattern, the full phase name table, all resumable vs terminal statuses, and the two special cases
  3. mkdir fix — changed mkdir -p .azure/deployments/$DEPLOYMENT_ID to mkdir -p .azure/deployments/$DEPLOYMENT_ID/tracking so the subdirectory exists from the start of every deployment

Phase state schema

{
  "deploymentId": "deploy-20260525-143022",
  "phase": "stage-2.5-security-gate",
  "status": "blocked",
  "startedAt": "2026-05-25T14:30:00Z",
  "updatedAt": "2026-05-25T14:35:10Z",
  "completedPhases": ["stage-1-requirements", "stage-2-template"],
  "mode": "interactive"
}

Resumable statuses: suspended · blocked · awaiting-confirmation
Terminal statuses (never resumed): completed · failed · aborted

- Implement check for interrupted deployments on startup
- Provide user options to resume, start fresh, or view details
- Track phase state to allow resuming at specific points
- Update output formatting for resumable deployments
Copilot AI review requested due to automatic review settings May 24, 2026 22:48
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

Adds guidance for resuming interrupted Azure deployment workflows by introducing a startup “resume check” and a phase-state.json tracking pattern that records phase transitions and resumable statuses.

Changes:

  • Documented session resumption flow (detect resumable deployments, prompt to resume/new/view).
  • Added phase state tracking guidance (tracking/phase-state.json) with recommended write points and statuses.
  • Updated deployment directory initialization to include a tracking/ folder.

Comment thread .github/agents/git-ape.agent.md Outdated
Comment on lines +178 to +196
_jq_read() { local file=$1 field=$2
jq -r ".$field" "$file" 2>/dev/null || \
python3 -c "import json,sys; print(json.load(sys.stdin)['$field'])" < "$file" 2>/dev/null
}

for dir in .azure/deployments/*/; do
state_file="${dir}tracking/phase-state.json"
if [ -f "$state_file" ]; then
status=$(_jq_read "$state_file" status)
case "$status" in
suspended|blocked|awaiting-confirmation)
dep=$(_jq_read "$state_file" deploymentId)
phase=$(_jq_read "$state_file" phase)
updated=$(_jq_read "$state_file" updatedAt)
echo "Found: $dep | $phase | $status | $updated"
;;
esac
fi
done
Comment thread .github/agents/git-ape.agent.md Outdated
Comment on lines +202 to +211
⏸️ In-Progress Deployment Found

| Deployment | Last Stage | Status | Last Updated |
|------------|-----------|--------|--------------|
| {deploymentId} | {phase} | {status} | {updatedAt} |

Would you like to:
R. Resume — continue from {phase}
N. Start a new deployment
V. View details of the interrupted deployment
Comment thread .github/agents/git-ape.agent.md Outdated
Comment on lines +562 to +573
cat > .azure/deployments/$DEPLOYMENT_ID/tracking/phase-state.json << 'EOF'
{
"deploymentId": "DEPLOYMENT_ID_PLACEHOLDER",
"phase": "PHASE_PLACEHOLDER",
"status": "in-progress",
"startedAt": "STARTED_AT_PLACEHOLDER",
"updatedAt": "UPDATED_AT_PLACEHOLDER",
"completedPhases": [],
"mode": "MODE_PLACEHOLDER"
}
EOF
# Replace placeholders with actual values using jq or shell substitution at write time
lukemurraynz and others added 3 commits May 25, 2026 11:59
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
- Allow 'in-progress' status to be treated as resumable
- Update documentation to reflect changes in resumable statuses
- Improve phase-state.json creation for tracking deployments
@arnaudlh
Copy link
Copy Markdown
Member

Thanks for the PR @Luke-Murray_atprod, good catch, let us review and integrate!

@arnaudlh arnaudlh added the enhancement New feature or request label May 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants