Skip to content

Add compaction source pruning#24

Merged
khaliqgant merged 1 commit intomainfrom
improve-trail-compaction-pruning
Apr 15, 2026
Merged

Add compaction source pruning#24
khaliqgant merged 1 commit intomainfrom
improve-trail-compaction-pruning

Conversation

@khaliqgant
Copy link
Copy Markdown
Member

@khaliqgant khaliqgant commented Apr 15, 2026

Summary

  • add trail compact --discard-sources to remove source trajectory JSON/Markdown/trace files and prune index entries after compaction
  • expose source pruning through compactWorkflow and SDK auto-compaction options
  • update the trail snippet, README guidance, and package formatting so lint passes

Verification

  • npm run lint
  • npm run typecheck
  • npm test -- --run

Open with Devin

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: e6ad1d1c29

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".


let updated = false;
for (const id of sourceIds) {
const entry = index.trajectories[id];
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Guard missing index maps during source discard

Handle structurally invalid index.json the same way as markTrajectoriesAsCompacted(): in discardSourceTrajectories(), index.trajectories is dereferenced without a guard, so a valid-but-corrupt index (for example { "version": 1 } from manual edits or partial writes in any search path) throws after the compaction artifact has already been written. That turns trail compact --discard-sources into a hard failure and can leave users with partial side effects instead of the intended best-effort cleanup.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Fixed in c6ba4cc by validating the parsed index shape before touching index.trajectories, so structurally invalid indexes are skipped during best-effort source discard.

Copy link
Copy Markdown

@devin-ai-integration devin-ai-integration Bot left a comment

Choose a reason for hiding this comment

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

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no potential bugs to report.

View in Devin Review to see 2 additional findings.

Open in Devin Review

@khaliqgant khaliqgant force-pushed the improve-trail-compaction-pruning branch from e6ad1d1 to c6ba4cc Compare April 15, 2026 16:12
@khaliqgant khaliqgant merged commit c4d1c28 into main Apr 15, 2026
6 checks passed
@khaliqgant khaliqgant deleted the improve-trail-compaction-pruning branch April 15, 2026 16:18
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