issue-agent: timeouts, checkpoint logging, run-link comment #161

Merged
romaine-life-app[bot] merged 3 commits from chore/issue-agent-observability into main 2026-04-28 23:00:32 -07:00
romaine-life-app[bot] commented 2026-04-28 22:58:46 -07:00 (Migrated from github.com)

Background

Issue-agent run 25090457215 stalled silently for 38 minutes inside Prepare issue-agent host before being cancelled. The step is one mega-script that runs ~6 unbounded sub-ops (git fetch/pull/clone of spire-lens-mcp, uv run python -m py_compile, dotnet build of the MCP, STS2 process stop, mod-deploy copies, restart-sts2.ps1) with zero output between them, so the GH log showed nothing past the last synchronous Write-Host. A future hang in any of the same family of sub-ops would behave identically.

Also: when a run hangs before verification, the issue page stays silent because the only comment-posting site is summarize-issue-agent.ps1 at the end of the verification job. The lock-holder workflow used to post a "started" comment but #152 (glimmung migration) deleted it, and Glimmung itself doesn't post.

Changes

.github/scripts/prepare-issue-agent-job.ps1

  • New Invoke-LoggedStep helper wraps each unbounded sub-op with ::group::/::endgroup:: + BEGIN/END timestamped log lines so a hang always names itself in the GH log. Wrapped: git fetch / git checkout / git pull / git clone (4 separate wraps for spire-lens-mcp), uv run py_compile, build.ps1, the STS2 process-stop block, the mod-deploy copy block, and restart-sts2.ps1.
  • Out-File -Encoding utf8 → utf8NoBOM on the 6 GITHUB_ENV writes that #159 missed. Behaviorally a no-op under pwsh (utf8 is BOM-free there by default) but matches #159's stated intent.

.github/scripts/prepare-issue-agent-scenario.ps1

  • Same Invoke-LoggedStep helper. Wrapped each of the 6 sub-ops in the scenario setup pipeline (3 STS2 restart/stops + 3 MCP python invocations) so we know which one is in flight if one hangs.

.github/workflows/issue-agent.yaml

  • timeout-minutes on every step (43 named steps, 43 timeouts). LLM steps kept their existing values; non-LLM steps got conservative caps sized to their unbounded operations:
    • Prepare issue-agent host: 10 min
    • Build and test baseline main: 8 min
    • Build implementation checkout: 6 min
    • Deploy implementation to STS2: 6 min
    • Prepare STS2 scenario save: 12 min (3 STS2 restarts at 90s + 3 MCP ops)
    • Push implementation branch / Create pull request: 6 / 5 min
    • Checkout / Refresh / Verify auth: 5 / 3 / 2 min
    • Quick gh/curl/bash/file-read steps: 1–3 min
      Turns the next silent stall into a failed step with logs.
  • ::group::/::endgroup:: markers around every dotnet build/test invocation in inline pwsh blocks (Build and test baseline main ×2 jobs, Build implementation checkout, Deploy implementation to STS2). Collapsible sections in the GH UI; safe because Write-Host doesn't reset $LASTEXITCODE.
  • New Comment with run link step in claim-issue posts Issue-agent run started: <run url> (host: <label>) on the issue before any LLM/build work runs. Best-effort; emits ::warning:: rather than failing if the gh api call returns non-zero.

Risk

  • timeout-minutes values may be too tight for cold-cache first-time runs on a brand-new runner. Sized to known warm-case duration plus comfortable margin; if a legitimately-slow op trips a timeout, raise the cap rather than removing it.
  • Invoke-LoggedStep uses try/finally with no catch so exceptions propagate exactly as before; ::endgroup:: always closes so the GH UI doesn't get an unbalanced group.
  • Run-start comment failure is non-fatal by design; if the GH issues API is flaky it'll log a warning and continue rather than failing the run before any work begins.

Test plan

  • YAML parses (python3 -c "import yaml; yaml.safe_load(open('.github/workflows/issue-agent.yaml'))") — verified locally.
  • Drop the issue-agent label on a relic-stat issue (e.g. #142 Akabeko) and confirm: a "run started" comment appears on the issue within a minute, the GH UI shows collapsible groups inside Build and test baseline main, and any silent stall now surfaces as BEGIN: <name> / never-END in the prep-host log.

🤖 Generated with Claude Code

## Background Issue-agent run [25090457215](https://github.com/nelsong6/spirelens/actions/runs/25090457215) stalled silently for 38 minutes inside `Prepare issue-agent host` before being cancelled. The step is one mega-script that runs ~6 unbounded sub-ops (git fetch/pull/clone of spire-lens-mcp, `uv run python -m py_compile`, dotnet build of the MCP, STS2 process stop, mod-deploy copies, `restart-sts2.ps1`) with zero output between them, so the GH log showed nothing past the last synchronous Write-Host. A future hang in any of the same family of sub-ops would behave identically. Also: when a run hangs before verification, the issue page stays silent because the only comment-posting site is `summarize-issue-agent.ps1` at the end of the verification job. The lock-holder workflow used to post a "started" comment but #152 (glimmung migration) deleted it, and Glimmung itself doesn't post. ## Changes ### `.github/scripts/prepare-issue-agent-job.ps1` - New `Invoke-LoggedStep` helper wraps each unbounded sub-op with `::group::`/`::endgroup::` + BEGIN/END timestamped log lines so a hang always names itself in the GH log. Wrapped: `git fetch` / `git checkout` / `git pull` / `git clone` (4 separate wraps for `spire-lens-mcp`), `uv run py_compile`, `build.ps1`, the STS2 process-stop block, the mod-deploy copy block, and `restart-sts2.ps1`. - `Out-File -Encoding utf8` → `utf8NoBOM` on the 6 `GITHUB_ENV` writes that #159 missed. Behaviorally a no-op under pwsh (utf8 is BOM-free there by default) but matches #159's stated intent. ### `.github/scripts/prepare-issue-agent-scenario.ps1` - Same `Invoke-LoggedStep` helper. Wrapped each of the 6 sub-ops in the scenario setup pipeline (3 STS2 restart/stops + 3 MCP python invocations) so we know which one is in flight if one hangs. ### `.github/workflows/issue-agent.yaml` - `timeout-minutes` on every step (43 named steps, 43 timeouts). LLM steps kept their existing values; non-LLM steps got conservative caps sized to their unbounded operations: - Prepare issue-agent host: 10 min - Build and test baseline main: 8 min - Build implementation checkout: 6 min - Deploy implementation to STS2: 6 min - Prepare STS2 scenario save: 12 min (3 STS2 restarts at 90s + 3 MCP ops) - Push implementation branch / Create pull request: 6 / 5 min - Checkout / Refresh / Verify auth: 5 / 3 / 2 min - Quick gh/curl/bash/file-read steps: 1–3 min Turns the next silent stall into a failed step with logs. - `::group::`/`::endgroup::` markers around every dotnet build/test invocation in inline pwsh blocks (Build and test baseline main ×2 jobs, Build implementation checkout, Deploy implementation to STS2). Collapsible sections in the GH UI; safe because `Write-Host` doesn't reset `$LASTEXITCODE`. - New `Comment with run link` step in `claim-issue` posts `Issue-agent run started: <run url> (host: <label>)` on the issue before any LLM/build work runs. Best-effort; emits `::warning::` rather than failing if the gh api call returns non-zero. ## Risk - `timeout-minutes` values may be too tight for cold-cache first-time runs on a brand-new runner. Sized to known warm-case duration plus comfortable margin; if a legitimately-slow op trips a timeout, raise the cap rather than removing it. - `Invoke-LoggedStep` uses try/finally with no catch so exceptions propagate exactly as before; `::endgroup::` always closes so the GH UI doesn't get an unbalanced group. - Run-start comment failure is non-fatal by design; if the GH issues API is flaky it'll log a warning and continue rather than failing the run before any work begins. ## Test plan - [ ] YAML parses (`python3 -c "import yaml; yaml.safe_load(open('.github/workflows/issue-agent.yaml'))"`) — verified locally. - [ ] Drop the `issue-agent` label on a relic-stat issue (e.g. #142 Akabeko) and confirm: a "run started" comment appears on the issue within a minute, the GH UI shows collapsible groups inside `Build and test baseline main`, and any silent stall now surfaces as `BEGIN: <name>` / never-END in the prep-host log. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
romaine-life/spirelens!161
No description provided.