Skip to content

feat(agent-core-v2): drop the experimental gate from turn-level file history - #3525

Merged
wbxl2000 merged 3 commits into
mainfrom
feat/file-history-always-on
Sep 4, 2026
Merged

feat(agent-core-v2): drop the experimental gate from turn-level file history#3525
wbxl2000 merged 3 commits into
mainfrom
feat/file-history-always-on

Conversation

@wbxl2000

@wbxl2000 wbxl2000 commented Sep 3, 2026

Copy link
Copy Markdown
Collaborator

Related Issue

N/A — follow-up to #3339, which shipped turn-level file history behind the experimental file_history flag. Companion client PR: MoonshotAI/kimi-code-app#525 (consumes the now-unconditional endpoints).

Problem

The turn-level file history shipped opt-in behind KIMI_CODE_EXPERIMENTAL_FILE_HISTORY (default off). The feature is ready to be always on: keeping a flag means the per-turn file diffs served by kap-server silently degrade to empty for every default install, and every read/write path carries a guard that no longer earns its keep.

What changed

  • The file_history flag definition and its env var are deleted; first-touch baselines, turn-boundary checkpoints, and the changes/turnRecorded/contentAt reads now run unconditionally.
  • GET /sessions/{id}/file-history/changes drops the enabled field from its response — recorded alone tells an authoritative empty result apart from a turn whose records were never made, lost to a crash, or displaced by retention.
  • Tests lose the flag stubs and the two flag-off behavior cases; retention windows, blob GC, fork handling, and the 4 MiB oversize sentinel are untouched.
  • Fixes a live bug found while verifying end to end: turnRecorded answered recorded=false for exactly the turns that had edits, because BlobStoreService.has probed existence with a shallow directory listing that can never match the nested file-history/<hash>@vN keys; it now stats the key. The scripted-turns e2e now pins turnRecorded against a real node-fs home so the harness covers the production layout.

Checklist

  • I have read the CONTRIBUTING document.
  • I have linked a related issue (external PRs: the issue must have a maintainer's /approve).
  • I have added tests that prove my feature works. (existing suites updated: agent-core-v2 fileHistory 21 tests, kap-server routes)
  • Ran gen-changesets skill, or this PR needs no changeset.
  • Ran gen-docs skill, or this PR needs no doc update. (wire/state manifests verified fresh by their tests — no durable event or state key changed)

@changeset-bot

changeset-bot Bot commented Sep 3, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 5f9ef04

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 Minor

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

@pkg-pr-new

pkg-pr-new Bot commented Sep 3, 2026

Copy link
Copy Markdown
pnpm dlx https://pkg.pr.new/@moonshot-ai/kimi-code@5f9ef04
npx https://pkg.pr.new/@moonshot-ai/kimi-code@5f9ef04

commit: 5f9ef04

@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: 48705567e3

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread .changeset/file-history-always-on.md
…history

The file_history flag and its KIMI_CODE_EXPERIMENTAL_FILE_HISTORY env
var are removed; first-touch baselines, turn checkpoints, and the
changes/turnRecorded/contentAt reads now run unconditionally, so the
per-turn file diffs served by kap-server no longer depend on opt-in
configuration.

The changes REST response drops its enabled field — recorded alone
tells an authoritative empty result apart from a turn whose records
were never made, lost to a crash, or displaced by retention.
… listing

turnRecorded always answered false for turns whose snapshots lived under
the file-history/ prefix directory: BlobStoreService.has listed the
scope directory (a shallow readdir) and exact-matched the nested key
against top-level entries, so keyed blobs were never found and the
changes endpoint reported recorded=false for exactly the turns that had
edits. Stat the key through storage.size instead, and pin the
turn-recorded assertions against a real node-fs home so the harness
covers the production layout.
@wbxl2000
wbxl2000 force-pushed the feat/file-history-always-on branch from 02bdc5d to 2ec8d6d Compare September 4, 2026 07:01
@wbxl2000

wbxl2000 commented Sep 4, 2026

Copy link
Copy Markdown
Collaborator Author

@codex review

@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: 2ec8d6d415

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

…rded

Merging the start and end entries let an end entry with key null (a
deleted or oversize-at-end file) shadow the start baseline, and probing
only one surviving key missed partial loss in the other phase: a
session displaced from the thirty-session window could still claim
authority for turns whose snapshots were gone. turnRecorded now stats
every distinct keyed blob across both checkpoints and reports the turn
unrecorded when any is missing.
@wbxl2000

wbxl2000 commented Sep 4, 2026

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Already looking forward to the next diff.

Reviewed commit: 5f9ef046c3

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

@wbxl2000
wbxl2000 merged commit eba23ed into main Sep 4, 2026
15 checks passed
@wbxl2000
wbxl2000 deleted the feat/file-history-always-on branch September 4, 2026 07:58
@github-actions github-actions Bot mentioned this pull request Sep 4, 2026
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