5 Commits

Author SHA1 Message Date
oldschoola a2854ba768 fix: migrate coding-agent tests from fs.rm to removeWithRetries
Migrate 203 test files (356 call sites) from fs.rm/fs.rmSync to
removeWithRetries/removeSyncWithRetries to reduce EBUSY test failures
on Windows. removeWithRetries is now exported from @oh-my-pi/pi-utils.

The migration uses a regex-based approach that:
- Replaces fs.rm(path, { recursive, force }) → removeWithRetries(path)
- Replaces fs.rmSync(path, { recursive, force }) → removeSyncWithRetries(path)
- Replaces fs.rm(path) → removeWithRetries(path) (no options)
- Skips fs.rm/fs.rmSync inside template literals (bun --eval scripts)
- Adds imports to existing @oh-my-pi/pi-utils import or creates new one
- Removes unused fs imports where fs.rm was the only fs usage (4 files)
2026-06-23 15:28:05 -07:00
can1357 9d457f73d9 test: migrated test imports to package subpath exports
- Replaced relative `../src` imports with `@oh-my-pi/pi-ai` and `@oh-my-pi/pi-agent-core` subpaths.
2026-06-08 19:03:55 +02:00
can1357 3056caee91 chore: reformat 2026-03-14 10:46:26 +01:00
Rens Tillmann 820a17aa29 fix(memories): isolate Phase 2 consolidation per project working directory (#401)
* fix(memories): isolate Phase 2 consolidation per project working directory

The global memory consolidation job used a single 'global' job key,
causing all projects to share one Phase 2 slot. Whichever project
claimed it first got every project's stage1 outputs written into its
memory directory — cross-project contamination.

Root cause:
- GLOBAL_KEY = 'global' was a single key shared by all projects
- listStage1OutputsForGlobal() had no cwd filter — returned ALL
  stage1 outputs across all projects
- markGlobalPhase2Succeeded/Failed/Unowned all operated on the same
  single global job row

Fix:
- Replace GLOBAL_KEY constant with globalJobKey(cwd) function that
  namespaces the job key per project: 'global:/path/to/project'
- Add cwd parameter to all Phase 2 storage functions so each project
  maintains its own job slot in the jobs table
- Filter listStage1OutputsForGlobal() by t.cwd = ? so each project
  only consolidates its own thread outputs
- Thread cwd from session.sessionManager.getCwd() through runPhase2()
  to all storage calls
- Add cwd to markStage1SucceededWithOutput/NoOutput so enqueueGlobal
  Watermark targets the correct per-project job key
- Add cwd parameter to enqueueMemoryConsolidation() public API and
  update its only external caller (command-controller)

Closes #369

* test(memories): add isolation tests for per-project Phase 2 consolidation

Three tests covering the regression fixed in the previous commit:
- listStage1OutputsForGlobal filters outputs by cwd (no cross-project leak)
- enqueueGlobalWatermark creates separate job rows keyed per-project
- tryClaimGlobalPhase2Job claims only the requested project's slot and
  leaves the other project's job independently claimable

* docs: add inline comments for memory isolation fix and tests

---------

Co-authored-by: Rens Tillmann <rens@super-forms.com>
2026-03-14 10:41:37 +01:00
can1357 ba1e3f8a07 fix(coding-agent): expanded internal url resolution and hardened memory protocol
Fixes #54
Fixes #74
2026-02-18 15:14:21 +01:00