Skip to content

setup re-registers the timeline Stop hook on every run with no config gate — --no-team doesn't persist #2677

Closed

Description

@dk96-creator

Summary

./setup registers the gstack-timeline-stop Stop hook into ~/.claude/settings.json
unconditionally on every run. There is no config key to decline it, and the only
documented off-switch — ./setup --no-team — is a one-shot teardown that does not
persist, so the hook returns on the next setup or /gstack-upgrade.

This is the one hook registration in setup with no consent gate. plan-tune-cathedral
already has a well-built three-tier one (#2631), and I think the timeline hook just never
got the equivalent.

Verified on 85fd9db (v1.68.3.0).

Reproduction

./setup                                                    # Stop hook registered
bin/gstack-settings-hook remove-source --source gstack-timeline-stop
./setup                                                    # Stop hook is back
./setup --no-team                                          # removed, team_mode:false persisted
./setup                                                    # Stop hook is back again

Why --no-team isn't the off-switch

NO_TEAM_MODE is derived from the CLI flag alone and is never re-read from the config it
just wrote:

setup:173-174   TEAM_MODE=0
                NO_TEAM_MODE=0
setup:187-188   --team)    TEAM_MODE=1 ;;
                --no-team) NO_TEAM_MODE=1 ;;

--no-team persists the preference (setup:2038 → gstack-config set team_mode false),
but nothing reads team_mode back into NO_TEAM_MODE on a later run — grep for reads of
that key in setup returns only writes. So the registration guard at setup:2401:

if [ "$NO_TEAM_MODE" -ne 1 ] && [ -x "$SETTINGS_HOOK" ] && [ -n "$TIMELINE_STOP_HOOK" ]; then

is always true on a bare invocation. And gstack-upgrade/SKILL.md invokes plain ./setup
at four call sites (lines 141, 166, 177, 217), never with the flag — so every upgrade
re-registers it.

Net effect: a user who removes the hook has it silently restored by their next upgrade.

Why this is worth a gate

~/.claude/settings.json is user-owned configuration shared with every other tool and hook
the user runs. In environments where hook and settings changes are approval-gated, a
registration that reappears on each upgrade reads as an unapproved mutation each time —
even though the hook itself is fail-open and harmless (F5, always exits 0).

Related, and to be clear it's already fixed: before v1.68.1.0 the removal also failed
silently, because Claude Code strips the unknown _gstack_source key on rewrite and
tag-matching remove-source then matched nothing and exited 0. The KNOWN_HOOKS identity
work in #2631 fixed that properly — removal is reliable now. Which is exactly what makes
the recurrence the remaining gap: the user can finally remove it, but can't keep it removed.

Proposed fix

Mirror the plan_tune_hooks resolution already in the file (setup:2196-2222) — CLI flag >
env var > config key with gstack-config has for provenance > default-yes:

  • timeline_stop_hook: false in ~/.gstack/config.yaml
  • GSTACK_TIMELINE_STOP_HOOK=no
  • ./setup --no-timeline-stop-hook

Default stays yes, so nothing changes for existing users. When the key is explicitly
no, skip registration and prune any live entry — the same shape as the
plan_tune_hooks:no-vs-live-hooks reconciliation at setup:1979-1984.

A smaller alternative, if a new key isn't wanted: have NO_TEAM_MODE initialize from the
persisted team_mode config instead of 0, which would make --no-team mean what its
--help text implies. That changes existing behavior for anyone who ran --no-team
expecting a one-time teardown, so the explicit key seems safer.

Environment

  • gstack 85fd9db (v1.68.3.0), installed at ~/.claude/skills/gstack
  • Host: Claude Code, macOS
  • auto_upgrade: false, telemetry: off

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