Commit Graph

1 Commits

Author SHA1 Message Date
Ashish Huddar 2e4583b7bd
fix: clear stale Next.js cache on version upgrade (#1022)
* fix: clear stale Next.js cache on version upgrade (#986)

After upgrading @composio/ao via npm, `ao start` served the old UI because
Next.js runtime cache (.next/cache) persisted from the previous version.

Adds a hybrid fix:
- Postinstall hook clears .next/cache and writes a version stamp
- Runtime guard in `ao start` and `ao dashboard` compares stamp against
  package version; on mismatch, clears .next/cache and restamps
- Build-time script writes stamp after `next build` (monorepo path)

Only .next/cache is deleted — shipped build artifacts (.next/server,
.next/static, BUILD_ID) are never touched, keeping npm installs intact.

Closes #986

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* fix(lint): add Node.js globals for package-level scripts

The ESLint config only covered root-level scripts/, not
packages/*/scripts/. This caused `no-undef` errors for `console`
and `process` in packages/web/scripts/stamp-version.js.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* fix: ensure postinstall cache clearing runs on all platforms

Restructure postinstall.js so the node-pty chmod fix is wrapped in a
conditional block instead of using early process.exit(0). The previous
exits on Windows, missing node-pty, or missing spawn-helper prevented
the cache-clearing code from ever running on those systems.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* fix: address review comments on stamp-version ordering and cache catch logging

- Move stamp-version.js after tsc in web build script so a tsc failure
  does not leave a fresh stamp paired with a stale server bundle.
- Log skipped cache version checks via console.debug instead of swallowing
  silently, to aid debugging without blocking dashboard startup.

Addresses review feedback from @illegalcall on PR #1022.

* fix: resolve ao-web in postinstall cache cleanup

---------

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-05-01 12:23:51 +05:30