Skip to content

fix: annotate deleted files + retry on transient upstream errors#29

Merged
jbiskur merged 1 commit intomainfrom
fix/deleted-files-and-transient-errors
Apr 15, 2026
Merged

fix: annotate deleted files + retry on transient upstream errors#29
jbiskur merged 1 commit intomainfrom
fix/deleted-files-and-transient-errors

Conversation

@jbiskur
Copy link
Copy Markdown
Contributor

@jbiskur jbiskur commented Apr 15, 2026

Summary

  • generate_diff_summary now annotates every file with a Status field (ADDED / MODIFIED / DELETED / RENAMED / COPIED / TYPE-CHANGED) derived from git diff --name-status. DELETED entries get an explicit "do NOT attempt to read" note and skip modified-range extraction.
  • run_opencode / run_gemini now retry on a broader set of transient upstream signals: 504, 530, "provider returned error", "unmapped", ECONNRESET, EAI_AGAIN, "socket hang up", "deadline exceeded" (in addition to the existing 429/503/timeout/rate-limit). Grep is now case-insensitive.
  • system-prompt.md adds a "DELETED files — STOP condition" section that tells the LLM to trust the Status annotation and NEVER retry bare reads on deleted paths. Example workflow updated to include a DELETED row.

Context

Surfaced during the data-pathways v2.3.7 release (flowcore-io/data-pathways#89). A PR that deleted two handler files caused the validator to:

  1. Repeatedly hit File not found when it tried to Read the deleted paths (the diff summary listed them as normal changed files).
  2. Burn tool-call budget on the retries.
  3. Eventually trip the OpenCode agent's doom-loop detector and abort with permission requested: doom_loop (read); auto-rejecting.
  4. Separately, on the security-standards job, OpenRouter returned 504 / 530 upstream errors that weren't in the retry pattern, so the validator failed single-shot instead of retrying.

Between the two bugs, that PR's validation had to be manually rerun 4 times before it passed.

Test plan

  • CI green
  • Local smoke test: generate_diff_summary against v2.3.6..v2.3.7 on data-pathways correctly annotates both deleted handler files as Status: DELETED with the read-warning note.
  • Local smoke test: modification-only diff (v2.3.5..v2.3.6) still renders cleanly with Status: MODIFIED.
  • Shell syntax check (bash -n scripts/validate.sh).

🤖 Generated with Claude Code

Two related fixes that surfaced during the data-pathways v2.3.7 release
(see flowcore-io/data-pathways#89), where the validator repeatedly tried
to read files that had been deleted in the PR and eventually tripped the
OpenCode agent's loop detector.

1. `scripts/validate.sh` — `generate_diff_summary` now emits a `Status`
   field per file (ADDED / MODIFIED / DELETED / RENAMED / COPIED /
   TYPE-CHANGED) derived from `git diff --name-status`. DELETED entries
   get an explicit "do NOT attempt to read" note with a pointer to
   `git show HEAD^:path` for inspecting prior contents. Modified-range
   extraction is skipped for deleted files. Rename detection handles the
   `old => new` numstat notation so status lookup matches.

2. `scripts/validate.sh` — `run_opencode` and `run_gemini` now retry on
   a broader set of transient upstream signals: 504, 530, "provider
   returned error", "unmapped", ECONNRESET, EAI_AGAIN, "socket hang up",
   "deadline exceeded", plus the existing 429/503/timeout/rate-limit
   set. Previously these caused a single-shot failure. Grep is now
   case-insensitive.

3. `system-prompt.md` — adds a "DELETED files — STOP condition" section
   that explicitly tells the LLM to trust the Status annotation, never
   retry bare reads on deleted paths, and use `git show origin/<BASE>:path`
   if it actually needs the former contents. Updates the example
   workflow to include a DELETED row so the pattern is concrete.

Tested locally against the data-pathways v2.3.6→v2.3.7 diff: both
deleted handler files are now annotated `Status: DELETED` with the
read-warning note, and modification-only diffs still render cleanly.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@jbiskur jbiskur merged commit f3e38fe into main Apr 15, 2026
10 checks passed
@jbiskur jbiskur deleted the fix/deleted-files-and-transient-errors branch April 15, 2026 11:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant