Skip to content

fix(web): cache static assets#1895

Open
floze-the-genius wants to merge 2 commits into
MoonshotAI:mainfrom
floze-the-genius:fix/1894-cache-web-assets
Open

fix(web): cache static assets#1895
floze-the-genius wants to merge 2 commits into
MoonshotAI:mainfrom
floze-the-genius:fix/1894-cache-web-assets

Conversation

@floze-the-genius

Copy link
Copy Markdown

Related Issue

Resolves #1894

Problem

kimi web returns HTTP 200 for fingerprinted Vite assets on every reload because the embedded server does not set a cache policy. This makes repeat page loads unnecessarily slow on lower-powered servers and clients.

What changed

  • Serve generated /assets/ files with Cache-Control: public, max-age=31536000, immutable.
  • Serve the application shell and SPA fallback with Cache-Control: no-cache so deployments are revalidated instead of pinning an old index.html.
  • Add route-level regressions for both cache policies.
  • Add a patch changeset for the bundled CLI web experience.

Validation

  • pnpm exec vitest run packages/kap-server/test/webAssets.test.ts (4 passed)
  • pnpm --filter @moonshot-ai/kap-server test (675 passed)
  • pnpm --filter @moonshot-ai/kap-server run typecheck
  • pnpm --filter @moonshot-ai/kap-server run build
  • pnpm exec changeset status --output=.tmp-changeset-status.json
  • git diff --check

AI assistance

AI-assisted tooling was used to help implement and test this focused fix. I reviewed the resulting diff, cache behavior, edge cases, and validation results before submission.

Checklist

  • I have read the CONTRIBUTING document.
  • I have linked a related issue, or explained the problem above.
  • I have added tests that prove the fix works.
  • Ran gen-changesets skill, or this PR needs no changeset.
  • Ran gen-docs skill, or this PR needs no doc update.

@changeset-bot

changeset-bot Bot commented Jul 18, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: ca383b1

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@moonshot-ai/kimi-code Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 2896795409

ℹ️ 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".

Comment thread packages/kap-server/src/routes/webAssets.ts Outdated
Signed-off-by: Floze <88098863+floze-the-genius@users.noreply.github.com>
@floze-the-genius

Copy link
Copy Markdown
Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Swish!

Reviewed commit: ca383b1168

ℹ️ 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".

@wraghadismail-creator

Copy link
Copy Markdown

@codex

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Delightful!

Reviewed commit: ca383b1168

ℹ️ 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".

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.

kimi web serves static asset files inefficiently without caching

2 participants