Skip to content

fix(migration-legacy): import slugifyWorkDirName from agent-core#450

Open
Arvuno wants to merge 2 commits into
MoonshotAI:mainfrom
Arvuno:fix/migration-legacy-shared-slugify
Open

fix(migration-legacy): import slugifyWorkDirName from agent-core#450
Arvuno wants to merge 2 commits into
MoonshotAI:mainfrom
Arvuno:fix/migration-legacy-shared-slugify

Conversation

@Arvuno
Copy link
Copy Markdown

@Arvuno Arvuno commented Jun 5, 2026

Related Issue

The TODO at the top of packages/migration-legacy/src/sessions/workdir-bucket.ts is resolved by this PR. No upstream issue needed — the duplicate was flagged in-source.

Problem

packages/migration-legacy/src/sessions/workdir-bucket.ts carried a local copy of slugifyWorkDirName identical to the canonical implementation in packages/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

  • Export slugifyWorkDirName from packages/agent-core/src/index.ts so in-monorepo consumers can import it directly.
  • Replace the local duplicate in packages/migration-legacy/src/sessions/workdir-bucket.ts with import { slugifyWorkDirName } from '@moonshot-ai/agent-core'.
  • Remove the TODO comment block.
  • Add a .changeset/ entry noting the internal dependency update.

No user-visible behavior change. The migrator's computeWorkdirBucket produces 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-core consumed 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

  • I have read the CONTRIBUTING document.
  • I have linked a related issue, or explained the problem above. (In-source TODO, not an issue.)
  • I have added tests that prove my feature works. (No new tests needed — the existing test at packages/migration-legacy/test/sessions/workdir-bucket.test.ts continues to validate computeWorkdirBucket output and the function is unchanged at the call site.)
  • Ran gen-changesets skill, or this PR needs no changeset. (Changeset added under .changeset/fix-migration-legacy-shared-slugify.md.)
  • Ran gen-docs skill, or this PR needs no doc update. (Internal refactor, no user-facing docs change.)

Environment note

I was unable to run pnpm install / pnpm test locally because the repository requires Node >=24.15.0 and 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:

  • One new export line in packages/agent-core/src/index.ts.
  • Net -17 lines in workdir-bucket.ts (duplicate function removed, one import added, comment refreshed).
  • The exported function's body is byte-identical to the local copy that was removed, so behavior is preserved.

I would appreciate a CI run from a maintainer to confirm the test suite still passes.

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-bot
Copy link
Copy Markdown

changeset-bot Bot commented Jun 5, 2026

🦋 Changeset detected

Latest commit: 183242b

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

This PR includes changesets to release 3 packages
Name Type
@moonshot-ai/agent-core Patch
@moonshot-ai/kimi-code Patch
@moonshot-ai/migration-legacy 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

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

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: 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".

Comment on lines +2 to +3
"@moonshot-ai/agent-core": patch
"@moonshot-ai/kimi-code": patch
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge 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 👍 / 👎.

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