fix(migration-legacy): import slugifyWorkDirName from agent-core#450
fix(migration-legacy): import slugifyWorkDirName from agent-core#450Arvuno wants to merge 2 commits into
Conversation
The local copy in workdir-bucket.ts duplicated packages/agent-core/src/utils/workdir-slug.ts and risked drift. Export slugifyWorkDirName from @moonshot-ai/agent-core and import it in the migrator. Removes the TODO at the top of workdir-bucket.ts and eliminates a class of subtle bucket-key mismatches between the running app and the migrator. No user-visible behavior change.
🦋 Changeset detectedLatest commit: 183242b The changes in this PR will be included in the next version bump. This PR includes changesets to release 3 packages
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 |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 767d1006be
ℹ️ 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".
| "@moonshot-ai/agent-core": patch | ||
| "@moonshot-ai/kimi-code": patch |
There was a problem hiding this comment.
Include the changed migrator package in the changeset
This changeset omits @moonshot-ai/migration-legacy even though the commit changes packages/migration-legacy/src/sessions/workdir-bucket.ts, so changeset version will not bump that package or update its changelog for the migrator output change. The repo's changeset rules require listing packages whose source/output changed, with @moonshot-ai/kimi-code added separately when the internal change enters the CLI bundle; please add the migrator package to the frontmatter.
Useful? React with 👍 / 👎.
Related Issue
The TODO at the top of
packages/migration-legacy/src/sessions/workdir-bucket.tsis resolved by this PR. No upstream issue needed — the duplicate was flagged in-source.Problem
packages/migration-legacy/src/sessions/workdir-bucket.tscarried a local copy ofslugifyWorkDirNameidentical to the canonical implementation inpackages/agent-core/src/utils/workdir-slug.ts. The local copy was marked with a TODO to delete it once the function became public on@moonshot-ai/agent-core.This is a small class of bug: if the canonical implementation ever changes (length cap, replacement regex, edge-case handling), the migrator would silently produce a different bucket name than the running app, making migrated sessions invisible in the session picker.
What changed
slugifyWorkDirNamefrompackages/agent-core/src/index.tsso in-monorepo consumers can import it directly.packages/migration-legacy/src/sessions/workdir-bucket.tswithimport { slugifyWorkDirName } from '@moonshot-ai/agent-core'..changeset/entry noting the internal dependency update.No user-visible behavior change. The migrator's
computeWorkdirBucketproduces the same output as before for the same inputs — both call sites now share the canonical implementation, so they cannot drift.Why this fits the repo
This is exactly the case the project's monorepo layout was set up for: a canonical utility in
agent-coreconsumed by a sibling package. The TODO explicitly asked for this refactor once the export became available; this PR makes the export available and follows through.Checklist
packages/migration-legacy/test/sessions/workdir-bucket.test.tscontinues to validatecomputeWorkdirBucketoutput and the function is unchanged at the call site.)gen-changesetsskill, or this PR needs no changeset. (Changeset added under.changeset/fix-migration-legacy-shared-slugify.md.)gen-docsskill, or this PR needs no doc update. (Internal refactor, no user-facing docs change.)Environment note
I was unable to run
pnpm install/pnpm testlocally because the repository requires Node>=24.15.0and the available toolchain in this environment is Node 22.22.2 (engine-strict is on, so install fails fast). The diff is small and self-contained:packages/agent-core/src/index.ts.-17lines inworkdir-bucket.ts(duplicate function removed, one import added, comment refreshed).I would appreciate a CI run from a maintainer to confirm the test suite still passes.