gastownhall/beads · warning

compaction would increase size (%d → %d bytes), keeping orig

Error message

compaction would increase size (%d → %d bytes), keeping original

What it means

Deliberate abort: the AI summary's byte length is >= the original content size (description + design + notes + acceptance criteria), so compacting would not save space (or would grow the issue). The compactor keeps the original and returns this message as an error after logging a warning comment on the issue.

Source

Thrown at internal/compact/compactor.go:130

	if c.config.DryRun {
		return fmt.Errorf("dry-run: would compact %s (original size: %d bytes)", issueID, originalSize)
	}

	// Get summary from AI
	summary, err := c.summarizer.SummarizeTier1(ctx, issue)
	if err != nil {
		return fmt.Errorf("failed to summarize: %w", err)
	}

	// Check if compaction would actually reduce size
	compactedSize := len(summary)
	if compactedSize >= originalSize {
		warningMsg := fmt.Sprintf("Tier 1 compaction skipped: summary (%d bytes) not shorter than original (%d bytes)", compactedSize, originalSize)
		if err := c.store.AddComment(ctx, issueID, "compactor", warningMsg); err != nil {
			return fmt.Errorf("failed to record warning: %w", err)
		}
		return fmt.Errorf("compaction would increase size (%d → %d bytes), keeping original", originalSize, compactedSize)
	}

	// Archive the original content BEFORE the destructive overwrite, so the
	// compaction is reversible (bd restore reads this snapshot). If archiving
	// fails we abort with the original content intact rather than lose it.
	if err := c.store.SnapshotIssue(ctx, issueID, 1); err != nil {
		return fmt.Errorf("failed to archive pre-compaction snapshot: %w", err)
	}

	// Update issue with summarized content
	updates := map[string]interface{}{
		"description":         summary,
		"design":              "",
		"notes":               "",
		"acceptance_criteria": "",
	}
	if err := c.store.UpdateIssue(ctx, issueID, updates, "compactor"); err != nil {
		return fmt.Errorf("failed to update issue: %w", err)

View on GitHub (pinned to 71377f2769)

Solutions

  1. Pre-filter issues by original size and only compact those above a meaningful threshold
  2. Treat this message as an expected skip in batch aggregation rather than a hard failure
  3. Use a stronger model or prompt if many summaries fail to shrink content
  4. Disable compaction for issues whose fields are already minimal

Example fix

// before
for _, id := range ids { c.CompactTier1(ctx, id) }
// after
for _, id := range ids {
    if issueSize(id) < 2048 { continue }
    if err := c.CompactTier1(ctx, id); err != nil {
        if strings.Contains(err.Error(), "compaction would increase size") { continue }
        return err
    }
}
Defensive patterns

Strategy: fallback

Validate before calling

origSize := len(iss.Description)+len(iss.Design)+len(iss.Notes)+len(iss.AcceptanceCriteria)
if origSize < 1024 {
    return fmt.Errorf("issue %s too small (%d bytes) to benefit from compaction", id, origSize)
}

Try / catch

if err := c.CompactTier1(ctx, id); err != nil {
    if strings.Contains(err.Error(), "compaction would increase size") {
        return nil // benign skip: original kept
    }
    return err
}

Prevention

When it happens

Trigger: SummarizeTier1(ctx, issue) returns a summary with len(summary) >= originalSize — e.g. the issue's text fields are already very short, or the model produced a verbose summary with no reduction.

Common situations: Running Tier 1 compaction on small issues where compression is impossible; a model returning verbose preambles; batch jobs that don't pre-filter by content size; repeated runs hitting the same borderline-sized issues every time.

Related errors


AI-assisted analysis of gastownhall/beads@71377f2769 (2026-08-30). Data as JSON: /api/errors/651f4aac25dc435b. Report an issue: GitHub.