Skip to content

Commit ddf74e5

Browse files
promptium-aiclaude
andcommitted
Address third-round PR review (comments + doc)
- `listItemsByStage`: the "also surface slugs absent from the index" clause in the comment was never actually implemented — the loop only iterates index-known slugs. Rewrote the comment to describe what the code does; callers needing orphan-detection can scan the items dir. - `getItemStage`: added a comment explaining why the staleness guard (used elsewhere for ralph suppression) deliberately doesn't apply here. The last stage the agent wrote is still the correct stage even if the process later crashed — nothing auto-reverts, so no staleness check is appropriate. Skipping the sync-I/O-in-useMemo concern (pre-existing, separate project) and the ROWS_PER_ITEM=4 interaction with the 4-line selected card (acceptable UX trade-off for showing the full 200-char brief_description). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 68be7fc commit ddf74e5

1 file changed

Lines changed: 9 additions & 6 deletions

File tree

src/services/TrackerService.ts

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -595,6 +595,10 @@ export class TrackerService {
595595
// (which is the live self-report), then falls back to index.json bucket
596596
// membership, then to 'backlog' if the slug is unknown. Never returns null
597597
// for a known slug — an item always has a stage somewhere.
598+
// The staleness guard used by ralph (`isItemWaiting`) deliberately doesn't
599+
// apply here: the last stage the agent wrote is still the correct stage
600+
// even if the agent crashed 48h ago — nothing would auto-revert it — so
601+
// stage reads trust status.json unconditionally.
598602
getItemStage(projectPath: string, slug: string): TrackerStage {
599603
const status = this.getItemStatus(projectPath, slug);
600604
if (status) return status.stage;
@@ -605,15 +609,14 @@ export class TrackerService {
605609
// Enumerate every known active item grouped by stage. Stage for each slug
606610
// comes from status.json first; unmigrated items fall back to the index
607611
// buckets. Archived items are listed verbatim from index.archive.
612+
// Maps each index-known slug to its canonical stage, with any fresh
613+
// status.json stage overriding the index bucket. Slugs that exist only in
614+
// tracker/items/<slug>/ but aren't yet in the index aren't surfaced —
615+
// callers that need orphan-detection should scan the directory themselves.
608616
listItemsByStage(projectPath: string): Map<string, TrackerStage> {
609617
const index = this.readIndex(projectPath);
610618
const out = this.createStageBySlug(index);
611-
// Override with status.json where present, so the agent's live self-report
612-
// wins over the index buckets.
613-
const knownSlugs = new Set(out.keys());
614-
// Also surface slugs that have a status.json but aren't in the index yet
615-
// (e.g., an agent wrote status.json before the index was updated).
616-
for (const slug of knownSlugs) {
619+
for (const slug of out.keys()) {
617620
const status = this.getItemStatus(projectPath, slug);
618621
if (status) out.set(slug, status.stage);
619622
}

0 commit comments

Comments
 (0)