Skip to content

Non-Claude hosts: binary-resolver fallback doubles $HOME ($HOME$GSTACK_BROWSE), browse/design/make-pdf never resolve #2055

Closed

Description

@simjak

Summary

For every non-Claude host that uses $GSTACK_* env-var paths (codex, factory, cursor, opencode, slate, kiro, hermes, gbrain), the binary-resolver fallback in the generated SKILL.md files prepends $HOME to a path that is already absolute, producing a doubled-home path that never resolves.

Example from ~/.codex/skills/gstack-qa/SKILL.md:

GSTACK_ROOT="$HOME/.codex/skills/gstack"
GSTACK_BROWSE="$GSTACK_ROOT/browse/dist"
...
[ -z "$B" ] && B="$HOME$GSTACK_BROWSE/browse"     # ← $HOME doubled

$HOME$GSTACK_BROWSE expands to /Users/me/Users/me/.codex/skills/gstack/browse/dist, so the fallback [ -x "$B" ] check fails and the skill reports NEEDS_SETUP / BROWSE_NOT_AVAILABLE even though the binary is present at the correct path.

Impact

  • Affects the global-install fallback branch only (the repo-local .agents/skills/... branch on the line above resolves first), so it bites plain global Codex/Factory/etc. installs, not repo-vendored ones.
  • 18 generated skills across the browse, design, and make-pdf setup blocks. Three doubled patterns:
    • B="$HOME$GSTACK_BROWSE/browse"
    • D="$HOME$GSTACK_DESIGN/design"
    • P="$HOME$GSTACK_MAKE_PDF/pdf"

Root cause

scripts/resolvers/{browse,design,make-pdf}.ts build the fallback as:

B="$HOME${ctx.paths.browseDir.replace(/^~/, '')}/browse"

This assumes browseDir is ~-rooted (true for Claude: ~/.claude/skills/gstack/browse/dist). For env-var hosts ctx.paths.browseDir is "$GSTACK_BROWSE" (see scripts/resolvers/types.ts buildHostPaths() → usesEnvVars branch), so .replace(/^~/, '') is a no-op and $HOME gets prepended to an already-absolute value.

Proposed fix

Add a small helper in scripts/resolvers/types.ts and use it at all 6 call sites:

export function toShellPath(dir: string): string {
  return dir.startsWith('~') ? `$HOME${dir.slice(1)}` : dir;
}

Call sites become e.g. B="${toShellPath(ctx.paths.browseDir)}/browse".

  • Claude: ~/.claude/.../browse/dist → $HOME/.claude/.../browse/dist (byte-identical to today)
  • Env-var hosts: $GSTACK_BROWSE passes through untouched → $GSTACK_BROWSE/browse

Verified locally: tsc --noEmit clean, resolver + make-pdf tests (201) and host-config/golden tests (73) pass, regenerated Codex output now resolves to an existing binary, Claude output unchanged. Golden fixtures unaffected (the ship skill has no binary-resolver block).

Affected call sites: scripts/resolvers/browse.ts:109, scripts/resolvers/design.ts:795,803,840, scripts/resolvers/make-pdf.ts:22.

Env: gstack v1.58.3.0, macOS, ./setup --host codex.

Activity

  1. time-attack commented on Jul 15, 2026

    @time-attack
    Contributor

    @16francej — recommend closing this issue only after PR #2056 lands unchanged. The current global fallback still doubles the home prefix for non-Claude browse, design, and make-pdf resolution. Preserve coverage for every current environment-variable host and for browse, design, design-mockup, and make-pdf fallback paths.

  2. added a commit that references this issue on Aug 15, 2026
    008dd65
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions