Skip to content

fix: make agent compaction freshness mtime-independent - #488

Merged
Kinfe123 merged 1 commit into
mainfrom
fix/agent-freshness-mtime
Aug 20, 2026
Merged

fix: make agent compaction freshness mtime-independent#488
Kinfe123 merged 1 commit into
mainfrom
fix/agent-freshness-mtime

Conversation

@Kinfe123

@Kinfe123 Kinfe123 commented Aug 20, 2026

Copy link
Copy Markdown
Member

Problem

The freshness (agent-freshness.yml) and local-readiness (agent-surface-smoke.yml) checks have been red on main since Aug 17.

Root cause: the compaction source document embedded a last_updated date derived from file mtime whenever a page had no explicit lastmod frontmatter — and no docs page sets one. Since every fresh checkout (including actions/checkout) stamps mtimes with the checkout time, agent compact --check could only pass on the same calendar day the content was generated. It passed Aug 14–16 by coincidence and broke on the first push after the Aug 14 provenance refresh (#485), flagging all 49 generated pages as stale and all 4 review-manifest entries as invalid, even though only the pages touched by #485/#487 had actually changed.

Fix

  • Drop the mtime-derived lastModified fallback from the compaction source document (buildResolvedPageSourceDocument); only explicit frontmatter lastmod contributes a last_updated line, so source hashes are stable across checkouts. Regression test included (shifts page mtimes by 400 days and asserts freshness is unaffected).
  • Re-stamp provenance sourceHash on all 49 generated agent.md pages — content unchanged, only the two header lines per file. A full cloud re-compaction was measured to regress golden-task quality from 22/22 (99.5/100) to 9/22, so the curated output is kept, matching the approach of the Refresh agent content provenance and add freshness CI #479 refresh.
  • Re-record the 4 drifted review-manifest entries with explicit reviewer + rationale (/docs/configuration genuinely changed in docs(cli): add docs for agent compact review workflow #485; the three customization pages drifted only via the hashing fix), and add reviewed entries for /docs/cli, /docs/reference, /docs/token-efficiency, whose sources gained docs(cli): add docs for agent compact review workflow #485/fix: create require lazily so server bundles load when import.meta.url is undefined #487 review-workflow coverage that the preserved compacted output does not yet fold in. The next edit to those pages will correctly demand a re-review.

Verification

  • agent compact --check: exits 0 — 46 fresh, 7 reviewed, 0 invalid/orphaned/stale/modified — and still passes after touching every page.mdx mtime (the failure mode that broke CI).
  • local-readiness steps run locally: doctor --agent --ci --fail-on fail exits 0 (golden tasks 22/22 at 99.5/100, task completeness 30/30) and check-agent-readiness-report.mjs passes with 0 unexpected warnings.
  • vitest: cli/agent.test.ts 29/29 (incl. new regression test), agent-provenance.test.ts, cli/doctor.test.ts 66/66.

Follow-up

Fold #485's review-workflow coverage into the curated agent.md for /docs/cli, /docs/reference, and /docs/token-efficiency, then re-review those entries.


Summary by cubic

Makes agent compaction freshness independent of file mtimes so CI stays green. Previously the compaction source document injected a last_updated from file mtime when lastmod was missing; now only explicit frontmatter lastmod contributes, stabilizing source hashes across checkouts.

  • Review focus

    • Removes the mtime-derived fallback in buildResolvedPageSourceDocument; adds a regression test that shifts a page’s mtime and keeps freshness unchanged.
    • Restamps provenance sourceHash on 49 generated agent.md files; content is unchanged aside from header lines. Re-compaction was measured to degrade golden-task quality, so curated outputs are preserved.
    • Updates the review manifest: re-records 4 drifted entries and adds reviewed entries for /docs/cli, /docs/reference, and /docs/token-efficiency to preserve curated outputs until new review-workflow coverage is folded in.
  • Rollout and verification

    • No migration required.
    • agent compact --check now passes across days and after mtime changes; local readiness checks and tests pass, including the new regression test.

Written for commit 044c704. Summary will update on new commits.

Review in cubic

The compaction source document embedded a last_updated date derived from
file mtime whenever a page had no explicit lastmod frontmatter (no docs
page sets one), so agent compact --check only passed when the checkout
day matched the generation day. That broke the freshness and
local-readiness checks on main starting Aug 17, the first push after the
Aug 14 provenance refresh.

- Drop the mtime-derived lastModified fallback from the compaction
  source document; only explicit frontmatter lastmod contributes a
  last_updated line. Add a regression test that shifts page mtimes and
  asserts freshness is unaffected.
- Re-stamp provenance sourceHash on all 49 generated agent.md pages;
  content is unchanged (a full cloud re-compaction was measured to
  regress golden-task quality from 22/22 to 9/22, so the curated output
  is kept, matching the #479 refresh approach).
- Re-record the 4 drifted review-manifest entries and add reviewed
  entries for /docs/cli, /docs/reference, and /docs/token-efficiency,
  whose sources gained #485/#487 review-workflow coverage that the
  preserved compacted output does not yet fold in.
@vercel

vercel Bot commented Aug 20, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
docs-website Ready Ready Preview Aug 20, 2026 11:01am
farming-labs-docs-docs-cloud Building Building Preview Aug 20, 2026 11:01am

Request Review

@greptile-apps greptile-apps Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Your trial has ended. Reactivate Greptile to resume code reviews.

@pkg-pr-new

pkg-pr-new Bot commented Aug 20, 2026

Copy link
Copy Markdown

Open in StackBlitz

@farming-labs/astro

pnpm add https://pkg.pr.new/farming-labs/docs/@farming-labs/astro@488

@farming-labs/astro-theme

pnpm add https://pkg.pr.new/farming-labs/docs/@farming-labs/astro-theme@488

@farming-labs/docs

pnpm add https://pkg.pr.new/farming-labs/docs/@farming-labs/docs@488

@farming-labs/farmjs

pnpm add https://pkg.pr.new/farming-labs/docs/@farming-labs/farmjs@488

@farming-labs/theme

pnpm add https://pkg.pr.new/farming-labs/docs/@farming-labs/theme@488

@farming-labs/next

pnpm add https://pkg.pr.new/farming-labs/docs/@farming-labs/next@488

@farming-labs/nuxt

pnpm add https://pkg.pr.new/farming-labs/docs/@farming-labs/nuxt@488

@farming-labs/nuxt-theme

pnpm add https://pkg.pr.new/farming-labs/docs/@farming-labs/nuxt-theme@488

@farming-labs/svelte

pnpm add https://pkg.pr.new/farming-labs/docs/@farming-labs/svelte@488

@farming-labs/svelte-theme

pnpm add https://pkg.pr.new/farming-labs/docs/@farming-labs/svelte-theme@488

@farming-labs/tanstack-start

pnpm add https://pkg.pr.new/farming-labs/docs/@farming-labs/tanstack-start@488

commit: 044c704

@vercel
vercel Bot requested a deployment to Preview – docs-website August 20, 2026 11:01 Abandoned
@vercel
vercel Bot requested a deployment to Preview – docs-website August 20, 2026 11:01 Abandoned
@Kinfe123
Kinfe123 merged commit 8a6d610 into main Aug 20, 2026
31 checks passed
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