Skip to content

fix(recovery): bump RESUME_COUNT on markdown table ledger rows (BUG-004) - #146

Merged
cursor[bot] merged 1 commit into
cursor/adversarial-review-base-256afrom
cursor/bug-004-resume-table-256a
Jul 8, 2026
Merged

fix(recovery): bump RESUME_COUNT on markdown table ledger rows (BUG-004)#146
cursor[bot] merged 1 commit into
cursor/adversarial-review-base-256afrom
cursor/bug-004-resume-table-256a

Conversation

@ravidsrk

@ravidsrk ravidsrk commented Jul 8, 2026

Copy link
Copy Markdown
Owner

Summary

Closes BUG-004 from the adversarial review (c6c486).

increment_resume_count previously only rewrote pipe-format ledger rows, so table-format ledgers silently no-op'd resume budget writes while parse_ledger_rows still read them.

Changes

  • Extend increment_resume_count to detect and rewrite markdown table rows
  • Append missing RESUME_COUNT columns when needed
  • Sync substrate + tests

Base

Merges into cursor/adversarial-review-base-256a (mission BASE).

Open in Web Open in Cursor 

Greptile Summary

This PR fixes resume-count updates for markdown table ledgers. The main changes are:

  • Adds table-row detection for increment_resume_count.
  • Appends a missing RESUME_COUNT column to table headers, separators, and rows.
  • Preserves pipe-row precedence when duplicate task IDs exist.
  • Syncs the substrate copy and manifest hash.
  • Adds tests for table-format resume counting and escalation.

Confidence Score: 5/5

Safe to merge with low risk.

The change is focused on one recovery ledger write path, matches the existing table parser behavior, preserves atomic file replacement, and includes tests for the fixed cases.

No files require special attention.

T-Rex T-Rex Logs

What T-Rex did

  • Ran the focused recovery_scan Pytest suite and confirmed it completed with exit code 0.
  • Inspected the ledger state transition with the recovery_scan table harness, confirming RESUME_COUNT handling and that Alpha was set to 1 with a return value of 1 and exit code 0.
  • Saved the recovery_scan harness source for review.

View all artifacts

T-Rex Ran code and verified through T-Rex

Important Files Changed

Filename Overview
scripts/lib/recovery_scan.py Extends resume-count updates to markdown table ledger rows while preserving existing pipe-row behavior and atomic writes.
skills/autonomous-fleet-core/assets/substrate/lib/recovery_scan.py Keeps the substrate copy of recovery_scan.py synchronized with the main implementation.
skills/autonomous-fleet-core/assets/substrate/substrate-manifest.json Updates the substrate manifest hash for the synced lib/recovery_scan.py asset.
tests/test_recovery_scan.py Adds tests for table-format resume-count initialization, existing count bumps, and pipe/table duplicate precedence.

Sequence Diagram

%%{init: {'theme': 'neutral'}}%%
sequenceDiagram
participant Caller
participant RecoveryScan as increment_resume_count
participant Finder as _find_resume_target
participant Ledger as Ledger file

Caller->>RecoveryScan: bump task_id
RecoveryScan->>Ledger: read text lines
RecoveryScan->>Finder: locate pipe/table row
alt pipe row found
    Finder-->>RecoveryScan: pipe index
    RecoveryScan->>RecoveryScan: bump RESUME_COUNT flag
else table row found
    Finder-->>RecoveryScan: table row + header index
    RecoveryScan->>RecoveryScan: bump table cell
    opt missing RESUME_COUNT column
        RecoveryScan->>RecoveryScan: extend header, separator, and sibling rows
    end
else no matching row
    Finder-->>RecoveryScan: no target
    RecoveryScan-->>Caller: -1
end
RecoveryScan->>Ledger: write temp file and os.replace
RecoveryScan-->>Caller: new count
Loading
%%{init: {'theme': 'base', 'themeVariables': {"darkMode": true, "background": "#0d1117", "primaryColor": "#21262d", "primaryTextColor": "#e6edf3", "primaryBorderColor": "#8b949e", "lineColor": "#8b949e", "textColor": "#e6edf3", "edgeLabelBackground": "#161b22", "actorBkg": "#21262d", "actorBorder": "#8b949e", "actorTextColor": "#e6edf3", "actorLineColor": "#8b949e", "signalColor": "#8b949e", "signalTextColor": "#e6edf3", "noteBkgColor": "#373320", "noteBorderColor": "#d4a72c", "noteTextColor": "#f0e6c0", "labelBoxBkgColor": "#21262d", "labelBoxBorderColor": "#8b949e", "labelTextColor": "#e6edf3", "loopTextColor": "#e6edf3", "activationBkgColor": "#30363d", "activationBorderColor": "#8b949e"}}}%%
sequenceDiagram
participant Caller
participant RecoveryScan as increment_resume_count
participant Finder as _find_resume_target
participant Ledger as Ledger file

Caller->>RecoveryScan: bump task_id
RecoveryScan->>Ledger: read text lines
RecoveryScan->>Finder: locate pipe/table row
alt pipe row found
    Finder-->>RecoveryScan: pipe index
    RecoveryScan->>RecoveryScan: bump RESUME_COUNT flag
else table row found
    Finder-->>RecoveryScan: table row + header index
    RecoveryScan->>RecoveryScan: bump table cell
    opt missing RESUME_COUNT column
        RecoveryScan->>RecoveryScan: extend header, separator, and sibling rows
    end
else no matching row
    Finder-->>RecoveryScan: no target
    RecoveryScan-->>Caller: -1
end
RecoveryScan->>Ledger: write temp file and os.replace
RecoveryScan-->>Caller: new count
Loading

Reviews (1): Last reviewed commit: "fix(recovery): increment resume count on..." | Re-trigger Greptile

…G-004)

Co-authored-by: Ravindra Kumar <ravidsrk@gmail.com>
@cursor
cursor Bot merged commit 14ac0c6 into cursor/adversarial-review-base-256a Jul 8, 2026
1 of 2 checks passed
@cursor cursor Bot mentioned this pull request Jul 8, 2026
5 tasks
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.

2 participants