fix: stop env-var hosts from doubling $HOME in binary-resolver fallback#2056
Open
simjak wants to merge 1 commit into
Open
fix: stop env-var hosts from doubling $HOME in binary-resolver fallback#2056simjak wants to merge 1 commit into
simjak wants to merge 1 commit into
Conversation
Non-Claude hosts (codex, factory, cursor, opencode, slate, kiro, hermes,
gbrain) resolve the browse/design/make-pdf binaries through absolute
$GSTACK_* env vars. The setup blocks built the global-install fallback as
`$HOME${dir.replace(/^~/, '')}/bin`, which assumes a ~-rooted dir. For
env-var hosts `dir` is already `$GSTACK_BROWSE` (absolute, contains $HOME),
so $HOME got prepended twice — e.g. `$HOME$GSTACK_BROWSE/browse` expands to
/home/me/home/me/.codex/.../browse and never resolves, leaving the skill
stuck on BROWSE_NOT_AVAILABLE / NEEDS_SETUP even when the binary is built.
Add toShellPath() in resolvers/types.ts: ~-rooted dirs expand via $HOME,
absolute env-var dirs pass through untouched. Applied at all six call
sites in browse.ts, design.ts, make-pdf.ts.
Claude output is byte-identical; env-var hosts now emit $GSTACK_BROWSE/browse.
tsc clean; resolver + make-pdf + golden host-config suites pass (270).
|
Merging to
After your PR is submitted to the merge queue, this comment will be automatically updated with its status. If the PR fails, failure details will also be posted here |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #2055.
Problem
Every non-Claude host that resolves binaries through
$GSTACK_*env vars (codex, factory, cursor, opencode, slate, kiro, hermes, gbrain) ships a binary-resolver fallback that doubles$HOME, so the global-install fallback path never resolves. The skill reportsNEEDS_SETUP/BROWSE_NOT_AVAILABLE/DESIGN_NOT_AVAILABLEeven when the binary is built and present.Reproduction
$GSTACK_BROWSEis defined earlier in the same preamble as an absolute path:so
$HOME$GSTACK_BROWSE/browseexpands to/Users/me/Users/me/.codex/skills/gstack/browse/dist/browse— a doubled$HOMEthat does not exist:The repo-local branch on the line above (
$_ROOT/.agents/skills/.../browse) resolves first, so this only bites plain global installs, not repo-vendored ones — which is exactly the common Codex/Factory case.Scope
18 generated skills, three patterns across the browse/design/make-pdf setup blocks:
Root cause
scripts/resolvers/{browse,design,make-pdf}.tsbuild the fallback as:This assumes
browseDiris~-rooted — true for Claude (~/.claude/skills/gstack/browse/dist), where stripping~and prepending$HOMEis correct. But for env-var hostsbuildHostPaths()(scripts/resolvers/types.ts) setsbrowseDir = "$GSTACK_BROWSE", so.replace(/^~/, '')is a no-op and$HOMEis prepended to an already-absolute value.Fix
One shared helper in
scripts/resolvers/types.ts, applied at all six call sites:~/.claude/.../browse/dist) →$HOME/.claude/.../browse/dist— byte-identical to today.$GSTACK_BROWSE) → passes through untouched →$GSTACK_BROWSE/browse.Before / after (regenerated
gstack-qa)Verification
bun run scripts/gen-skill-docs.ts --host all→ 0 remaining$HOME$GSTACK*occurrences across.agents/.factory/.opencode/.cursor.$GSTACK_BROWSE/browseresolves to an existing binary.tsc --noEmitclean.bun test test/resolver-entry.test.ts test/host-config.test.ts make-pdf/test/→ 270 pass, 0 fail (goldenshipfixtures unaffected —shiphas no binary-resolver block).Call sites changed
scripts/resolvers/types.ts— addtoShellPath()scripts/resolvers/browse.ts:109scripts/resolvers/design.ts:795,803,840scripts/resolvers/make-pdf.ts:22No generated/host output is committed (
.agents/et al. are gitignored); CI regeneration picks up the source change.