Skip to content

fix(session): match CodeBuddy long project directory names - #1347

Merged
SaulMoro merged 1 commit into
Tencent:mainfrom
nateEc:fix/1221-codebuddy-long-path
Oct 23, 2026
Merged

SaulMoro merged 1 commit into
Tencent:mainfrom
nateEc:fix/1221-codebuddy-long-path

Conversation

@nateEc

@nateEc nateEc commented Oct 23, 2026 •

Copy link
Copy Markdown
Contributor

CodeBuddy compresses normalized workspace directory names above 255 UTF-8 bytes. TeamAI previously used the entire normalized path, so listing/reading missed native sessions and migration could fail with an overlong filename.

Match compressWorkspacePathName from the publisher's CodeBuddy 2.173.0 package: a code-point-safe 180-byte prefix plus - and the unsigned djb2 base36 hash of every normalized byte. Names at or below 255 bytes remain unchanged.

Validation:

  • Evaluated fixed vectors directly with the extracted publisher bundle, independently of TeamAI's encoder. Five new long-name vectors failed on main; the exact 255-byte boundary already passed.
  • npx vitest run src/__tests__/buddy-windows-cwd.test.ts: 10 passed, covering 255/256 bytes, Unicode/emoji boundaries, distinct suffixes and Windows drive paths.
  • npm run build and npx vitest run --config vitest.e2e.config.ts src/__tests__/e2e/buddy-session-directories.test.ts: 2 passed through the built CLI: migrate a Claude transcript into short/long native CodeBuddy directories and read it back into Claude.
  • CI exposed a fixture-length assumption on Linux: its short temporary root produced a 244-byte name. Reproduced locally with TMPDIR=/tmp (252 bytes on macOS). The final fixture's segments alone now exceed 255 bytes. After rebuilding, the two CLI cases passed with retries disabled under both the native temp root and TMPDIR=/tmp (2 passed in each run); the 10 encoder unit cases, TypeScript and lint also passed on the final source.
  • npx tsc --noEmit, npm run lint, and git diff --check: passed.

State review: both CodeBuddy CLI and WorkBuddy adapter directory lookup and session writes already call the shared encoder; no parallel path implementation or new storage format is introduced. The bilingual session guide and troubleshooting skill data are updated. Windows path seams were tested; native Windows and a live WorkBuddy desktop application were not available locally.

Broader regression: npx vitest run --maxWorkers=6 in a frozen integration worktree containing the five changes finished with 500 files passed, 12,285 tests passed, 36 skipped, 2 failed. Both failures are the pre-existing submodule-checkout.test.ts empty legacy hook-file cases; a clean 83f6d1db worktree independently reproduced 24 passed / the same 2 failed. This is an integration-suite record, not a claim that the baseline is fully green.

Refs #1221. One independently reviewable defect from the issue; the audit/issue remains open for its other items.

@github-actions

Copy link
Copy Markdown
  • [P1 blocking] The “long” E2E fixture is too short on Linux with /tmp (src/__tests__/e2e/buddy-session-directories.test.ts:15). For a home such as /tmp/teamai-buddy-e2e-ABC123, the normalized target name is only 246 bytes, so the toBeGreaterThan(255) assertion fails and compression is never exercised. Lengthen the nested segments so the normalized name reliably exceeds 255 bytes.

The description documents sufficient build and real-CLI testing; no missing-testing finding applies. However, the claimed two passing E2E cases conflict with this fixture on a standard Linux temporary directory.

Review was read-only; no PR code was run, built, or installed.

- Match compressWorkspacePathName from the publisher's CodeBuddy 2.173.0 bundle: keep names up to 255 UTF-8 bytes, otherwise use a code-point-safe 180-byte prefix and the unsigned djb2 base36 hash of the entire normalized path.
- Route existing CodeBuddy CLI and WorkBuddy session readers and writers through the corrected shared encoder, retaining short-path, space, punctuation and Windows-drive behavior.
- Add publisher-evaluated fixed vectors for the byte boundary, multibyte and emoji truncation, distinct suffixes and Windows paths, plus real-CLI short/long migration and read-back coverage with segments that exceed the threshold independently of TMPDIR length.
- Verify 10 encoder unit tests and both built-CLI migration E2E cases under native and short /tmp temporary roots, TypeScript and lint; update the bilingual session guide and troubleshooting skill data.

Refs: Tencent#1221
@nateEc
nateEc force-pushed the fix/1221-codebuddy-long-path branch from 2f83c93 to 01c30e3 Compare October 23, 2026 12:42
@github-actions

Copy link
Copy Markdown

No new findings in the specified diff.

  • Resolved: The earlier [P1 blocking] fixture-length issue is fixed. The nested segments alone exceed 255 normalized UTF-8 bytes, so the long-path case exercises compression even under /tmp.
  • Testing: The PR description documents sufficient build and real-CLI verification, including both E2E cases passing after the fixture fix. No missing-testing finding applies.

Review was read-only; no PR code was run, built, or installed.

@SaulMoro SaulMoro left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This was generated by AI during triage.

@nateEc Thanks, approving. This closes the #1221 item on CodeBuddy's long project directory names.

We ported compressWorkspacePathName from CodeBuddy's 2.172.1 bundle (2.173.0 was too new to install here) and compared it with this PR's encoder on 4,000 generated paths, 1,334 of them over 255 bytes, multi-byte characters included. There were no mismatches. With the real CLI, a long-path session round-trips on this head, while the merge-base and main fail with ENAMETOOLONG. tsc, lint and the new tests pass.

Suggestions:

  • [P2 non-blocking] The troubleshooting paragraph sits under "Pull left an instruction file unchanged" rather than ### WorkBuddy. The dashboard.md sentences (EN and zh-CN) describe internals a user can't act on. One actionable line, or none, would follow AGENTS.md's "change docs rarely".
  • [P3 nit] The fs.ts comment says it hashes "every original byte", but the code hashes the normalized string. The zh-CN text has a stray space after "。". The e2e long case repeats the djb2 loop where a literal would do, since the unit vectors already cover it.

CI review: it reported no new findings and accepted the testing record. We agree on the fix and the record. The two doc points above are the only additions. CI jobs pass at this head.

@SaulMoro
SaulMoro merged commit 1c84db3 into Tencent:main Oct 23, 2026
18 checks passed
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.

3 participants