Skip to content

Fix five small browse and question-hook bugs - #4192

Merged
capy-ai[bot] merged 9 commits into
mainfrom
five-small-browse-and-question-hook-fixes
Nov 9, 2026
Merged

capy-ai[bot] merged 9 commits into
mainfrom
five-small-browse-and-question-hook-fixes

Conversation

@garrytan

@garrytan garrytan commented Nov 9, 2026 •

Copy link
Copy Markdown
Owner

This fixes five small bugs in gstack's browser commands and its question hooks, so browse scroll, the PDF and diagram renderer, per-project domain skills and never-ask preferences behave the way the docs say. It serves the README's goal of skills a person can rely on without babysitting.

What changed

A question marker with a malformed signal hint used to lose its id (left, main); it now keeps the lowercased id and drops only the bad hint (right)

A question marker with a malformed signal hint used to lose its id (left, main); it now keeps the lowercased id and drops only the bad hint (right).

Before/after as text: A question marker with a malformed signal hint used to lose its id (left, main); it now keeps the lowercased id and drops only the bad hint (right)
--- Before · before.txt · captured output
+++ After · after.txt · captured output
 $ parseQidMarker("<gstack-qid:Ship-X;signal=scope_appetite> Ship now?")
+{"id":"ship-x","stripped":"Ship now?"}
-null
 
  1. browse scroll <selector> keeps its selector when --wait is absent. The old parser read the first argument as the --wait value, so scroll footer scrolled to the page bottom (browse/src/write-commands.ts).
  2. The renderer skips a browse on PATH whose real file has another name, such as Debian and Ubuntu's /usr/bin/browse link to xdg-open, instead of launching a desktop opener (lib/aside-render.ts).
  3. On installs without ~/.claude, the browse daemon gives each project its own domain-skill file. It tries the checkout's own gstack-slug, then the Claude install's, then the git remote rule, instead of one shared "unknown" bucket (browse/src/project-slug.ts).
  4. A question marker with a malformed ;signal= hint keeps its id and drops only the hint (scripts/qid-marker.ts).
  5. The never-ask hook reads the lowercased marker id, as the log hook and stored preferences already do (hosts/claude/hooks/question-preference-hook.ts).

Why

Each fix comes from a bug the crew hit: "scroll footer" replied "Scrolled to bottom", a Debian machine opened a desktop app instead of rendering, a Codex install mixed every repository's domain skills, and a silenced question was asked again because its marker had capitals or a bad hint. After this, those commands and preferences do what they say. Review found that widening the marker pattern let text inside a marker skip the one-way door check, so two follow-up commits keep that text in the check, spaced apart from the next word.

Blast radius

The scroll parser, the PATH lookup and the slug lookup are each one function with their own tests. The marker change reaches both Claude hooks through parseQidMarker, and the never-ask gate and the spawned deny path now classify the marker's tail text too, so any change there only makes the hook ask more often; the red/green tests in test/question-preference-hook.test.ts and a probe of classifyQuestion showed that (script ran). Security read: the slug fix runs a local gstack-slug script (the checkout's own bin/gstack-slug, then ~/.claude's) through execFileSync with no shell and a 2 s timeout; there is no network use, no credentials, and no install, upgrade or workflow change. One small risk in fix 2: a PATH wrapper whose real file has another name is now skipped, and the renderer reports that no browser was found.

Summary

Five one-commit bug fixes, each with a test that fails on main, plus two review fixes to the one-way door check and a docs note on where domain skills live. This is crew work.

Test Coverage

Coverage: deterministic (each of 5 changed runtime files has a changed test naming it; no audit reader).
Regression proof: each fix's test fails on main 10fc9b1 and passes on this branch. The two review-fix tests failed on the hook before each fix and pass after it.
Tests ran: free (carried from CI; see Test plan)

Pre-Landing Review

Pass 1 (full panel, gate class): 3 issues — 0 auto-fixed, 2 asked (0 fixed, 2 skipped), 0 deferred, 1 noted. The Step 11 targeted reader found one blocker, fixed in "Keep a marker's tail in the one-way door check". Pass 2 (full panel on the range): clean, 3 notes. Its Step 11 voices found one blocker in that fix (the tail joined the next word), fixed in "Keep a marker's tail apart from the next word in the one-way door check" and checked by one granted fix-check reader plus the targeted reader: no findings.

Gate edits: none detected (7 listed, 2 read; patterns: RH-1,RH-3,RH-4,RH-12,RH-13,RH-14,RH-15,RH-16; unlisted idioms: none)

Outside review: openai/gpt-6.1-sol as a host subagent. Pass 1: VERDICT: CLEAN. Pass 2: one finding, fixed.

Review notes

Below the blocking floor; recorded here and not fixed in this PR. Follow-ups:

  • Option labels and the marker id never reach the never-ask gate's keyword check. <gstack-qid:adhoc-x> Proceed? with A) Force-push to main (recommended), or an unregistered id like force-push-main, can still auto-decide under a never-ask preference. This already happens on main; it is the same class as the fixed tail bug.
  • The Codex session importer (bin/gstack-codex-session-import:141) keeps its own copy of the old strict marker regex and does not lowercase the id, so a malformed hint still loses its id on that path.
  • No test covers a destructive marker tail on the spawned-session deny path (hosts/claude/hooks/question-preference-hook.ts:518); its code matches the tested never-ask gate.
  • The auto-decided question log still drops the marker tail text (the qText at :475 and :517).
  • When no gstack-slug runs (native Windows, or a 2 s timeout), the slug fallback uses getRemoteSlug() rather than slugFromEnvironment() from lib/bin-context.ts, so it ignores .gstack-project markers and the outer-root walk; no test reaches that branch.
  • Domain skills saved before this change stay in ~/.gstack/projects/unknown/learnings.jsonl; the changelog and docs/domain-skills.md say so, and nothing moves them.
  • The PATH check looks only at the first browse on PATH and checks only its file name.
  • The first slug lookup can block the daemon for up to about 6 s (two 2 s script calls plus git), once per daemon.

Exploratory QA

Functional smoke (report-only, 3 of 12 probes, 300 s budget): all pass on current inputs. The qid marker keeps the lowercased id with a malformed hint and keeps a valid hint; a PATH browse linked to xdg-open resolves to nothing while a real browse still resolves; with no ~/.claude, a repository with origin acme/widgets gets the slug acme-widgets. Not run live: browse scroll (needs a browser; covered by browse/test/commands.test.ts) and the never-ask hook end to end (covered by its tests).

Design Review

No frontend files changed — design review skipped.

Eval Results

No prompt-related files changed — evals skipped. eval:select's dependents profile lists probes through scripts/qid-marker.ts references; none were run.

Scope Drift

Scope Check: CLEAN

Plan Completion

Plan completion audit: not run (no plan is bound to this branch and no docs/designs/ file matches). Bug fixes skip plan review; each carries a failing-first test.

Verification Results

No plan verification items. Exploratory smoke: 3 PASS, 0 FAIL, 0 BLOCKED.

TODOS

Completed: the plan-tune qid marker follow-ups item (#3442 review notes) is removed from TODOS.md, since fixes 4 and 5 ship it.

Documentation

Status: updated. One factual edit, no blockers.

Scope: base 10fc9b1 to head 67df822 on five-small-browse-and-question-hook-fixes (8 commits, 12 files: browse scroll parsing, the PATH browse check in the renderer, per-project browse slug, qid-marker hint parsing, and never-ask hook id lowercasing). There were no staged, unstaged or untracked changes.

Documentation health:

  • docs/domain-skills.md: Updated. Storage now says how the project slug is resolved and where rows saved by older builds sit (projects/unknown).
  • BROWSER.md: Current. The scroll command row matches the fixed behavior.
  • browse/sections/command-list.md: Current.
  • ARCHITECTURE.md: Current. It does not describe the PATH browse lookup.
  • changelog.d/five-small-browse-and-question-hook-fixes.md: Reviewed and consistent with the code; not edited.
  • TODOS.md: Reviewed. The removed qid-marker item matches the fix; not edited.

Coverage debt: no critical gaps. One common gap: the renderer rule that skips a PATH browse whose real file has another name (for example Debian and Ubuntu's xdg-open link) is documented only in source comments and the changelog. The qid-marker and hook changes are internal. There is no architecture diagram drift.

Test plan

  • bun run test (free suite): carried from Free Tests run 42570140462 at this tree (tree bfc52c392e04, head 79b69fe), 1651 files, exit 0 (EVIDENCE: FRESH).
  • Focused at c73852a: bun --no-env-file test test/question-preference-hook.test.ts test/qid-marker.test.ts test/hook-log.test.ts: 55 pass, 0 fail. bun run typecheck: exit 0.
  • Focused at 095e1fd (parent): aside-render, project-slug, qid-marker, question-preference-hook and neighbors 147 pass, 2 skip, 0 fail; browse/test/commands.test.ts under xvfb 256 pass, 0 fail.
  • windows-smoke run 42570921595 at 79b69fe: success. macOS jobs in run 42570140462: success.

This is crew work by the GStack Minder crew (GSTA-429).

Agent notes

Refs GSTA-429
Refs p1/targeted#1
Refs p2/adversarial-native#1
Refs p2/outside-voice#1

Approvals

Approved: yes (record r-062a94bcd83d). The full approval record stays private: this repository is public or its visibility is unknown.
Plan: exempt: bug fix
Plan check: exempt bug fix

Review fix-check grant: a-5730afc7c802 (review_loop_grant at 8ecc77b).

REVIEW_LOOP: passes=2 blocking_found=3 deferred=0 noted=4 fixed=3 scope=frozen ledgers_read=4 fix_checks=1 dispatches=4 est_input_tokens=16001
Gate edits: none detected (7 listed, 2 read; patterns: RH-1,RH-3,RH-4,RH-12,RH-13,RH-14,RH-15,RH-16; unlisted idioms: none)

{
  "schema_version": 1,
  "pr": 4192,
  "head": "79b69fe13245606335522516b54c1c41a9896964",
  "version": "1.98.0.0",
  "base": "main",
  "gate": {
    "free": {
      "pass": 1651,
      "fail": 0,
      "skip": 0
    }
  },
  "ci_carried": [
    {
      "lane": "free",
      "run": 42570140462,
      "attempt": 1,
      "tree": "bfc52c392e04778e31be57d1224d01af9c8a1e49"
    }
  ],
  "session_kind": "unattended",
  "head_tree": "bfc52c392e04778e31be57d1224d01af9c8a1e49",
  "product_patch_id": "904d15b111b94bdd81319e21251d38b35c7d36df",
  "gstack_version": "1.98.0.0",
  "review_depth": {
    "depth": "full",
    "class": "gate",
    "runtime_lines": 93,
    "rules": "66e5174161eecc2c",
    "base": "10fc9b1eab44bc5bb5422bcb3f2f68d3dd381659",
    "registry": "10fc9b1eab44bc5bb5422bcb3f2f68d3dd381659",
    "gate_scan": {
      "tagged": 1,
      "head": "79b69fe13245606335522516b54c1c41a9896964"
    },
    "reasons": [
      "gate-class",
      "risk:security",
      "runtime=93"
    ],
    "risk": [
      "security"
    ],
    "mode": "panel"
  },
  "pregate": "requires-remote cleared @bfc52c392e04 (8 checks, current for 79b69fe13245)",
  "requires_remote": [
    "free-tests.yml/cso-macos-launcher: https://github.com/garrytan/gstack/actions/runs/42570140462/attempts/1",
    "free-tests.yml/macos-named-regressions: https://github.com/garrytan/gstack/actions/runs/42570140462/attempts/1",
    "windows-smoke.yml/windows-smoke: https://github.com/garrytan/gstack/actions/runs/42570921595/attempts/1",
    "pregate.json/remote_gate: remote-gate tree=bfc52c392e04 tests=36744 skipped=105 runs=42570140462/1 profiles=ci-reuse/free-tests heads=79b69fe13245 verified=2026-11-09T06:04:08.126Z"
  ],
  "issues": {
    "fixes": [],
    "refs": [],
    "flakes": []
  },
  "docs": {
    "status": "updated",
    "scope": "README.md, AGENTS.md, CLAUDE.md, docs/, browse/SKILL.md plus BROWSER.md, ARCHITECTURE.md and browse/sections/command-list.md read by the auditor"
  },
  "review_loop": {
    "passes": 2,
    "blocking_found": 3,
    "deferred": 0,
    "noted": 4,
    "fixed": 3,
    "scope": "frozen",
    "fix_checks": 1,
    "rounds": 3,
    "est_input_tokens": 16001,
    "ledgers_read": 4,
    "dispatches": {
      "specialist-batched": 2,
      "red-team": 2
    }
  },
  "review_targeted": {
    "classes": [
      "gate"
    ],
    "rules": "8811fd300bf305f0",
    "brief_sha": "7f92a0d0a8319c3c0e076fb3b1a4689c45120b2be2c14dfc7d4cb03aafa9d6a5",
    "product_patch_id": "904d15b111b94bdd81319e21251d38b35c7d36df",
    "status": "done",
    "findings": 0,
    "raised_by": "targeted"
  }
}

garrytan and others added 9 commits November 9, 2026 05:13
Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
Review-Finding: p1/targeted#1 reader=targeted
Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
Review-Finding: p2/outside-voice#1 reader=outside-voice
Review-Finding: p2/adversarial-native#1 reader=adversarial-native
Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
…angelog

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
@trunk-io

trunk-io Bot commented Nov 9, 2026 •

Copy link
Copy Markdown

😎 This pull request was merged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant