Skip to content

gstack: artifacts auto-sync silently broken due to unexpanded ~ in double-quoted bash variable assignments #1715

Closed

Description

@aicloud-cpu

Bug: Bash tilde expansion fails inside double-quoted variable assignments in gstack skill preamble, preventing artifacts auto-sync on all skill invocations

Description

On Windows (Git Bash), the gstack skill preamble's artifacts sync logic silently never runs. The ~ in double-quoted variable assignments is not resolved to the home directory path.

This means gstack-brain-sync --once is never called at skill boundaries, so cross-machine artifact synchronization (checkpoints, learnings, timeline, etc.) does not happen automatically.

Root Cause

In Bash, tilde expansion only occurs when ~ is at the beginning of an unquoted word. Inside double-quoted variable assignments, ~ is treated as a literal character.

Lines 369-370 in every SKILL.md preamble:

_BRAIN_SYNC_BIN="~/.claude/skills/gstack/bin/gstack-brain-sync"
_BRAIN_CONFIG_BIN="~/.claude/skills/gstack/bin/gstack-config"

When $_BRAIN_CONFIG_BIN is later invoked:

_BRAIN_SYNC_MODE=$("$_BRAIN_CONFIG_BIN" get artifacts_sync_mode 2>/dev/null || echo off)

The shell tries to execute the literal path ~/.claude/... (which doesn't exist as a literal file path), the command fails, and artifacts_sync_mode falls back to off. This causes all subsequent sync conditions to evaluate to false.

The same issue affects the end-of-skill sync commands in the Telemetry section:

"~/.claude/skills/gstack/bin/gstack-brain-sync" --once 2>/dev/null || true

Impact

  • Every gstack skill invocation (/context-save, /qa, /ship, /plan-*, /review, etc.) silently skips the artifacts sync
  • Cross-machine artifact sharing via the gstack artifacts git repo (gstack-record) never works automatically
  • No user-visible error — all || true / 2>/dev/null patterns swallow the failure silently
  • This has been broken since the artifacts sync feature was introduced

Affected Files

All 92 SKILL.md files across two directories:

  • ~/.claude/skills/*/SKILL.md (46 files — loaded by Claude Code at runtime)
  • ~/.claude/skills/gstack/*/SKILL.md (46 files — gstack distribution copies)

Affected skills include: autoplan, benchmark, benchmark-models, browse, canary, codex, context-restore, context-save, cso, design-consultation, design-html, design-review, design-shotgun, devex-review, document-generate, document-release, health, investigate, ios-clean, ios-design-review, ios-fix, ios-qa, ios-sync, land-and-deploy, landing-report, learn, make-pdf, office-hours, open-gstack-browser, pair-agent, plan-ceo-review, plan-design-review, plan-devex-review, plan-eng-review, plan-tune, qa, qa-only, retro, review, scrape, setup-browser-cookies, setup-deploy, setup-gbrain, ship, skillify, sync-gbrain

Fix

Change "~/.claude/..." to "$HOME/.claude/..." in two places in the preamble template and the end-of-skill telemetry section.

In the Artifacts Sync preamble section:

- _BRAIN_SYNC_BIN="~/.claude/skills/gstack/bin/gstack-brain-sync"
- _BRAIN_CONFIG_BIN="~/.claude/skills/gstack/bin/gstack-config"
+ _BRAIN_SYNC_BIN="$HOME/.claude/skills/gstack/bin/gstack-brain-sync"
+ _BRAIN_CONFIG_BIN="$HOME/.claude/skills/gstack/bin/gstack-config"

In the end-of-skill Telemetry section:

- "~/.claude/skills/gstack/bin/gstack-brain-sync" --once 2>/dev/null || true
+ "$HOME/.claude/skills/gstack/bin/gstack-brain-sync" --once 2>/dev/null || true

Verification

After fixing, the preamble correctly shows ARTIFACTS_SYNC: mode=full | ... instead of ARTIFACTS_SYNC: off. Git status on ~/.gstack/ confirms that gstack-brain-sync --once modified learnings.jsonl, timeline.jsonl, and .brain-queue.jsonl.

Environment

  • OS: Windows 11 (Git Bash)
  • Shell: Bash (via Git for Windows)

Activity

  1. time-attack commented on Jul 15, 2026

    @time-attack
    Contributor

    @16francej — recommend closing this issue because #1656 is the earlier report of the same generated-artifact synchronization defect. #1692 owns the generator repair, so discussion should continue there. Please retain the original attribution and generated-file count under #1656.

  2. capy-ai commented on Oct 3, 2026

    @capy-ai
    Contributor

    The skill preamble no longer assigns quoted "~/.claude/..." brain-sync paths; artifacts sync runs inside bin/gstack-skill-start, and no generated skill preamble carries the quoted-tilde brain-sync lines.

    Fixed in v1.64.0.0 (#2571).
    If you still see this on the latest gstack, please reopen with details.

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

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions