kimi-code/packages/agent-core/test/session
Haozhe 56a321d4d1
fix(workspace): dedupe workspaces across Windows path spelling variants (#1809)
* fix(workspace): dedupe workspaces across Windows path spelling variants

The same directory reached the workspace registry as distinct strings on
Windows (drive-letter casing, typed vs on-disk casing, slash style), and
every identity check compared exact strings, so one folder could appear
as multiple workspaces with sessions split across hash-keyed buckets.

- add workspaceRootKey (slash-normalize + case-fold Windows-shaped
  paths) in agent-core, agent-core-v2, and the web app, and compare
  roots by identity key everywhere instead of exact strings
- registry createOrTouch folds alias spellings onto the existing entry
  instead of minting a new workspace id; session buckets reuse the
  registered id via a resolver in the v1 session store
- list endpoints expand alias buckets (resolveAliasIds /
  resolveAliasWorkDirs, including session-index-only spellings) so
  previously split workspaces list all sessions and counts under one
  merged group; session_index entries use the registry-resolved id

* fix(workspace): fold the runtime touch path and drive-root identity keys

Two gaps in the Windows path-spelling folding, both reachable in the
v1 session-create flow:

- touchWorkspaceRegistry minted the alias spelling's id outright; the
  freshly persisted alias entry then became the resolver's preferred id
  on the next create, splitting sessions into a duplicate bucket again.
  It now folds onto the identity-matching existing entry, mirroring the
  registry service.
- workspaceRootKey stripped trailing separators before testing the
  Windows shape, so a drive root (C:\) collapsed to C: and escaped the
  case-fold. The shape test now runs before the strip in all three
  copies (agent-core, agent-core-v2, web).

* fix(workspace): unfold symmetric operations that escaped the identity key

Two asymmetric spots left the folded comparison one-sided:

- the web app matched hidden roots by folded key but cleared them on
  re-add by exact string, so hiding C:\Foo and re-adding c:\foo kept
  the workspace hidden forever; clearing now folds too
- registry delete (both engines) removed and tombstoned only the exact
  id, so a legacy split sibling resurfaced as the directory's
  representative on the next list; delete now removes every registered
  spelling sharing the root's identity key and tombstones the full
  alias set (registered ids plus session-index spelling mints), so the
  session-index merge cannot resurrect the directory either
2026-07-17 14:56:06 +08:00
..
cron-stop-on-close.test.ts refactor(agent-core): split RuntimeConfig into Kaos and ToolServices (#185) 2026-05-29 12:28:47 +08:00
git-context.test.ts fix(agent-core): surface git context failures for explore subagents (#1067) 2026-06-24 19:59:30 +08:00
init.test.ts refactor(agent-core-v2): consolidate wire services (#1680) 2026-07-14 19:51:29 +08:00
lifecycle-hooks.test.ts feat(agent-core): default print mode to steer with unbounded limits (#1722) 2026-07-15 11:11:00 +08:00
prompt-metadata.test.ts fix(agent-core): route image-compression captions through hidden system reminders (#1348) 2026-07-03 16:21:10 +08:00
store.test.ts fix(workspace): dedupe workspaces across Windows path spelling variants (#1809) 2026-07-17 14:56:06 +08:00
subagent-batch.test.ts feat(agent-core): cap AgentSwarm concurrency via env var (#888) 2026-06-18 16:45:42 +08:00
subagent-host.test.ts feat(agent-core): align coder subagent tools with v2 and drain background tasks (#1776) 2026-07-16 17:14:53 +08:00