fix(core): relativize instruction description to project root

This commit is contained in:
Dax Raad 2026-07-01 21:03:46 -04:00
commit 50a1fe49bc

View file

@ -33,8 +33,9 @@ const layer = Layer.effect(
const store = yield* SessionStore.Service
const location = yield* Location.Service
// Resolved once for the Location layer; the synthetic text and dedup ledger keep
// absolute paths, but the human-facing description shows paths relative to this root.
const root = FSUtil.resolve(location.directory)
// absolute paths, but the human-facing description shows paths relative to the project
// root so opening a subdirectory still describes paths from the project root.
const root = FSUtil.resolve(location.project.directory)
// Same-turn parallel reads settle concurrently, so an in-memory claim guards each
// Session/path pair before any filesystem work. The durable history check below covers
// paths injected in earlier turns after this Location layer was reopened.
@ -100,7 +101,7 @@ function previouslyInjected(store: SessionStore.Interface, sessionID: SessionSch
})
}
// Paths are normally discovered under the Location root, so the description shows them
// Paths are normally discovered under the project root, so the description shows them
// relative to it. A directly-loaded path outside the root falls back to its absolute form
// rather than emitting `../..` chains.
function describePath(root: string, path: string) {