Skip to main content
← Back to list
01Issue
BugShippedExtensionsPublic
Assigneeshammz

Relationships

#2812 serve: a relative grants-dir resolves against the working directory, not the repository

Opened by hammz · 9/30/2026· Shipped 10/1/2026

Summary

A relative grants-dir (from --grants-dir, SWAMP_GRANTS_DIR, or grants-dir: in .swamp/serve.yaml) is resolved against the process working directory, not the repository directory. The same serve config therefore loads different grants depending on where swamp serve was started from. For a daemon, it depends on the working directory the service manager uses.

Where

  • src/cli/commands/serve.ts (around line 3344): isAbsolute(merged.grantsDir) ? merged.grantsDir : resolve(merged.grantsDir). resolve() uses Deno.cwd(), not resolvedRepoDir.
  • src/cli/commands/serve.ts:830: serve daemon install builds the daemon arguments with args.push("--grants-dir", options.grantsDir) and passes a relative path through unchanged. The launchd/systemd service then resolves it against the daemon's own working directory, which need not be the directory where daemon install ran.
  • --grants-file probably behaves the same way and should be checked alongside.

Steps to reproduce

  1. Put grants-dir: grants in <repo>/.swamp/serve.yaml.
  2. Run swamp serve --repo-dir <repo> from a directory other than <repo>.
  3. Serve either fails with "External grants directory not found: /grants", or loads a different directory that happens to exist there.

Expected

A relative grants-dir in the repository's serve config resolves against the repository directory. A relative CLI flag either does the same or is made absolute at daemon install time, so a daemon loads the same directory the operator named. Whichever rule is chosen should be documented in the --grants-dir help text and the serve-flags manual page.

Context

Found while triaging swamp-club#2788 (grants-dir files tracked under two source keys). The fix for #2788 compares directory identity, so the duplication is handled whichever base is used. The resolution base is a separate problem.

02Bog Flow
✓OPEN✓TRIAGED✓IN PROGRESS✓SHIPPED+ 1 MOREASSIGNED+ 2 MOREREVIEW+ 7 MOREPR_MERGED+ 2 MORESESSION_SUMMARIZED

Shipped

10/1/2026, 4:57:18 PM

Click a lifecycle step above to view its details.

03Sludge Pulse
hammz assigned hammz10/1/2026, 3:42:24 PM

Sign in to post a ripple.