Skip to content

fix(bin): normalize relative durable paths - #1

Closed
sparkus wants to merge 4 commits into
mainfrom
fm/fix-secondmate-relative-status-path
Closed

fix(bin): normalize relative durable paths#1
sparkus wants to merge 4 commits into
mainfrom
fm/fix-secondmate-relative-status-path

Conversation

@sparkus

@sparkus sparkus commented Jul 29, 2026

Copy link
Copy Markdown
Owner

Resolve relative FM_HOME, FM_DATA_OVERRIDE, and FM_STATE_OVERRIDE inputs to absolute paths before deriving durable or cross-process paths, and refuse with the offending variable named when an input cannot be resolved.

Why

A secondmate charter is durable: it is generated in the parent home, copied into the secondmate home as data/charter.md, and read there for the life of that secondmate. It embeds the literal path the secondmate must append its replies to. When FM_HOME was relative, that path was written relative, the secondmate resolved it against its own working directory, and its replies went somewhere the parent never reads — silently. Nothing errored; the reply simply went nowhere.

FM_ROOT was already normalized via cd … && pwd, but a caller-supplied FM_HOME was used verbatim.

What changed

  • bin/fm-brief.sh — normalize before deriving DATA/STATE; absolute inputs early-return unchanged so existing output is byte-identical and symlinks are preserved; unresolvable inputs refuse rather than write a bad path into a file that outlives the mistake.
  • bin/fm-spawn.sh, bin/fm-afk-launch.sh, bin/fm-bootstrap.sh — same treatment at the equivalent cross-process handoffs, where a later process would otherwise reinterpret a relative path from a different working directory.
  • Regression coverage across the affected scripts, including the relative-input reproduction.

Transient relative-home consumers were surveyed and deliberately left unchanged.

Validation

Local pipeline passed with no findings across review, test, document and lint.

sparkus added 4 commits July 29, 2026 11:06
Resolve relative home, data, and state inputs before durable charter generation, and fail when caller-relative directories cannot be resolved.

Use absolute paths at the related spawn, AFK daemon, and X-mode cross-process handoffs so later processes cannot reinterpret them from another working directory.
@sparkus

sparkus commented Jul 29, 2026

Copy link
Copy Markdown
Owner Author

Closing: I raised this by hand, which the repository's own contribution gate correctly rejects — PRs must come through the no-mistakes pipeline so the deterministic Pipeline section is present and the required review/test/lint steps are attested. The underlying change on fm/fix-secondmate-relative-status-path is unaffected and will be re-raised through the pipeline.

@sparkus sparkus closed this Jul 29, 2026
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