Skip to content

fix: retrospective review fixes for merged PR #64#111

Merged
ikeikeikeike merged 1 commit into
mainfrom
fix/retro-review-pr64
Jul 16, 2026
Merged

fix: retrospective review fixes for merged PR #64#111
ikeikeikeike merged 1 commit into
mainfrom
fix/retro-review-pr64

Conversation

@ikeikeikeike

Copy link
Copy Markdown
Member

Retrospective /code-review sweep of merged PR #64 that shipped without pre-merge review.

PR #64 added a "## Source instincts" / "Source instinct:" provenance block to evolved SKILL.md / agent / command bodies, rendering homunculus.Instinct.Path verbatim as "the member's absolute on-disk location." That claim doesn't hold: Path is set by ReadInstinctFile to whatever directory string the scan started from (homunculus.Layout.Root, resolved from BOUGH_HOMUNCULUS_DIR / XDG_DATA_HOME when either is set), which is relative whenever that env var is a relative path.

This is the exact hazard commit c9cece5 ("fix(cli): enforce absolute symlink target") already fixed for the project-skill symlink target the same day PR #64 merged — its comment states plainly: "Evolved-skill sources can be relative when BOUGH_HOMUNCULUS_DIR is set to a relative path; a raw os.Symlink of a relative target would resolve against linkPath's dir and dangle." emit.go's new provenance lines never got the same treatment. Under that same environment, the emitted "Source instinct" path resolves against the reader's cwd instead of the scan's cwd — silently pointing at the wrong file (or nothing) the instant a SKILL.md is opened from a different directory, which is precisely the "worktree symlink hop away from the homunculus store" scenario the feature exists to serve.

Fix: add absInstinctPath (mirrors ensureSymlink's filepath.Abs + fallback-on-error pattern) and route both emit sites — sourceInstinctsBlock (skills + agents) and RenderCommand (commands) — through it, so the emitted path is always resolved to absolute regardless of how BOUGH_HOMUNCULUS_DIR / XDG_DATA_HOME is configured.

Test plan

  • go build ./...
  • go test ./...
  • golangci-lint run ./...

New tests: TestSourceInstinctsBlock_RelativePathResolvedAbsolute, TestAbsInstinctPath, plus a relative-path case added to TestRenderCommand.

PR #64 added a "## Source instincts" / "Source instinct:" provenance
line to evolved SKILL.md / agent / command bodies, using
homunculus.Instinct.Path verbatim. That Path is whatever directory
string ReadInstinctFile's scan started from
(homunculus.Layout.Root, via BOUGH_HOMUNCULUS_DIR / XDG_DATA_HOME),
which is relative whenever either env var is set to a relative path.

This is the exact hazard commit c9cece5 ("fix(cli): enforce absolute
symlink target") already fixed for the project-skill symlink target
the same day PR #64 merged: "Evolved-skill sources can be relative
when BOUGH_HOMUNCULUS_DIR is set to a relative path; a raw
os.Symlink of a relative target would resolve against linkPath's dir
and dangle." emit.go's new provenance lines never got the same
treatment, so under that same environment they render a path that
resolves against the READER's cwd instead of the scan's — silently
pointing at the wrong file (or nothing) the moment a SKILL.md is read
from a different directory, which is precisely the "worktree symlink
hop away from the homunculus store" scenario this feature exists for.

Add absInstinctPath (mirrors ensureSymlink's filepath.Abs + fallback
pattern) and route both emit sites (sourceInstinctsBlock,
RenderCommand) through it.
@ikeikeikeike
ikeikeikeike merged commit 45e4500 into main Jul 16, 2026
11 checks passed
@ikeikeikeike
ikeikeikeike deleted the fix/retro-review-pr64 branch July 16, 2026 07:09
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