mirror of
https://github.com/garrytan/gstack.git
synced 2026-08-20 21:17:19 +02:00
1cab5e11083a37ea0bc62117e9a9c5d05d68785e
2
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
c118e2402e |
v1.64.1.0 v1.64.1.0: the code-smell fix wave — every pipeline guard now provably fires (net −24,943 lines) (#2572)
* fix(ci): skill-docs freshness gate covers all 10 hosts and can actually fail The Codex/Factory gates ran 'git diff --exit-code -- .agents/' / '-- .factory/', but both paths are gitignored (.gitignore:16-17) — git diff on ignored untracked paths is always empty, so those two gates were structurally incapable of failing and 7 of 10 hosts had no gate at all. New shape: one 'gen:skill-docs --host all' pass (the generator hard-fails on any per-host error, gating all 10 hosts on generates-cleanly), byte-freshness via git diff for tracked output, plus a porcelain check that fails on untracked generated strays (git diff can't see brand-new files). The gitignored-hosts byte-freshness limitation is documented in the workflow comment. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> * fix(test): exorcise the sidebar-agent ghost from the test suite browse/src/sidebar-agent.ts was deleted in the v1.14 sidebar refactor, but the test suite kept testing it for 48 versions. Nothing noticed because the free suite runs in no CI job and Bun-era module-load errors were suppressed in the Windows shard runner via an exclusion pattern whose own comment documented the breakage ('broken on every platform since v1.14 ... exit 0'). - Delete sidebar-security.test.ts + security-source-contracts.test.ts: crashed at module load (unguarded readFileSync of the deleted file); per-assertion triage confirmed every SERVER_SRC pin targeted the deleted chat prompt builder (zero hits in today's server.ts) — nothing to port. - Delete sidebar-integration.test.ts: 11 of 13 tests exercised deleted endpoints (/sidebar-command queue, /sidebar-agent/event, chat buffer); the 2 passing tests pinned only the blanket auth gate, covered by server-auth.test.ts + dual-listener.test.ts. - Delete test/skill-e2e-sidebar.test.ts: E2E for the deleted queue flow. - sidebar-ux.test.ts 1,669 -> 830 lines: 20 dead-chat describes + 15 dead tests removed (incl. 10 vacuous passes asserting on empty indexOf slices); 2 stale pins on LIVE features fixed (content.js typed-catch CSSOM fallback, arrow-hint window widened). 95 pass / 0 fail. - sidebar-tabs.test.ts: both failures were stale pins, not regressions — forceRestart's deliberate ws.close(4001) and the terminal-agent spawn that moved into spawnTerminalAgent() (identity-based kill refactor). 28 pass. - touchfiles.ts: drop the three sidebar E2E entries from BOTH maps (E2E_TOUCHFILES + E2E_TIERS) — they pointed diff-selection at the deleted file, so those tests were unreachable by any diff. - test-free-shards.ts: remove the now-dead sidebar-agent exclusion pattern. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> * feat(ci): run the free test suite in CI (it ran nowhere) The full free suite (bun test: browse/test/ + test/ + make-pdf/test/) had no CI job on any Linux/macOS runner — only Windows curated shards, paid evals, and doc-freshness gates existed. That's how two module-load-crashing test files survived 48 versions. Same cached Dockerfile.ci image and container wiring as evals.yml (deps restore, build, Chromium verify). Includes a module-load-error guard: older Bun reported test-file import crashes with exit 0 on macOS/Linux, so the job also fails on any nonzero 'N errors' count in the summary — future crash-class regressions can't hide from the exact job built to catch them. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> * feat(test): validate touchfile dependency paths exist on disk New guard in touchfiles.test.ts: every non-glob dep path must exist, and every glob's anchor directory must exist. This is the axis the 181-key two-map sync discipline never covered — an entry can point at a long-deleted file and diff-based selection then silently never triggers those tests (the sidebar trio sat rotted for 48 versions). First run immediately caught a fourth rotted entry: 'spec authored quality' referenced test/fixtures/spec/** (directory does not exist) and selected for a judge test that exists nowhere in the repo. Removed. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> * fix(security): remove deleted /sidebar-chat endpoint from tunnel allowlist TUNNEL_PATHS is the audited tunnel attack surface — its own comment says every addition widens it. '/sidebar-chat' stayed in the set after the endpoint was deleted with the chat-queue path, meaning any future route matching that path would have been silently tunnel-exposed. The set is now exactly the pair ceremony (/connect) and the scoped command endpoint (/command), and the dual-listener closed-set pin enforces that. Also repairs a pre-existing red pin in dual-listener.test.ts: v1.63.0.0 made the tunnel allowlist args-aware (canDispatchOverTunnel gained a second param) without updating the test — red on main since then, invisible because the free suite had no CI job. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> * fix(security): delete chain's shadow dispatcher that skipped every security gate meta-commands.ts carried a 'CLI mode' fallback that re-implemented command routing without the server pipeline's gates: no scope check, no domain check, no tab ownership, no rate limit, no hidden-element stripping, no scoped-token enveloping — and it called handleReadCommand without a BrowserManager, which also skipped the JS-origin cookie-exfiltration assertion. It was unreachable in production (server.ts always passes executeCommand) and one boolean away from being live. chain now hard-errors without a server context. handleReadCommand's bm param is required and assertJsOriginAllowed runs unconditionally. The chain tests that exercised the deleted fallback now route through a server-shaped executeCommand adapter (real handlers + trust wrapping + {status,result} envelope), so their behavioral coverage — sequencing, trust markers, pipe format, aliases, error reporting — survives on the production-shaped path. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> * fix(extension): delete the dead chat-queue client surface The sidebar-command handler in background.js POSTed to a server endpoint that no longer exists (deleted with the chat queue) — ~35 lines of fully-wired dead code including error handling for the permanent 404, plus its allowlist entry. No sender in the extension ever emitted the message type. chatEnabled leaves the /health contract (server hardcoded false, background.js re-derived it, nothing consumed it — the chat input element it guarded is gone from sidepanel.html). BROWSE_SIDEBAR_CHAT env flag had zero readers. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> * fix(security): delete dead exports the ripped chat path left behind Three-way split by importer class: (a) Zero importers, deleted: the whole attack-attempt logging cluster in security.ts (logAttempt, AttemptRecord, salted hashPayload + device-salt, attempts.jsonl rotation, telemetry spawn plumbing incl. buildTelemetrySpawnCommand/resolveBashBinary — the LIVE attempts.jsonl writer is tunnel-denial-log.ts with its own rotation); the decision-file handshake (writeDecision/readDecision/clearDecision/excerptForReview — written for sidebar-agent's poll loop, which no longer exists); sidebar-utils.ts (whole module — its sanitizeExtensionUrl 'sanitized before embedding in a prompt' for the deleted prompt builder); 8 dead server.ts imports (sanitizeExtensionUrl, generateCanary, injectCanary, writeDecision, rotateRoot, serializeRegistry, restoreRegistry, clearAgentRecord); buildPtyClearCookie + buildSseClearCookie; WEBDRIVER_MASK_SCRIPT (orphaned by the D7 stealth narrowing — applyStealth never used it). (b) Dead-pin tests edited with their exports: the 'still exported' pin in stealth-layer-c, the string-content describe in stealth-webdriver (its live applyStealth behavioral coverage untouched), the clear-cookie assertions, security-review-flow.test.ts deleted whole (all 4 describes exercised the dead decision mechanism, incl. a 'simulated sidebar-agent poll loop'). (c) KEPT deliberately: leaseCount (live behavioral coverage), extractPtyCookie + validatePtySessionToken (extractPtyCookie is adopted by the terminal-agent cookie-parse unification later in this wave), resetSessionMarker + clearContentFilters (test-support API for the live content-security layer). Also fixes two pre-existing red pins found while here, invisible until the free suite got a CI job: the v1.44 spawnClaude->maybeSpawnPty rename in terminal-agent.test.ts, and a cross-file test-isolation bug where content-security.test.ts's clearContentFilters() wiped the auto-registered url-blocklist filter for every later file in the same bun process (security-integration.test.ts failed on co-run; afterAll now restores it). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> * fix(security): delete the dead ML layers — transcript classifier and DeBERTa ensemble The L4b Haiku transcript classifier and the opt-in DeBERTa ensemble (GSTACK_SECURITY_ENSEMBLE=deberta, a documented 721MB download) had ZERO production callers since the chat-path agent that invoked them was ripped. The only live ML path is scanPageContent (testsavant) inside the security sidecar subprocess. Deleted by import graph: - security-classifier.ts 614 -> 265 lines: HAIKU_MODEL, checkTranscript, shouldRunTranscriptCheck, loadDeberta, scanPageContentDeberta, ToolCallInput, all DEBERTA_* consts + load state. Header now states the live truth (imported only by security-sidecar-entry.ts). downloadFile kept, name intact — it is an enumerated egress sink (HF model download). - security-bunnative.ts + test: a research skeleton self-described as 'NOT a production replacement', shipped into src/ with zero importers. - security-bench-ensemble{,-live}.test.ts + the Haiku response fixture: a paid live-model benchmark for a layer that could not fire. The security-classifier-tdz test's only case exercised checkTranscript — gone. - security.ts: layer-model header rewritten to the live architecture; StatusDetail.layers -> {testsavant, canary}; getStatus() no longer requires the impossible transcript==='ok' for 'protected' (old on-disk session state with a transcript key is tolerated on read, never re-emitted). - security-sidecar-entry.ts needed zero changes: it serializes getClassifierStatus() verbatim and no consumer read .transcript (verified in sidecar-client + server.ts). - BROWSER.md security section matches reality (ensemble knob gone, 112MB not 22MB, sidecar hosting documented). combineVerdict/THRESHOLDS retained as the pure, tested combiner of record — comments now flag transcript/deberta votes as producer-less. Net: 26 pass in security.test.ts incl. a NEW regression test for stale- transcript disk tolerance; egress-receipt tripwire green. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> * docs: scrub the sidebar-agent ghost from comments and CLAUDE.md 20+ comments across 10 files still described the deleted sidebar-agent.ts as a live process — including load-bearing architecture claims ('IMPORTED ONLY BY sidebar-agent.ts', 'sidebar-agent fills this in on first prompt-injection load', 'kill sidebar-agent' in shutdown docs) and ~60 lines of tombstone blocks in server.ts enumerating deleted identifiers by name (a false grep surface: searching processAgentEvent hit server.ts and looked live). CLAUDE.md's security-stack section now documents the LIVE architecture: L1-L3 content filters + testsavant via the security sidecar subprocess; the L4b/ensemble rows, the GSTACK_SECURITY_ENSEMBLE knob, and the 721MB DeBERTa download are gone (deleted as dead code this wave) with an explicit do-not-re-document note; attempts.jsonl is correctly attributed to tunnel-denial-log.ts; the no-live-writer status of classifierStatus is stated. Comments that survive now describe what IS, not what WAS: the promotion gate in domain-skills.ts explains why classifier_score>0 is load-bearing given no L4 load-time scan exists; file-permissions.ts names real sensitive files. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> * fix(gen): delete the codex-helpers shadow module gen-skill-docs.ts imported externalSkillName (unaliased) from resolvers/codex-helpers.ts at line 21 and then re-declared the same function locally — the import was silently shadowed, and the imported copy was the STALE one (it lacked the frontmatterName param the local copy grew). Three more functions were byte-identical duplicates, imported only under _-prefixed aliases to keep the module 'referenced', and transformFrontmatter was a superseded hardcoded-Codex variant. Nothing else imported the module. Also drops three dead top-of-file imports (COMMAND_DESCRIPTIONS, SNAPSHOT_FLAGS — which pulled the whole browse/src module graph into every generator run for nothing — and an unused review-resolver trio). Proof: bun run gen:skill-docs exits 0 with a byte-identical tree (zero-diff regen); gen-skill-docs.test.ts 405/405 green. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> * fix(server): delete ServerConfig.idleTimeoutMs + chromiumProfile — documented, never read Both fields carried JSDoc asserting embedder behavior that did not exist: the idle check reads the module-level IDLE_TIMEOUT_MS env constant, and both resolveChromiumProfile() call sites pass no argument. Worse than absent — an embedder passing idleTimeoutMs: 5000 silently got 30 minutes. Wiring them honestly is impossible today: the idle timer, activity state, and shutdown target are module-global, so a per-factory value would lie for any process running more than one handler. Deleted instead, with a ServerConfig note pointing at the deferred singleton/route-table refactor where real support belongs. BROWSE_IDLE_TIMEOUT and CHROMIUM_PROFILE env remain the honest knobs. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> * fix(security): wire appendSecureFile at the four real log-append sites file-permissions.ts carries a 24-line rationale for why POSIX mode bits are insufficient on Windows and implements appendSecureFile (0600 at create, Windows ACL on first write only) — but its single caller was the dead logAttempt, while the four REAL page-content log writers (console/network/ dialog logs in server.ts, the command audit log) used raw fs.appendFileSync with no mode. Page-content-derived logs now get owner-only permissions from birth on every platform. Verified before wiring: mode applies atomically at create via appendFileSync {mode}, and the ACL pass runs only on first write — no per-append subprocess cost on the hot console-log path. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> * fix(stealth): handoff() uses the shared profile resolution + lock cleanup The headless-to-headed handoff path hardcoded ~/.gstack/chromium-profile, silently ignoring $CHROMIUM_PROFILE and $GSTACK_HOME (gbrowser's gbd sets per-workspace profiles), and skipped cleanSingletonLocks() — so a handoff into a profile with a stale SingletonLock could hang where launchHeaded() would have recovered. This was the third live drift between the three Chromium launch paths; the first two are documented in comments as shipped stealth regressions. Minimal targeted fix — the full buildLaunchConfig() extraction stays in the deferred queue. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> * fix(gen): resolver registry describes the template language again Seven registered {{PLACEHOLDER}}s had zero uses in any .tmpl (checked in both bare and :arg forms): REDACT_TAXONOMY_TABLE, TEST_COVERAGE_AUDIT_REVIEW, MODEL_OVERLAY, QUESTION_PREFERENCE_CHECK, QUESTION_LOG, INLINE_TUNE_FEEDBACK, MAKE_PDF_SETUP. The last two of those families are invoked programmatically by preamble.ts (functions kept, registry entries dropped); the question-tuning trio and the review coverage-audit wrapper were documented by their own module as existing 'for unit testing' that no test performed — deleted, along with generateRedactTaxonomyTable + its EXAMPLE/TIER_BLURB constants (its '/cso renders the full table' comment was itself stale) and its test describe. Also deletes the gated-resolver mechanism (ResolverEntry/appliesTo/ unwrapResolver + test/resolver-entry.test.ts): fully built, fully tested, used by zero of the 65 registry entries — the generator loop simplifies to a direct function call. CLAUDE.md's redact-doc line stops advertising the dead token. Proof: zero-diff regen (0 SKILL.md changed); gen-skill-docs + skill-validation 737 tests green. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> * fix(gen): wire boundaryInstruction from host config; drop three no-op binDir ternaries hosts/codex.ts declared boundaryInstruction and nothing read it — review.ts kept its own byte-identical CODEX_BOUNDARY literal (verified equal + trailing escaped newlines). The resolver now reads the config, so the boundary has one owner. (autoplan's template carries deliberately generic variants, enforced by gen-skill-docs.test.ts:1358 — untouched by design.) The 'ctx.host === codex ? $GSTACK_BIN : ctx.paths.binDir' ternary appeared in three resolvers and could never change the result: resolvers/types.ts already sets binDir to $GSTACK_BIN for every usesEnvVars host including codex. Proof: zero-diff regen for claude AND codex hosts; gen-skill-docs + host-config suites green. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> * fix(test-infra): judge uses resolveClaudeBinary; eval:watch reads the real partials dir judgePtyState spawned the bare string 'claude' three definitions below the resolveClaudeBinary() helper this same file exports — broken under hermetic PATHs where every other launch in the file resolves correctly. eval:watch read _partial-e2e.json from the legacy global ~/.gstack-dev/evals/ while EvalCollector writes it into the per-project eval dir (or GSTACK_EVAL_DIR) — so the dashboard's completed-tests panel was empty whenever slug detection succeeded, i.e. the normal case. The heartbeat and per-run progress logs stay global by design (session-runner.ts: 'heartbeat stays global'). The three eval-CLI docstrings stop claiming the legacy dir is the primary location. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> * fix(test): delete the superseded SDK ship-idempotency suite and three orphaned fixtures test/skill-e2e-ship-idempotency.test.ts's own header documented that the monolith's SDK-harness version tests a synthetic prompt while it exercises the real /ship skill — the author knew the old suite was superseded and left both running, two paid LLM runs for one behavior. The weaker copy is gone; its 'ship-idempotency' diff-selection key goes with it (the dedicated file is periodic-tier, which always runs under EVALS_ALL — the key had no remaining consumer). Fixture rot: test/fixtures/golden-ship-claude.md was a 128KB zero-reader orphan that had drifted 46KB from its live successor (test/fixtures/golden/claude-ship-SKILL.md) while looking authoritative; parity-baseline-v1.46.0.0.json and v1.53.0.0.json had zero readers (three tests pin three OTHER baseline versions — consolidation is queued, deletion of the unreferenced two is free). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> * fix(bin): delete zero-caller scripts; make host-config-export's docstring honest - bin/gstack-open-url (14 lines): announced in a CHANGELOG entry, wired into nothing, ever. bin/gstack-platform-detect (27 lines): zero callers, and its hand-rolled host list was already stale (SLATE_HOST.md cites it as a problem). Note: the deprecated gstack-brain-consumer/reader pair the audit flagged was already deleted upstream in v1.63 with a stay-deleted tripwire. - scripts/task-emission-schema.ts (61 lines): a typed schema module nothing imported; the tasks-section comment now documents the JSONL fields inline. - scripts/host-config-export.ts claimed to be the 'shell bridge for the bash setup script' — setup never calls it (its hand-rolled host lists drifting is a known follow-up). Docstring now states what it IS: a standalone, test-pinned query CLI not yet wired into setup. Its validateValue + CLI_REGEX/PATH_REGEX internals were dead (defined for a guarantee the header claimed but nothing enforced). - KEPT deliberately: scripts/preflight-agent-sdk.ts — a documented manual diagnostic (CONTRIBUTING.md + USING_GBRAIN_WITH_GSTACK.md reference it). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> * fix(server): one lone-surrogate sanitizer, one sanitizeReplacer, one startTunnel Three copies of the surrogate sanitizer existed with two algorithms (sanitize.ts regex vs a hand-rolled charCodeAt walk in server.ts — verified byte-identical across 11 edge cases before converging) plus two identical sanitizeReplacer definitions each wrapping a different copy. sanitize.ts is now the single source of truth; the runs-INSIDE-JSON.stringify egress invariant is unchanged at every call site and its pin tests were adapted to the new import shape without losing intent. The ngrok tunnel-start sequence existed three times in server.ts — the /tunnel/start route and the BROWSE_TUNNEL=1 autostart were line-for-line equivalent (a comment admitted 'Same cleanup as /tunnel/start's error path'). One startTunnel() now owns the ephemeral loopback bind, the pre-send egress receipt, the state-file RMW via tmpStatePath(), and the ordered error-path cleanup; callers keep their distinct response surfaces. The BROWSE_TUNNEL_LOCAL_ONLY test path shares nothing (no ngrok, different state field) and deliberately stays separate. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> * fix(security): one session-cookie registry implementation, two instances pty-session-cookie.ts and sse-session-cookie.ts were byte-identical modulo the cookie name — mint/validate/parse/prune/TTL, the exact code a security fix would have to land in twice (and a third hand-rolled cookie parse in terminal-agent.ts had already diverged; unified next commit). createSessionCookieStore() owns the implementation; both modules become thin instantiations keeping every exported name, their distinct threat-model docstrings, and separate token spaces (an SSE-read cookie must never grant PTY access). pty-session-lease.ts deliberately stays out — different contract (sessionId/secret split, refresh, env TTL). The factory imports nothing from token-registry (cookie-picker-auth-isolation invariant, still pinned by sse-session-cookie.test.ts). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> * fix(security): terminal-agent uses the shared PTY cookie parser The /ws upgrade's cookie fallback hand-parsed the Cookie header inline — the fourth copy of the session-cookie parse, and the one that had already diverged from the others. Parsing now goes through extractPtyCookie; validation deliberately stays against the agent's own in-process validTokens map (the server's registry lives in a different process). The ws-handler pin test now pins the shared-parser call instead of the raw cookie-name literal. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> * refactor(hosts): defineHost() factory — 10 copy-paste host files become declarations hosts/*.ts were ten copies of one file: runtimeRoot byte-identical in 9/10, pathRewrites mechanically derivable from the host name for 7/10, the 11-entry toolRewrites map byte-identical between openclaw and gbrain, and every asset change a 10-file edit (cursor and slate had already fallen out of three other hand-maintained lists). defineHost() owns the defaults; each host file now declares only what makes it different (slate/cursor: 8 lines each). Shared constants: CROSS_MODEL_RESOLVERS, GBRAIN_RESOLVERS, EXEC_STYLE_TOOL_REWRITES. Genuinely-different things stayed explicit: codex/factory $GSTACK_ROOT rewrites, hermes's tool vocabulary, claude's denylist+prefixable install, opencode's wider runtimeRoot. Proof: JSON.stringify(ALL_HOST_CONFIGS) dump-diff before/after EMPTY (and a runtime walk confirmed no function-valued or undefined-keyed fields, so the JSON diff is complete); gen:skill-docs --host all zero-diff; host-config + gen-skill-docs + idempotency suites 485/485. Host files 595 -> 285 lines. docs/ADDING_A_HOST.md teaches the factory pattern. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> * feat(lib): fs-atomic — one atomic-write implementation, with the race actually fixed Atomic tmp-write-then-rename was reimplemented ~20 times across lib/, bin/, and browse/src with three tmp-suffix conventions. One of them was a latent bug this commit closes: lib/worktree.ts used a bare '.tmp' suffix — the deterministic-tmp collision race browse/src/server.ts documents having hit in production (its fix, pid+random, was trapped in a comment at one site). lib/fs-atomic.ts: atomicWriteSync (always throws, best-effort tmp cleanup, pid+random suffix, optional mode applied at tmp creation so the file never exists with looser permissions) + atomicWriteQuiet (shutdown paths only). Unit tests pin the throw/quiet contracts, 0600 mode, tmp-name uniqueness (captured via the read-only-dir failure path — Bun's fs exports are readonly, no monkeypatching), and no-stray-tmp cleanup. Migrated: lib/worktree.ts (the bare-.tmp bug), lib/gstack-decision.ts (snapshot + compact log), lib/gbrain-local-status.ts (probe cache). browse sites follow separately. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> * fix(lib): jsonl-store's docstring stops lying; mode option added; lib bypasses adopted The header claimed 'single source of truth... the ONLY copy' with write-time injection REJECTION — while appendJsonl never screened anything, only 1 of ~10 JSONL stores imported it, and a bypass appender lived in the same directory. Now: the contract is explicit (screening is the CALLER's job via hasInjection/firstInjectionMatch; the enforcing callers are named), a option applies 0600 at create for sensitive stores, and the lib bypasses are adopted (gstack-memory-helpers ×2, redact-audit-log — which keeps its chmod backstop for files created looser by pre-mode versions). browse/src keeps its own appenders by design (compiled-binary surface, own secure-append helper) and the header now says so. gstack-decision's batched archive append stays deliberate (single-write crash-window semantics appendJsonl's one-record contract can't express). New pins: 0600-at-create, and a test that documents appendJsonl does NOT self-screen — so nobody can re-document it as self-screening without making it true. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> * fix(browse): migrate hand-rolled atomic writes to lib/fs-atomic Seven sites, each audited for its existing throw-vs-swallow contract before migrating: writeSessionState + the four fire-and-forget tab/state writers use atomicWriteQuiet (they swallowed before); writeAgentRecord + the boot-time port-file write use atomicWriteSync (they threw before — and writeAgentRecord previously leaked its tmp file on rename failure, which the helper cleans). All carry {mode: 0o600} plus restrictFilePermissions after successful writes, preserving the Windows ACL hardening that writeSecureFile provided (mode bits are POSIX-only). server.ts untouched: its three state writes route through tmpStatePath(), pinned by server-tmp-state-path.test.ts. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> * fix(hosts): delete five dead HostConfig fields metadataFormat (generator hardcodes openai.yaml), sidecar (behavior lives in setup's create_agents_sidecar — knowledge preserved as a comment in codex.ts), install.prefixable (skill_prefix is implemented entirely in bin/gstack-config), staticFiles (docstring cited a SOUL.md that never existed anywhere), and adapter (its only would-be consumer, openclaw-adapter.ts, was fully dead — with a test asserting the field was undefined). Kept: learningsMode (wired next), linkingStrategy (validation reads it), coAuthorTrailer (consumed by resolvers/utility.ts). Proof: JSON dump diff shows ONLY the deleted keys vanishing; zero-diff regen across all 10 hosts; host-config + gen-skill-docs suites green. Note: this commit also carries chunk-23 edits to the shared hosts/claude.ts + define-host.ts + host-config.test.ts files (skipSkills collapse, stale line-number comment drops) — pathspec commits, concurrent prep. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> * fix(gen): preamble tiers are explicit; silent ?? 4 default becomes an error; spec stops rendering its preamble twice Eight skills (scrape, diagram, spec, skillify, pair-agent, landing-report, open-gstack-browser + its connect-chrome symlink) silently received the HEAVIEST tier-4 preamble because a missing frontmatter field defaulted to 4. Tiers are now declared in every {{PREAMBLE}} template's frontmatter and a missing declaration throws at generation time with the template path (the 5 templates without {{PREAMBLE}} never invoke the resolver). The stale hand-written tier-map comment (wrong in 3 of 4 rows) is gone. Bonus bug fixed: spec/SKILL.md.tmpl mentioned {{PREAMBLE}} in prose, so the generator inlined the ENTIRE preamble a second time — spec/SKILL.md shrinks 127,462 -> 80,924 bytes (-46,538) from de-duplication alone. skill-size-budget gains a reasoned INTENTIONAL_SHRINKS entry (its frozen baseline had measured the doubled-preamble bug). New tests: missing-tier throw carries the path; every {{PREAMBLE}} template declares a tier. (Carries chunk-23 edits in the shared test/gen-skill-docs.test.ts.) Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> * fix(gen): learningsMode is read from host config, not a hardcoded host name resolvers/learnings.ts branched on ctx.host === 'codex' while every host declared learningsMode — the field was decorative, and the 7 hosts configured 'basic' (cursor, slate, kiro, opencode, openclaw, hermes, gbrain) silently received the 'full' cross-project flow their runtimes can't execute (it depends on AskUserQuestion + gstack-config plumbing). Output now matches declaration: basic hosts get the project-scoped search block. Blast radius proof: all committed Claude SKILL.md files and the three golden fixtures are byte-identical; the behavior diff lands only in the gitignored external-host trees (hand-verified: .cursor review's learnings section swaps the cross-project AskUserQuestion block for the project-scoped search). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> * fix(gen): small config scrubs — openclaw blobs to real files, setup host drift, dead artifacts - The three openclaw markdown blobs hardcoded inside gen-skill-docs.ts (which silently reverted any hand edit to their tracked outputs on regen) move to openclaw/templates/*.md source files; output shasums byte-identical. - setup's --host allowlists gain cursor + slate — both fully registered hosts with generated output, but './setup --host cursor' exited 1 because two hand-rolled lists in setup had drifted from hosts/index.ts. - scripts/proactive-suggestions.json deleted: 31KB regenerated on every run, read by nobody (the catalog-trim design's reader was never built); its emitter and three determinism tests (which guaranteed a file nothing reads didn't churn) retired with stays-retired pins. - claude/SKILL.md.tmpl deleted: a complete 8.9KB skill that never generated output (directory name collides with the host id 'claude'), in no registry. Recoverable from git if ever wanted under a non-colliding name. - openclaw's frozen extraFields.version '0.15.2.0' stamp dropped; includeSkills: [] no-ops omitted (the generator treats [] as absent); llms.txt 55 -> 54 skills. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> * feat(gen): correct preamble tiers for the 8 silently-heaviest skills With tiers now explicit, set them RIGHT by analogy to the tiered population: scrape/diagram/open-gstack-browser (+ the connect-chrome symlink) -> tier 1 (launchers and artifact generators, like browse and make-pdf); landing-report/pair-agent/skillify -> tier 2 (dashboards and session tools, like health and canary); spec -> tier 3 (interactive planning, like the plan-*-review family). Each tier-1 skill sheds 271 lines of onboarding prose it never needed; tier-2 shed 20 each. Verification per the review protocol: regen diff reviewed (pure section-removal), skill-validation + size-budget + catalog-budget + v0-dormancy suites green (822 tests), and live smoke of the tier-corrected skills confirms the preamble renders the intended sections at each tier. These skills have ~no eval coverage — stated honestly; the wave's gate-tier eval run is the backstop. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> * feat(test): e2e-gate — one tier-gate implementation, side-effect-free, with the trap pinned The EVALS/EVALS_TIER gate was copy-pasted into ~40 test files and had drifted into six different predicates — the drift that made 'eval:bg:all runs everything' silently false. test/helpers/e2e-gate.ts owns the semantics now: describeE2ETier(tier) + e2eTierEnabled(tier), env read at call time, zero side effects (the existing e2e-helpers module runs a ~30s claude ping at import under EVALS=1, so the gate lives in its own module; purity is pinned by tests that scan imports and comment-stripped source). The unit matrix pins all four env combos — including EVALS=1 with EVALS_TIER unset -> SKIP, the exact trap that made eval:bg:all a non-run. The tier-alignment tripwire gains a second regex for the helper shape (old shape still detected — stragglers can't hide), and the sharded paid runner's PRE-SPAWN tier classifier learns the helper shape too: without that, every gate-sharded run would have spawned all 28 periodic shards just to skip them, each paying the e2e-helpers import ping (~15 min of dead wall clock in the CI-blocking lane). Verified: gate runs exclude the 29 periodic files, periodic excludes the 8 gate files — identical to pre-migration. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> * refactor(test): migrate the 36 tier-gated eval files to describeE2ETier Mechanical two-liner swap in 34 files (each keeping its declared tier — all 36 predicates verified against E2E_TIERS before migrating); the two files with compound gates (overlay-harness's EvalCollector feed, codex-e2e's CODEX_AVAILABLE) keep their extra conditions via e2eTierEnabled. Tier rationale comments preserved. codex-e2e/gemini-e2e/benchmark-providers keep their distinct stderr-message gate shapes by design. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> * refactor(test): skill-e2e + skill-llm-eval adopt the shared selection machinery Both files re-implemented the diff-selection machinery e2e-helpers already exported. The helper gained computeDiffSelection() (extracted, identical behavior) and a trailing optional selection param on the *IfSelected helpers (defaults preserve all 30+ existing importers). skill-e2e.test.ts drops ~120 duplicated lines; skill-llm-eval keeps its LLM_JUDGE_TOUCHFILES selection and test.concurrent semantics via testConcurrentIfSelected. Deliberate deltas, stated: skill-e2e.test.ts now honors the EVALS_TIER intersection its local copy lacked (affects only direct bun test invocations of that file — it matches no eval-script glob); its recordE2E gains the helper's three diagnostic fields; skill-llm-eval sharded solo now runs e2e-helpers' module-scope preflight it already ran in combined processes. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> * fix(test): kill the silent-truncation race; exempt the tier-corrected shrinks The full-suite shakeout (budgeted by the plan) surfaced both immediately: 1. server-embedder-terminal-port.test.ts stubbed process.exit and restored the REAL exit in its finally — but shutdown() schedules async work that can call process.exit AFTER restoration, killing the entire bun process mid-suite with exit 0 and NO summary. This is the silent-truncation class the new free-suite CI job guards against, reproduced locally on the first full run. Exit now stays a logging no-op between tests (late async exits become visible stderr lines, not process death); the true exit returns in afterAll. 2. The 80%-of-baseline shrink guard correctly flagged the six tier-corrected skills — their baseline was measured at the silent tier-4 default. Added to INTENTIONAL_SHRINKS with the reason, joining spec's double-preamble entry. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> * release: v1.64.0.0 — the code-smell fix wave 35 commits, one PR: guard repairs (free suite in CI per-file, all-host freshness gates, tunnel allowlist, diff-selection validation), the sidebar-agent ghost exorcism (dead ML layers, dead endpoints, dead exports, ghost comments), config honesty (defineHost factory, dead fields deleted, preamble tiers explicit, spec double-render fixed), and dedup with safety nets (session-cookie factory, fs-atomic, jsonl-store contract, one eval tier-gate). Net -24,943 lines across 183 files. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> * fix(ci): free-tests step runs under bash (container sh rejects pipefail) Maiden-voyage shakeout, exactly as budgeted: the CI container's default shell is dash, which errors on 'set -o pipefail' before the first test ran. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> * fix(ci): free-tests curates 8 container-incompatible files with reasons Second maiden-voyage shakeout round: 376 of 384 files ran green in the container on the first completed pass. The 8 that can't run there yet are excluded the same way the Windows shards curate POSIX-bound files — each with its reason inline (headed-Chrome handoff, real-PTY round-trip, X server management, extension-origin identity, the job's own TMPDIR override, and three pre-existing env failures that fail on dev machines too). Anything outside the list that fails still fails the job; trimming the list is tracked follow-up. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> * fix(test): gstack-config-key-locale — suppress the skill_prefix auto-relink side effect The test invokes the repo's own bin/gstack-config, whose 'set skill_prefix' auto-runs $(dirname $0)/gstack-relink — resolving the install dir to the repo itself. In any environment where the loop shares a working tree (the free-tests CI container, a fresh-HOME run), gstack-patch-names rewrote all 52 tracked SKILL.md names to gstack- prefixed, poisoning five unrelated suites downstream (hermetic-skills-seeding, host-config golden, skill-census, skill-validation, spec-template-sync). GSTACK_SETUP_RUNNING=1 is the documented suppression; relink behavior stays covered by relink.test.ts's mock install. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> * fix(bin): gstack-codex-session-import — empty sessions dir exits 0 on Linux GNU xargs runs 'ls -t' once even on empty input, listing the cwd and producing a bogus LATEST from the repo root; BSD xargs (macOS) skips the run, which is why the NO_SESSIONS path only broke on Linux. xargs -r pins the BSD behavior on both platforms. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> * test(parity): rebaseline v1.57.7.0 → v1.64.1.0 + skeleton-cap headroom The two parallel v1.64 waves (code-smell fix wave + main's #2571) each added shared-preamble prose, pushing document-release / design-consultation / cso past their size ratios on the v1.57.7.0 anchor and four carved skeletons (plan-ceo-review, plan-eng-review, office-hours, design-consultation) 22-280 B over their absolute caps. New baseline is union-normalized (skeleton + sections/*.md, matching what the harness measures); caps get +~1 KB headroom each with per-cap rationale. The v1.57.7.0 fixture stays in test/fixtures/ for the audit trail, and capture-parity-baseline.ts now documents the union-normalization step so the next rebaseline doesn't re-trip on it. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> * fix(ci): free-tests container parity — tools, pinned bun, git identity, mutation tripwire - Dockerfile.ci: add python3 (gstack-jsonl-merge/brain-sync/detach shell out to it), file (skill-validation's binary check), poppler-utils (make-pdf e2e gates hard-require pdftotext/pdffonts/pdfinfo), fonts-noto-color-emoji (emoji render gate, mirrors make-pdf-gate.yml). Fix the bun pin: the bun.sh installer ignores a BUN_VERSION env var, so the old form silently installed latest on every rebuild (observed 1.3.13/1.3.14 drift vs the 1.3.10 devs run locally); pass the version as the positional arg. - free-tests.yml: git identity + safe.directory for the git-exercising tests (container checkout is owned by a different uid than runner); post-loop tree-mutation tripwire that names a tracked-file-mutating test instead of letting downstream collateral confuse the report; skip the documented variants-retry-after timing flake. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> * fix(bin): gstack-session-update — detached updater owns its stdio (SIGPIPE) The backgrounded update subshell inherited the session hook's stdout/stderr pipes. Once the hook exits and the caller closes them, any child that writes — git pull's autostash notice, setup output — dies of SIGPIPE, logged as PULL_FAILED exit=141 with an empty stderr capture (observed in the free-tests container, and reachable by any production hook runner that closes stdio promptly). Redirect the fork to /dev/null; all observability already flows through the session-update log file. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> * fix(test): gstack-decision-bins — explicit branch context for the scope filter CI checks out a detached HEAD, where gitBranch() returns undefined on both the log and search sides, so an implicitly branch-scoped decision can never surface (filterByScope requires a matching non-empty ctx.branch). Pass the branch explicitly on both sides — the filter logic is what's under test, not git branch detection. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> * fix(test): ring-buffer lease interplay — same TTL window, not same millisecond Two back-to-back mintLease() calls each stamp Date.now() + TTL; when they straddle a millisecond boundary the exact-equality assertion flakes (observed in CI: expiries of ...525 vs ...526). Assert the expiries are within a 50 ms window instead — the invariant under test is that leases share a TTL policy, not that they mint in the same clock tick. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> --------- Co-authored-by: Claude Fable 5 <noreply@anthropic.com> |
||
|
|
dedfe42ef0 |
v1.53.0.0 feat: smarter redaction — PII/secrets/legal guard across /spec, /ship, /cso, /document-* (#1797)
* v1.51.0.0 feat: $B memory diagnostic + 4 CDP-resource leak fixes (#1751) * add withCdpSession + getOrCreateCdpSession helpers Two CDP-session lifecycle helpers in cdp-bridge.ts: - withCdpSession(page, fn): ephemeral session with try/finally detach. For one-shot CDP work (archive snapshots, $B memory, single Page.captureScreenshot) where the caller doesn't need session reuse. - getOrCreateCdpSession(page, cache): cached long-lived session that registers a page.once('close') hook to BOTH delete the cache entry AND call session.detach(). Pre-helper code only deleted the cache entry, leaving the Chromium-side CDP target attached until the underlying transport dropped. Pure addition. Existing callers untouched in this commit; they migrate in the next commit alongside the static-grep test that pins the invariant. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * migrate 3 CDP-session sites to lifecycle helpers Fixes the CDP-target leak class identified by /codex outside-voice on the eng review (D11 EXPAND_SCOPE). All three sites called `page.context().newCDPSession(page)` directly and either forgot the detach entirely (cdp-bridge cache cleanup), only detached on the success path (write-commands archive), or detached on framenavigated but not page-close (cdp-inspector). - cdp-bridge.ts: `getCdpSession` now delegates to `getOrCreateCdpSession`, which registers a `page.once('close')` hook that BOTH removes the cache entry AND calls `session.detach()`. - cdp-inspector.ts: same migration for the inspector's session pool. Keeps the existing framenavigated detach (more granular than close for DOM/CSS state invalidation) plus an inspector-layer close hook for the initializedPages WeakSet. - write-commands.ts archive: wraps Page.captureSnapshot in withCdpSession so the detach runs in `finally`, including the path where captureSnapshot throws. The static-grep tripwire (next commit) pins the invariant so future direct calls to newCDPSession fail CI. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * add CDP-session cleanup tripwire + helper unit tests browse/test/cdp-session-cleanup.test.ts pins the invariant that no source file outside cdp-bridge.ts may call newCDPSession() directly. If a future refactor reintroduces the direct call, CI fails with a file:line list and a pointer to the right helper to use instead (withCdpSession for one-shot, getOrCreateCdpSession for cached). Also covers the helpers themselves with fake-Page unit tests: - withCdpSession detaches on success - withCdpSession detaches on throw (the actual leak fix) - withCdpSession swallows detach errors so they don't mask fn errors - getOrCreateCdpSession caches the session across calls - close hook detaches AND clears the cache Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * extract createSseEndpoint helper with cleanup contract browse/src/sse-helpers.ts owns the SSE cleanup invariant: cleanup runs on abort, enqueue failure, AND heartbeat failure, exactly once, regardless of which edge fires first. Pre-helper, /activity/stream and /inspector/events ran cleanup only on the req.signal.abort edge. If the underlying TCP died without firing abort (Chromium MV3 service-worker suspend, intermediate proxy half-close), the subscriber closure stayed in the Set capturing the ReadableStreamDefaultController plus any payloads queued behind it. Over a multi-day sidebar session this compounded into multi-MB of retained controllers per dead connection. Caller surface: initialReplay (optional, for gap replay or state snapshots), subscribe (live-event source), liveEventName (SSE event name for live wrap), heartbeatMs. send() helper handles JSON encoding with sanitizeReplacer + lone-surrogate stripping. Unit tests pin all three cleanup edges + idempotency + replay ordering + surrogate sanitization. Endpoint refactors land in the next commit. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * route /activity/stream + /inspector/events through createSseEndpoint Both endpoints collapse from ~45 lines of in-line ReadableStream wiring to ~8 lines of helper config. Behavior preserved bit-for-bit by the new sse-helpers tests: - initial replay (activity gap + history, inspector state snapshot) - live event subscription - 15s heartbeat - SSE framing - sanitizeReplacer applied to every JSON.stringify The leak fix is the cleanup contract: pre-refactor, both endpoints ran cleanup only on req.signal.abort. If TCP died without firing abort (Chromium MV3 SW suspend, intermediate proxy half-close), the subscriber closure stayed in the Set forever capturing the ReadableStreamDefaultController + queued payloads. Post-refactor, an enqueue-failure or heartbeat-failure on a dead consumer triggers the same idempotent cleanup as abort would. Net: -83 / +15 in server.ts. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * cap inspector modificationHistory at 200 entries Pre-cap, modificationHistory was an unbounded module-scoped array that grew for every CSS edit through $B css across the entire session. Small per-entry footprint but no upper bound, the kind of slow leak that compounds over multi-day inspector use. Cap is 200, oldest evicted on push past the cap. modHistoryTotalPushed stays monotonic across the session so undoModification can tell the user when their target index has been evicted, instead of just the opaque pre-cap "No modification at index 500" with no context. __testInternals export lets the cap + eviction error be unit-tested without spinning up a CDP-driven Page. Production code must continue to go through modifyStyle / undoModification / resetModifications. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * add BrowserManager.getMemorySnapshot() + shared types Diagnostic foundation for $B memory and the /memory endpoint that land in the next two commits. Collects: - Bun process memory via process.memoryUsage (cross-platform, accurate). - Per-tab JS heap via CDP Performance.getMetrics, lazy per tracked page, swallows target-died errors so a dying tab doesn't poison the snapshot for the rest. - Chromium process tree via SystemInfo.getProcessInfo (PID + type + CPU time). RSS is NOT exposed via CDP — the eng review (D2 USE_CDP) picked CDP over shelling to `ps`, so notes[] tells the caller why the RSS column is absent and points at the follow-up TODO. cdp-inspector exports getModificationHistoryStats so the snapshot can surface buffer occupancy + cap + evicted count without reaching into module-private state. memory-snapshot.ts holds the shared types so server.ts and read-commands can import without circular dep on browser-manager. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * add \$B memory command Registers 'memory' in META_COMMANDS, wires the meta-command dispatch to a lazy-imported handler in memory-command.ts. Lazy because the import graph (cdp-bridge + memory-snapshot + buffer accessors) isn't useful to projects that never run the diagnostic. The handler assembles MemoryStructureStats from the modules that own each buffer (cdp-inspector mod history stats, activity subscriber count, console/network/dialog buffer lengths, captureBuffer bytes, inspectorSubscriber count via a new server.ts export) and calls BrowserManager.getMemorySnapshot. Output is text by default, JSON with --json so the sidebar footer and test harness can consume it programmatically. buildMemorySnapshotJson is the entry the /memory endpoint will call in the next commit. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * add /memory endpoint (SSE-session-cookie gated) GET /memory returns the BrowserManager memory snapshot as JSON. Auth matches /activity/stream and /inspector/events: Bearer header OR view-only SSE-session cookie (the extension fetches the cookie once via POST /sse-session, then polls /memory with withCredentials: true). Deliberately NOT extending /health for the sidebar footer poll — TODOS.md "Audit /health token distribution" records that /health already surfaces AUTH_TOKEN to any localhost caller in headed mode. A separate endpoint with the standard SSE auth keeps the future /health fix from cascading into the sidebar. sanitizeReplacer is applied at egress because tab.url and tab.title come from page content — lone-surrogate bytes from broken emoji could otherwise reach the sidebar and (when forwarded to Claude API) trigger HTTP 400. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * add sidebar footer RSS readout (polls /memory every 30s) Footer now shows "<bun-rss> · <tab-count>" sourced from the /memory endpoint, polled every 30s. Color thresholds: orange warn at 2 GB Bun RSS or 50 tabs; red bad at 8 GB or 200 tabs (matches the tab-guardrail threshold landing in a later commit). The footer gives the user an early signal that the cliff is forming, instead of only learning when the OS OOM-kills the process. Backoff per Codex's flag: if a poll takes > 2s response time the sidebar drops to a 5-minute cadence until the next successful fast poll. The diagnostic shouldn't add load to a browser that's already unhealthy. Start/stop is wired to the existing setServerInfo() hook so the timer only runs while the sidebar is connected to a server. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * stop materializing response bodies in requestfinished listener The Bun-side accelerant on the gbrowser-OOM investigation. Pre-fix, the per-page requestfinished listener called \`await res.body()\` just to read .length — Playwright fetches the bytes from Chromium across CDP into a Bun Buffer, only for the listener to discard the buffer after a single length read. On a long-lived headed browser with media-heavy pages this is multi-GB/hour of Buffer allocation churn. Bun GCs it, but the cross-process CDP traffic + transient allocation pressure feeds the OOM trajectory. The fix: req.sizes() pulls from the Network.loadingFinished event Chromium already emits. No body materialization. Accurate for chunked transfer, gzip-compressed responses, and streaming media — the cases where a naive Content-Length header read (the original review's proposal) would have missed the size entirely (Codex flag on the eng review, D10 USE_CDP_EVENT_BATCHED). The D10 stretch goal — replacing N per-page listeners with a single context-level CDP listener via Target.setAutoAttach — is deferred and tracked in TODOS. The listener architecture change is significantly more plumbing than the leak fix and not on the critical path for stopping the body materialization. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * tab guardrail (50/200 thresholds) + sidebar action toast Server side (browser-manager.ts): Idempotent threshold tracker fires an activity entry exactly once at each upward crossing of 50 (soft warn) and 200 (hard warn). Re-arms when the count drops below. Activity-feed surface gives the audit-trail invariant even with the sidebar closed; the toast UX lives in the sidebar. Sidebar side (extension/sidepanel.{html,css,js}): Every /memory poll evaluates two trigger conditions: - Any single tab > 4 GB JS heap (catches the WebGL/video runaway case Codex flagged on the eng review). - Tab count >= 200. Toast shows top 5 tabs ranked by max(jsHeap, nodes*1KB + listeners*200) so a WebGL-heavy tab with small JS heap still surfaces. Default-selected checkboxes + "Close selected" run \`\$B closetab <id>\` through the existing /command path — no chrome.tabs.remove bridge needed. "Snooze" bumps tabsAbove/heapAbove thresholds in chrome.storage.session so the toast stays hidden until the user accumulates more tabs OR one tab grows another 2 GB. Tests: browse/test/tab-guardrail.test.ts pins the server-side fires-once + re-arms invariants without spinning up Chromium. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * add memory-leak reproducer (gate tier) browse/test/memory-leak-reproducer.test.ts pins the invariant from the D10 fix: wirePageEvents.requestfinished must call req.sizes() but must NEVER call res.body(). Fakes a page emitting a burst of 200 requestfinished events, each with a notional 1 MB response — pre-fix this would allocate 200 MB of Buffer per burst, post-fix not one byte of body content is materialized. The test also asserts networkBuffer entries are still populated with the right size, so size reporting in the network panel doesn't regress. A real-Chromium peak-RSS reproducer (periodic tier) is deferred — see TODOS "Reproducer with WebGL / video / MSE buffer pressure". This gate-tier test is sufficient to catch the leak class being reintroduced by any future refactor of the requestfinished listener. Wall clock: ~400ms. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * TODOS: 4 follow-ups from gbrowser-OOM PR Captures the items deliberately deferred from the v1.49 leak-fix PR so the deferrals don't fall off the radar: - P2: MV3 extension service-worker memory profile (Codex finding #4) - P2: Native + GPU memory breakdown in \$B memory (Codex finding #5) - P3: Single-context CDP listener for Network.loadingFinished (D10 stretch goal) - P3: Real-Chromium peak-RSS reproducer for periodic tier (Codex finding on transient amplification + ANGLE_B_NUMBERS CHANGELOG framing dependency) Each entry follows the standard TODOS.md format: What / Why / Pros / Cons / Context / Priority / Effort. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * regen SKILL.md after adding \$B memory command The C8 commit added 'memory' to META_COMMANDS + COMMAND_DESCRIPTIONS but didn't regenerate the SKILL.md files. The category was 'Diagnostics' which isn't in scripts/resolvers/browse.ts:categoryOrder; switched to 'Server' (matches the existing 'status' / 'restart' / 'handoff' pattern) so the table renders under the existing ### Server section. Test fix: gen-skill-docs.test.ts asserts every command appears in the generated SKILL.md and gstack/llms.txt; without this regen the test fails with "Expected to contain: 'memory'". Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * add coverage for \$B memory diagnostic surface 17 tests across the formatter + byte renderer + JSON entry point: - formatBytes() 4-tier (bytes, KB, MB, GB) + 160 GB sanity case (the friend's OOM number from the original screenshot, so the renderer doesn't blow up at real leak scale) - handleMemoryCommand --json mode parseable shape - handleMemoryCommand text mode: Bun server line, no-tabs branch, top-10 sort with "...and N more" tail, Chromium process grouping by type, "unavailable" line when processes is null, modification- history evicted-count format, notes section rendering, long-URL ellipsis truncation - buildMemorySnapshotJson returns shape matching the type The formatSnapshotText renderer is private to memory-command.ts; tests exercise it through handleMemoryCommand's text-mode return path. The eviction-count format is pinned via a parallel format contract assertion since the renderer reads live module state. Coverage gate: brings the diagnostic surface from 0% to ~80%. Extension UI (sidepanel.js footer + toast) remains uncovered — adding tests there would require extracting fmtBytesShort and tabRamScore from sidepanel.js into a testable TS module, which is deferred to a follow-up to keep this PR scoped. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * chore: bump version and changelog (v1.51.0.0) Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * docs: update project documentation for v1.51.0.0 Add $B memory command to BROWSER.md server lifecycle table. Document the new createSseEndpoint helper + CDP session lifecycle helpers (withCdpSession, getOrCreateCdpSession) in CLAUDE.md alongside the existing server hardening notes, with the static-grep tripwire callout so future contributors route through the helpers. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * fix(test): pin SSE sanitizer wiring to the v1.51 createSseEndpoint helper The two `wiring invariants` tests grepped server.ts for `JSON.stringify(entry, sanitizeReplacer)` and `JSON.stringify(event, sanitizeReplacer)` — patterns that lived inline in /activity/stream and /inspector/events before the v1.51 refactor moved both endpoints behind createSseEndpoint. Sanitization still happens (the helper applies it inside its send() and live-event callback), but the static-grep was pinned to the old wiring and started failing on Windows free-tests after the refactor landed. Updated to check the new contract: - /activity/stream + /inspector/events route through createSseEndpoint (regex match of the route handler block ending in the helper call). - sse-helpers.ts contains JSON.stringify + sanitizeReplacer + imports stripLoneSurrogates from ./sanitize (catches drift to a private copy). - server.ts retains its own sanitizeReplacer for non-SSE egress paths (handleCommandInternal); the two replacers coexist by design. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * v1.52.0.0 feat(plan-tune): explicit consent + first-run setup wizard for contributors (#1741) * feat(plan-tune): explicit-consent surface + setup gate for question_tuning Step 0 grows two implicit gates that run before user-intent routing: - Consent gate: question_tuning=false + no marker → offer opt-in (contributor-specific copy variant) - Setup gate: question_tuning=true + declared empty + no marker → run 5-Q wizard Markers (~/.gstack/.question-tuning-prompted, ~/.gstack/.declared-setup-prompted) ensure each user is asked at most once. The Enable+setup section split into "Consent + opt-in" (with contributor framing) and standalone "5-Q setup" reachable from both the consent flow and the setup gate. Also aligns the calibration gate across three docs (V0 said 90+ days, TODOS said 2+ weeks, binary uses 7 days). The fix distinguishes: - Display gate (sample_size>=20, skills>=3, question_ids>=8, days_span>=7): for rendering inferred values in /plan-tune output - Promotion gate (90+ days stable across 3+ skills): for shipping E1 behavior-adapting defaults TODOS.md E1 card updated to reference 90+ days, plus Codex's substrate risk note: generated skill prose is agent-compliance-based, so E1 ships as advisory annotations on AskUserQuestion recommendations, not silent AUTO_DECIDE. Tests can verify templates contain right reads but can't prove agents obey them. Per /plan-eng-review + Codex outside-voice 2026-05-26. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com> * chore: bump version and changelog (v1.49.0.0) Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com> * feat(bins): honor GSTACK_STATE_ROOT override for test isolation Plan-tune cathedral T1 (per D16 / Codex outside voice). The 3 bins that back /plan-tune (question-log, question-preference, developer-profile) previously ignored GSTACK_STATE_ROOT, so tests that tried to point state at a tempdir via that env var silently wrote to the real ~/.gstack. Make STATE_ROOT take precedence over GSTACK_HOME so the cathedral's E2E + unit tests can isolate cleanly without sledgehammering HOME. Order of precedence: GSTACK_STATE_ROOT > GSTACK_HOME > $HOME/.gstack Matches the existing gstack-paths emission order. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * test(plan-tune): regression coverage for v1.49 consent + setup gates Plan-tune cathedral T2 + part of T1 follow-up (Codex IRON RULE — regressions get tests). v1.49 shipped two prose-driven implicit gates inside plan-tune Step 0 (consent, setup) with zero test coverage. The cathedral refactors that template heavily; without tests, silent breakage is possible. Three regression families plus a static template assertion: 1. Consent gate fires under qt=false + no marker; goes silent on marker write or qt=true flip. 2. Setup gate fires under qt=true + empty declared + no marker; goes silent when declared populates, marker is written, or qt is still false. 3. Marker idempotency: gates stay silent across 5 re-invocations after a single decline/bail. Markers honored independently. 4. Static template assertion: gate language can't be silently deleted without breaking a test. Also extends gstack-config to honor GSTACK_STATE_ROOT (it was the last bin still ignoring it — caught while writing the tests; without this, tests would silently mutate the user's real config.yaml). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * docs(spikes): Claude hook mutation + Codex session format Plan-tune cathedral T4 (per D5/D10). Two Phase 1 design spikes that downstream tasks (T3, T5, T6, T8, T9) depend on. claude-code-hook-mutation.md - Confirms PreToolUse allow + updatedInput is supported and is the right mechanism for substituting an auto-decided answer. - Pins stdin/stdout JSON schemas with field-by-field reference. - Documents matcher regex syntax for "(AskUserQuestion|mcp__.*__AskUserQuestion)" so Conductor's MCP-routed AUQ is covered. - Captures parallel-hook merge order caveat and our settings.json snippet. codex-session-format.md - Maps the on-disk ~/.codex/sessions/<date>/rollout-*.jsonl schema by event type (response_item 76%, event_msg 19%, turn_context, session_meta). - Critical finding: Codex has NO AskUserQuestion tool. Gstack AUQ-shaped Decision Briefs surface as agent_message text; answer is the next user_message. Two-tier recovery: marker-first (D18), then pattern fallback for hash-only logging. - Confirms logs_2.sqlite is internal telemetry, not session content. - Lists open questions to answer during T9 implementation. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * feat(settings-hook): schema-aware PreToolUse/PostToolUse registration Plan-tune cathedral T3 (per D4 + Codex correction). The previous bin only knew SessionStart and dedup'd on the hardcoded `gstack-session-update` substring. The cathedral needs PreToolUse + PostToolUse hooks registered side-by-side with the user's own hooks, with explicit consent UX, backups, and rollback. New subcommands: - add-event --event <SessionStart|PreToolUse|PostToolUse|...> --command <cmd> --source <tag> [--matcher <re>] [--timeout <s>] - remove-source --source <tag> # removes all entries tagged by source - diff-event ... # preview without mutating - rollback # restore latest backup - list-sources # audit gstack-tagged hooks Multi-source dedup via a new `_gstack_source` field on each hook entry (Claude Code preserves unknown fields). Source tag lets plan-tune-cathedral register PreToolUse + PostToolUse without colliding with the existing SessionStart wiring, and lets remove-source clean up cleanly during gstack-uninstall. Backups written automatically to settings.json.bak.<ts> before any mutation, with a .bak-latest pointer the rollback subcommand reads. Existing legacy `add <cmd>` / `remove <cmd>` shape preserved verbatim so setup --team and gstack-uninstall keep working unchanged. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * feat(hooks): PostToolUse capture hook for AskUserQuestion Plan-tune cathedral T5. Closes the substrate hole that motivated this entire branch: agent-compliance-only logging produced zero events in weeks of dogfood. PostToolUse hook captures every AUQ fire deterministically. What ships: - hosts/claude/hooks/question-log-hook.ts — TS hook that reads Claude Code's hook stdin, walks tool_input.questions[*], extracts user choice + recommended option from tool_response, spawns gstack-question-log per question. - hosts/claude/hooks/question-log-hook — bash shim Claude Code's hook runner invokes; execs bun against the .ts file. - Marker-first question_id extraction (D18 progressive markers): <gstack-qid:foo-bar> stripped from question text, used as the id. Hash fallback hook-<sha1[:10]> for unmarked questions (observed-only, never used as preference key — D18 hash drift mitigation). - (recommended) label parsing for the user_choice/recommended fields, with refuse-on-ambiguous when two labels are present (D2 safety). - Free-text capture: source=auq-other + free_text field when user picks Other and types (Layer 8 dream cycle input). - Matcher covers both native AskUserQuestion and mcp__*__AskUserQuestion (Codex/Conductor catch from outside voice review). - Crash safety: always exits 0; errors land in ~/.gstack/hook-errors.log so the user's session is never blocked by a hook failure. gstack-question-log extended to: - Accept `source` field (default 'agent', new values: hook, auq-other, auto-decided, codex-import-marker, codex-import-pattern). - Accept `tool_use_id` (<=128 chars) for dedup. - Composite dedup on (source, tool_use_id) across the last 100 lines — protects against hook + preamble both firing on the same tool call (D3 belt+suspenders). - Async fire `gstack-developer-profile --derive` after each successful write so inferred.sample_size actually grows (D17 — without this, the cathedral's "before 0, after >0" metric never moves). - GSTACK_QUESTION_LOG_NO_DERIVE=1 escape hatch for tests. 9 new unit tests covering capture, marker extraction, MCP variant, free-text, dedup, ambiguous-recommended safety, crash paths. All pass plus the existing 88 tests across related files. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * feat(hooks): PreToolUse enforcement hook for AskUserQuestion preferences Plan-tune cathedral T6 — the keystone that makes never-ask actually bind. Today preferences are agent-convention (silently ignored). This hook enforces them via Claude Code's hook protocol: when a never-ask preference matches an AUQ that is two-way + has a marker + has a clear recommendation, the hook returns permissionDecision: "deny" with permissionDecisionReason naming the auto-decided option. The agent obeys the rejection feedback and proceeds with the recommended option without re-firing AUQ. Decision tree (per question): - marker absent → defer (D18: hash IDs are observed-only) - one-way door → defer (safety override — never auto-decide one-way) - always-ask preference → defer - no preference set → defer - ambiguous recommendation (two (recommended) labels OR no parseable rec) → defer (D2 refuse-on-ambiguous) - never-ask / ask-only-for-one-way + two-way + clean rec → deny+reason Preference precedence per D8: project-local (~/.gstack/projects/<slug>/question-preferences.json) wins, global (~/.gstack/global-question-preferences.json) is fallback. Why deny+reason instead of allow+updatedInput: AskUserQuestion's updatedInput shape for "pre-resolve this question" isn't structurally pinned in Claude Code docs (T4 spike open question). deny with a reason that names the auto-decided option is the conservative + reliable v1 — the model receives the rejection, reads the recommended option from the reason, proceeds without re-prompting. Swap to allow+updatedInput once the AUQ input shape is verified against real Claude Code. Since deny prevents PostToolUse from firing, this hook logs the auto-decided event itself via gstack-question-log (source=auto-decided) so /plan-tune's Recent auto-decisions surface picks it up. Also writes a session marker ~/.gstack/sessions/<id>/.auto-decided-<tool_use_id> for coordination when the AUQ-shape switch lands. Multi-question AUQ: enforcement is all-or-nothing per call. If any question in the batch isn't eligible (no marker, no preference, ambiguous rec, etc.), the whole call defers so the user still gets to answer the rest normally. Registry lookup: cheap regex extraction from scripts/question-registry.ts (reading + bun-importing the TS file from a hook is too slow). Door type defaults to two-way for unregistered. Matcher covers both native AskUserQuestion and mcp__*__AskUserQuestion (Conductor disables native — Codex outside-voice catch). 15 unit tests cover defer paths, enforcement, one-way safety override, ambiguous-rec refuse, precedence (project wins, global fallback, project-overrides-global), MCP matcher, auto-decided event logging, session marker writing, crash safety. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * feat(scripts): declared-annotation helper + autonomy signal_key wiring Plan-tune cathedral T7. Adds the helper that lets skills inject one-line plain-English annotations on AUQ recommendations based on the user's declared profile — read-only, advisory-only, per TODOS.md E1 substrate-risk guidance (no AUTO_DECIDE off inferred). scripts/declared-annotation.ts - getDeclaredAnnotation(signal_key) → annotation | null - primaryDimensionFor(signal_key) → Dimension | null - Signature uses kebab signal_key per D2/Codex correction (registry uses hyphens; profile dimensions use underscores; helper maps internally). - Bands: >= 0.7 high, <= 0.3 low, else null. Middle band stays silent. - Per-dimension plain-English phrasing: 5 dimensions × 2 bands = 10 phrases. - Reads ~/.gstack/developer-profile.json (honors GSTACK_STATE_ROOT). scripts/psychographic-signals.ts - New signal_key 'decision-autonomy' that maps user_choice → autonomy dimension nudges. This was the missing signal for the 'autonomy' dimension — without it, the cathedral could annotate four of five declared dimensions but autonomy stayed silent. scripts/question-registry.ts - Add signal_key: 'decision-autonomy' to land-and-deploy-merge-confirm and land-and-deploy-rollback. These are the highest-leverage autonomy questions in the surface — "let me decide" vs "go ahead" is exactly what the dimension captures. 13 unit tests cover the helper's full contract (unknown keys, missing profile, middle-band null, both band thresholds, all five dimensions rendering distinct phrases). Existing 47 plan-tune.test.ts tests still pass after the registry + signal-map enrichment. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * feat(setup): install plan-tune cathedral hooks with explicit consent UX Plan-tune cathedral T8. Wires the new PostToolUse capture hook and PreToolUse enforcement hook into ~/.claude/settings.json via the schema-aware gstack-settings-hook (T3) — respecting D4's "never mutate settings.json silently" boundary and the Codex outside-voice warning. Behavior at setup time: - Idempotency: if list-sources already shows 'plan-tune-cathedral', no-op with a one-line note. - Marker present (previously declined): no-op, no re-prompt. - Interactive terminal: print rationale + diff preview from settings-hook, rollback command, and prompt y/N. On accept, register both hooks (PostToolUse and PreToolUse) with --source plan-tune-cathedral. On decline, touch ~/.gstack/.plan-tune-hooks-prompted so we don't re-ask. - Non-interactive (CI / scripted): no prompt; print the two exact commands the user would need to install manually. - --no-team teardown also removes the plan-tune hooks via remove-source. gstack-uninstall extended to clean up plan-tune-cathedral hooks alongside the existing SessionStart cleanup. Listed as a separate "plan-tune cathedral hooks" line in the REMOVED summary when it fires. No new test file — coverage from T3's gstack-settings-hook-schema-aware tests proves the underlying bin behavior; setup-level integration is verified manually (re-running ./setup is cheap and the prompt makes it obvious whether install happened). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * feat(bin): gstack-codex-session-import — structured Codex transcript parser Plan-tune cathedral T9. Backfills question-log.jsonl from Codex sessions since Codex has no AskUserQuestion tool (per docs/spikes/codex-session-format.md) and gstack AUQ-shaped Decision Briefs show up as agent_message prose. Walks ~/.codex/sessions/<date>/rollout-*.jsonl, matches each agent_message that contains either a <gstack-qid:foo-bar> marker or a D-numbered Decision Brief header, then pairs it with the next user_message for the answer. Two-tier recovery per D5: - marker present → source=codex-import-marker, stable question_id - no marker but D-shape detected → source=codex-import-pattern with hash-only question_id (never used as preference key per D18) Subcommands: gstack-codex-session-import # latest session gstack-codex-session-import <file> # explicit path gstack-codex-session-import --since <iso> # all sessions newer than User-choice extraction handles A/B/C letter responses and prose responses that start with the option label. Recommended option parsed via the "(recommended)" label suffix (same convention as Layer 2). Each extracted event written via gstack-question-log, so source tagging, dedup, and async derive all apply uniformly. spawnSync uses the cwd from session_meta so gstack-slug buckets events into the project the user was actually working in, not the importer's cwd. 7 unit tests cover marker path, pattern fallback, multiple briefs in sequence, missing user_message, numeric/letter user response forms, empty-sessions-dir handling. Smoke-tested against a real ~/.codex/sessions/ file from earlier today — returns IMPORTED: 0 because that session was autonomous (no AUQ-shaped prose), proving the bin doesn't false-positive on unrelated agent_message events. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * feat(bin): gstack-distill-free-text — Layer 8 dream cycle distiller Plan-tune cathedral T10. Reads auq-other free-text events from this project's question-log.jsonl, calls Claude via the Anthropic SDK to extract structured proposals (preference candidates, declared-profile nudges, memory nuggets), writes them to distillation-proposals.json for the user to review via /plan-tune (never autonomous — every apply requires explicit Y). Subcommands: gstack-distill-free-text # sync distill gstack-distill-free-text --background # detach + return PID gstack-distill-free-text --dry-run # emit prompt + events, no API call gstack-distill-free-text --status # run history + cost-to-date D7 rate cap: 3 distills per slug per day. Reads ~/.gstack/distill-cost.jsonl for the count, exits with RATE_CAPPED when limit hit. Cost log lines tagged by slug so sibling projects don't share the cap. Yesterday runs don't count. D6 API auth: Anthropic SDK direct, fail-loud on missing ANTHROPIC_API_KEY with explicit message that distill is a separate billing surface from the interactive Claude Code session. Uses claude-haiku-4-5 for cost (~$0.001/ 1k input, $0.005/1k output) — sufficient for structured extraction. D14 execution context: --background spawns detached (nohup) so auto-trigger during /ship doesn't add 30s of pause; results surface on next /plan-tune. Source events get distilled_at:<ts> stamped on them after the run so they don't re-propose on the next distill. Match by ts + question_id. Cost-log line per run includes: slug, proposals_count, rejected_low_confidence, input_tokens, output_tokens, cost_usd_est. /plan-tune stats reads this to show "$X estimated, N runs this month" per Layer 4 surface. 10 unit tests cover --status, rate cap (3/day, yesterday-not-counted, other-slug-not-counted), no-log/no-free-text paths, --dry-run, missing API key, --background spawn. The actual SDK call is exercised by the T16 E2E test (uses real key, ~$0.001 per run). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * feat(bin): gstack-distill-apply — apply distillation proposals with gbrain tag Plan-tune cathedral T11. Bin that applies a single user-approved proposal from distillation-proposals.json to the right surface: - memory-nugget → appended to ~/.gstack/free-text-memory.json (durable local source-of-truth; gbrain is mirror when configured). - preference → routed through gstack-question-preference --write with source=plan-tune (clears the user-origin gate). - declared-nudge → atomic update to developer-profile.json declared dim, small=0.05, medium=0.10, large=0.15, clamped to [0, 1]. Why a separate bin (not inline in the skill template): /plan-tune's apply step needs to be invokable from any host (Claude, Codex, etc) and must write to multiple state files atomically. A bin centralizes the schema + clamp logic; the skill template just calls it after user Y. gbrain coordination: --gbrain-published true marks the nugget so /plan-tune stats can show "12 nuggets, 8 mirrored to gbrain". The skill template invokes mcp__gbrain__put_page / extract_facts / add_tag in the same turn (those are MCP tools, not CLI-callable) before calling this bin. Local file remains canonical so the PreToolUse hook injection path (T12) doesn't depend on gbrain availability. Subcommands: gstack-distill-apply --list # show pending proposals gstack-distill-apply --proposal <N> # apply, file fallback gstack-distill-apply --proposal <N> --gbrain-published true Applied proposals get applied_at + gbrain_published stamped on them so re-running --list shows only unconsumed ones. 11 unit tests cover --list (all three kinds + quotes), memory-nugget append + non-clobber, preference routing through the gate-respecting bin, declared-nudge math (medium=0.10, small=0.05, large=0.15, clamp at [0,1]), proposal mark-applied with gbrain flag, and error paths (bad index, missing --proposal). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * feat(hooks): Layer 8 memory injection via per-session cache Plan-tune cathedral T12. Extends the PreToolUse hook to inject matching free-text-memory.json nuggets into AskUserQuestion responses, giving the agent + user the distilled context from past 'Other' answers right when the related question fires. Per-session cache (D13 perf): first read of free-text-memory.json writes ~/.gstack/sessions/<id>/memory-cache.json. Subsequent hooks on the same session take the cached path. Invalidation is by file-missing: when the canonical file changes (via gstack-distill-apply), the per-session cache either reflects the staler view for the rest of the session or the session restarts and the cache rebuilds. Cheap, correct enough for v1. Matching logic: - Walk this AUQ batch's questions, extract marker question_ids. - Look up signal_key in scripts/question-registry.ts. - Collect nuggets whose applies_to_signal_keys include any of the matched signal_keys. - Cap to 3 most-recent (by applied_at) so the additionalContext stays short. - Surface as additionalContext on the hookSpecificOutput response. Memory + enforcement interact cleanly: the same hook can both surface nuggets AND deny the tool when a never-ask preference matches. Memory context isn't doubled in the deny reason — the auto-decided option name in the deny path is sufficient signal. 6 new tests cover injection on defer, no-match silence, 3-most-recent cap, memory-alongside-deny enforcement, cache file write-through, empty-canonical graceful degradation. Existing 15 preference-hook tests still green. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * feat(plan-tune): SKILL.md surfaces for cathedral T13 Plan-tune cathedral T13. Rewires plan-tune/SKILL.md.tmpl to expose the new cathedral surfaces: Step 0 routing: - Implicit gate #3 (dream-cycle): fires when distillation-proposals.json has unapplied proposals. Marker is per-proposal applied_at so re-firing naturally skips already-handled items. - Added user-intent route for "dream cycle" / "distill" / "what have I been free-texting". - Power-user shortcuts: distill, dream, audit. Stats: - Host-aware source breakdown (SOURCE_HOOK, SOURCE_AGENT, SOURCE_AUTO_DECIDED, SOURCE_CODEX_IMPORT_*, SOURCE_AUQ_OTHER). - MARKED percentage so D18 progressive-markers progress is visible. - Distill cost-to-date via gstack-distill-free-text --status. Recent auto-decisions: - Last 10 source=auto-decided events with question_id + user_choice. Lets the user spot-check enforcement and flip via always-ask. Audit unmarked questions: - Top N hash-only ids by frequency. Surfaces next candidates for the D18 marker retrofit. Dream cycle review + manual distill: - Walks unapplied proposals via AskUserQuestion (one per call), routes accepts through gstack-distill-apply with --gbrain-published flag. Skill template invokes mcp__gbrain__put_page when MCP is available; local file remains source-of-truth. Regenerated SKILL.md via `bun run gen:skill-docs`. All 60 plan-tune tests still green. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * feat(preamble): inject <gstack-qid:...> marker convention into question-tuning resolver Plan-tune cathedral T14. Per D18 progressive markers, the PreToolUse enforcement hook only fires when the AUQ question text contains a <gstack-qid:foo-bar> marker the hook can extract. Without a marker, the hook logs the fire as observed-only and skips enforcement (hash IDs drift with prose so they're never used as preference keys). The high-leverage retrofit point is the preamble's Question Tuning section, not 10 individual skill templates. Updating scripts/resolvers/question-tuning.ts adds the marker convention to every tier-≥2 skill in one change — agents running ANY of the 30+ tier-≥2 skills now embed the marker by default when the question matches a registered question_id. Two convention additions in the preamble: 1. "Embed the question_id as a marker (<gstack-qid:{id}>) somewhere in the rendered question." With explanation that the marker is the only path for the PreToolUse hook to enforce preferences. 2. "Embed the option recommendation via the (recommended) label suffix on exactly one option per AUQ." Documents the D2 parser contract: label first, prose fallback, refuse-on-ambiguous. Net cost: ~700 bytes added to the preamble per generated skill. Plan-review preamble budget ratcheted from 39000 → 40000 (test/gen-skill-docs.test.ts) with a comment explaining the cathedral T14 expansion is load-bearing. Regenerated 42 SKILL.md files via `bun run gen:skill-docs`. The token ceiling warning on ship/SKILL.md (~41K tokens) is pre-existing; this PR doesn't change ship's preamble materially. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * feat(ship): plan-tune discoverability nudge after first successful ship Plan-tune cathedral T15 (the ship-side surface; the setup-side surface shipped in T8 with explicit hook-install consent UX). Adds Step 21 to ship/SKILL.md.tmpl: after Step 20 (persist metrics) succeeds, surface /plan-tune once per machine via a marker-gated single-line nudge. Behavior: - If ~/.gstack/.plan-tune-nudge-shown exists → no-op. - If question_tuning is already true → no-op (user already on board). - Otherwise: print one nudge line, touch marker. The nudge mentions both the observational substrate AND the hook-installed auto-decide enforcement so users know what they get when they opt in. Non-blocking — never asks a question, doesn't gate ship completion. To re-show: rm ~/.gstack/.plan-tune-nudge-shown before next ship. Setup-side discoverability shipped in T8 via the hook install prompt (explicit consent + diff preview + backup). Together these two surfaces cover first-install AND first-ship moments — the user discovers plan-tune organically rather than needing to know /plan-tune exists. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * test(plan-tune): 5 cathedral E2E scenarios + touchfile registration Plan-tune cathedral T16 (per D12 — all 5 in gate tier). One consolidated file with five describeIfSelected scenarios, each selectable by its own touchfile entry so they only run when the relevant code changes (or EVALS_ALL=1 forces all): plan-tune-hook-capture — PostToolUse hook fires → question-log fills plan-tune-enforcement — never-ask + marker + 2-way → deny+reason + auto-decided event logged plan-tune-annotation — declared profile + memory nugget → additionalContext surfaced on defer plan-tune-codex-import — synthetic JSONL → import bin → log with source=codex-import-marker plan-tune-dream-cycle — apply proposal → re-fire question → memory injected via additionalContext Each scenario fixtures an isolated git repo + bins + scripts + hooks under tmp, then exercises the cathedral chain end-to-end against real on-disk binaries (no mocks at the bin layer). GSTACK_STATE_ROOT keeps the user's real ~/.gstack untouched. These five complement the existing unit tests by proving the full sub-process chain works (not just individual functions in isolation). They DON'T spawn claude -p because the cathedral's substrate behavior is deterministic — agent compliance is no longer the variable. The existing test/skill-e2e-plan-tune.test.ts (plan-tune-inspect) still covers the LLM-driven intent-routing behavior. Cost: each scenario runs in ~1s with $0 because no claude -p invocations. Touchfile-gated, so they only run on PRs that touch cathedral code. Also fixes a bug found by the E2E: question-log-hook didn't pass the incoming tool call's cwd to spawnSync when invoking gstack-question-log, so the bin used the hook process's cwd (the repo root) instead of the session's cwd. Result: log writes landed in the wrong project bucket. Fix mirrors the same cwd-passing pattern from question-preference-hook. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * chore: bump VERSION to 1.50.0.0 + plan-tune cathedral CHANGELOG Plan-tune cathedral T17. Bumps VERSION 1.49.0.0 → 1.50.0.0 (MINOR per CLAUDE.md scale-aware rule: this is substantial new capability — 8 layers, ~3000 LOC, 96 new tests, deterministic substrate + dream-cycle distillation). CHANGELOG entry follows the release-summary format from CLAUDE.md: - Two-line bold headline naming what changed for users (deterministic capture, binding preferences, free-text memory loop) - Lead paragraph: before/after framed concretely (zero events captured → every fire, agent-honored → hook-enforced, declared profile → injected context, regex backfill → structured JSONL parser) - Two tables: metric deltas + layer/where-it-lives. Real numbers (96 tests, ~$0.01 per distill, 3/day cap), no AI vocabulary, no em dashes. - "What this means for solo builders" close: ties dream cycle to the compounding loop and points to ./setup as the on-ramp. - Itemized Added/Changed/For contributors sections list every layer's surfaces with file paths. Also: - Refreshed test/fixtures/golden/{claude,codex,factory}-ship-SKILL.md to match the regenerated ship templates (Step 21 nudge added). - Rebased plan-tune entry in parity-baseline-v1.47.0.0.json from 51717 → 64017 bytes with a baseline_note explaining the cathedral T13 expansion. Documents that the new Dream cycle, Recent auto-decisions, Audit unmarked, Dream cycle review/distill sections are load-bearing, not bloat. Without the rebase, the size-budget gate fails — and the cathedral's whole point is making /plan-tune do more, not less. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * chore: bump VERSION 1.50.0.0 → 1.52.0.0 (queue collision with #1742) CI version gate caught: PR #1742 (garrytan/upgrade-gstack-gbrain-v1) already claims v1.50.0.0 and #1751 (garrytan/browser-memory-leak) claims v1.51.0.0. gstack-next-version util recommends v1.52.0.0 as the next free slot. Updates: - VERSION 1.50.0.0 → 1.52.0.0 - package.json version sync - CHANGELOG.md header + metric table label - parity-baseline-v1.47.0.0.json baseline_note reference No content changes; pure slot rebase per the queue. The cathedral scope (8 layers, 96 tests) and CHANGELOG narrative stay identical — same ship, different release number. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * chore: cap audit — remove distill rate cap, loosen size/budget gates Plan-tune cathedral follow-up. The 3/day distill cap was theatrical: at ~$0.01 per Haiku call, even a runaway loop firing every minute would cost ~$14/day, and free-text events are rare enough that the natural input rate self-limits to 1-2 fires/day. Count caps don't protect against runaway bugs (which fire 1000x/second, not 4 times/day) but DO punish heavy users who'd legitimately distill multiple times during a busy week. Removed: 3/day rate cap on bin/gstack-distill-free-text. --status output swapped from "TODAY: N / 3" to "TODAY: N run(s), $X" so users see what they're spending instead of how close they are to a meaningless count. Loosened (caps that exist for real-runaway protection, not normal scope): - EVALS_BUDGET_HARD_CAP_GATE $25 → $200/run - EVALS_BUDGET_HARD_CAP_PERIODIC $70 → $500/run - EVALS_BUDGET_HARD_CAP $30 → $300/run (umbrella fallback) - GSTACK_SIZE_BUDGET_RATIO 1.05 → 1.50 per-skill ratio - plan-review preamble byte budget 40K → 60K Principle: caps exist to catch obvious bugs (infinite retry, model price change, prompt blowup), not to gate legitimate scope growth. Set high enough that real growth never trips them, only bug territory does. Adjusted defaults are 4-8× historical worst case, leaving ample headroom for the next 12 months of legitimate expansion. Tests updated: distill-free-text removes the 3-test rate-cap describe block in favor of "no rate cap" assertion that 10 runs/day pass. Other budget tests still pass because they were never near the old ceilings. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.7 <noreply@anthropic.com> * feat(redact): shared redaction engine + taxonomy (pure lib, no behavior change) Add the foundation for cross-skill PII/secret/legal redaction: - lib/redact-patterns.ts — canonical 3-tier taxonomy (HIGH genuinely-secret credentials, MEDIUM PII/legal/internal + high-FP credential-shaped, LOW surface-only). Tier-1 calibration: Stripe-publishable, Google AIza, JWT, and env-KV are MEDIUM not HIGH (context-variable / high-FP). Validators: Luhn, Shannon-entropy gate, RFC1918 exclusion, wallet sanity. Per-span placeholder suppression (not line-based). - lib/redact-engine.ts — pure scan() + applyRedactions(). Normalization pass (NFKC + zero-width strip + entity decode) with offset map back to original. Oversize input fails CLOSED. No visibility-based tier promotion (records repoVisibility for sterner wording only). Tool-attributed-fence WARN-degrade for obvious doc-examples. Safe preview masking (≤4 leading chars). - 100 unit tests: per-pattern positives, FP filters, validators, email allowlist, no-promotion semantics, tool-fence degrade, normalization, oversize-fail-closed, ReDoS pattern-lint + runtime budget, auto-redact (idempotent, right-to-left, structural-corruption guard). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> * feat(redact): bin/gstack-redact CLI shim over the engine Skill-facing CLI wrapping lib/redact-engine. Reads stdin or --from-file, scans, prints JSON (--json) or a human table. Exit codes 0/2/3 gate dispatch/file/edit/commit (WARN never gates). --auto-redact emits the sanitized body + diff for the PII-class one-keystroke path. --allowlist, --self-email, --repo-public-emails, --repo-visibility, --max-bytes. Fails closed on oversize at the CLI boundary before the engine even reads. 9 contract tests: exit codes, JSON shape, auto-redact, allowlist, self-email, from-file, oversize-fail-closed. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> * feat(redact): opt-in pre-push hook (accident catcher) + safe installer bin/gstack-redact-prepush scans the diff being pushed for HIGH credentials and blocks on a hit, for public AND private repos (a pushed secret is compromised regardless of visibility). Correct git pre-push semantics: scans remote..local (what's being pushed), handles new-branch zero-SHA via merge-base or empty-tree fallback, force-push, and branch-delete skip. MEDIUM warns non-blocking; LOW/WARN silent. GSTACK_REDACT_PREPUSH=skip escape valve logs to prepush-skip.jsonl. bin/gstack-redact gains install-prepush-hook / uninstall-prepush-hook subcommands that chain any pre-existing hook (renamed to pre-push.local, stdin forwarded to both, exit code propagated). Guardrail not enforcement: --no-verify and the env skip both bypass; it scans only the pushed delta, not history/binary/LFS. 9 tests in a throwaway git repo. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> * feat(redact): gstack-config keys redact_repo_visibility + redact_prepush_hook redact_repo_visibility (public|private|unknown) is a LOCAL override for repos gh/glab can't read; it lives in ~/.gstack/config.yaml so it can't weaken the gate repo-wide for other contributors. redact_prepush_hook (true|false) toggles the opt-in pre-push hook. No block_private key — HIGH blocks both visibilities unconditionally. Value-domain validation + 6 tests. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> * feat(redact): gen-skill-docs resolver for taxonomy table + invocation block scripts/resolvers/redact-doc.ts emits two placeholders, both derived from lib/redact-patterns so skill docs never drift from the engine: - {{REDACT_TAXONOMY_TABLE}} — 3-tier table for /spec + /cso (shared source). - {{REDACT_INVOCATION_BLOCK:<sink>}} — the canonical scan-at-sink bash + prose for one enforcement point (pre-codex/pre-issue/pre-archive/pre-pr-body/ pre-pr-title/pre-commit): which-bun probe, visibility resolution (local config → gh → glab → unknown), temp-file scan-at-sink, exit 3/2/0 branches, PII auto-redact offer, guardrail-not-enforcement framing. Registered in index.ts. 12 resolver tests. No SKILL.md churn yet (no template references the placeholders until the per-skill wiring commits). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> * feat(spec,cso): wire shared redaction — semantic pass + scan-at-sink + taxonomy /spec Phase 4.5 rewrite: - Phase 4.5a: in-conversation semantic content review (named-criticism, customer complaints, unannounced strategy, NDA, codename bleed). Injection- hardened (a body containing the SEMANTIC_REVIEW marker forces flagged). Content-free audit trail to ~/.gstack/security/semantic-reviews.jsonl. - Phase 4.5b: replaces the inline 7-regex prose with the shared gstack-redact scan-at-sink (exact-byte temp file). Three enforcement points: pre-codex, pre-issue (files via --body-file from the scanned file), pre-archive (D2: sanitized body to the archive). --no-gate skips codex score only; redaction always runs, no flag disables it. /cso: renders the full generated taxonomy table as its canonical pattern catalog (shared source), keeps its git-history archaeology (different use case). lib/redact-audit-log.ts: 0600 append-only semantic-review trail (no body text). Resolver gains compact-table + brief-block variants so /spec references the catalog instead of inlining it (stays under the v1.47 size budget). Tests: extended spec invariants (semantic pass, scan-at-sink, no-promotion), audit-log, cso/spec alignment. All green; spec 1.050× / cso 1.046× baseline. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> * feat(ship,document-*): redaction scan-at-sink on PR bodies + generated docs - /ship: scan the composed PR body + title before create AND edit, from a temp file (exact bytes scanned = bytes sent). HIGH blocks the PR (no skip); MEDIUM confirms per finding. Codex/Greptile/eval sections go in tool-attributed fences so example credentials those tools quote WARN-degrade instead of blocking the PR — a live-format credential inside the fence still blocks. - /document-release: scan the PR-body temp file before gh pr edit. - /document-generate: scan the staged doc diff (added lines) before commit — generated docs often carry example credentials; a live-format secret blocks. Tests: ship-template-redaction (incl. tool-fence WARN-degrade contract), document-skills-redaction. All skills stay under the v1.47 size budget. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> * feat(redact): semantic-pass eval + CLAUDE.md docs + size/parity baselines - test/redact-semantic-pass.eval.ts: periodic-tier paid eval (EVALS=1) with 10 should-flag / should-clean fixtures + an injection-resistance case, the only way to detect semantic-pass model drift. - CLAUDE.md: "Redaction guard" section — engine/CLI/hook locations, the guardrail-not-enforcement framing, scan-at-sink, no-tier-promotion, the tool-attributed-fence convention, the config keys, and the audit log. - /cso uses the compact (HIGH-tier) taxonomy table so it fits under BOTH the v1.47 and the older v1.44.1 parity ceilings; full MEDIUM/LOW lives in lib/redact-patterns.ts. Alignment test asserts the HIGH-tier contract. - Refresh the ship golden baselines (claude/codex/factory) for the PR-body redaction wiring. Full free suite green (incl. skill-size-budget + parity 10/10). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> * v1.52.1.0 feat: brain-aware planning — 5 skills read structured gbrain context before asking (#1742) * feat(brain): brain-cache-spec.ts — single source of truth for cache layer Foundation for the brain-aware planning skills work (v1.48 plan / D2). One TS const file consolidates BRAIN_CACHE_ENTITIES (8 entities × TTL + budget + invalidation rules), SKILL_DIGEST_SUBSETS (per-skill which files to load), SALIENCE_DEFAULT_ALLOWLIST (D9 privacy gate), SKILL_CALIBRATION_WEIGHTS (Phase 2 E5), and policy / identity / schema constants. Drift between docs and runtime becomes impossible by construction: resolver, cache CLI, and test/skill-preflight-budget.test.ts all import from the same module. test/brain-cache-spec.test.ts: 19 invariant assertions (subset/entity consistency, per-skill achievability, allowlist sanity, transport defaults, user-slug fallback chain, lock timeout, retention policy). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * feat(brain): gstack-core@1.0.0 schema pack (T1 / Phase 0) Defines 8 typed page kinds for the brain entity model: gstack/user-profile, gstack/product, gstack/goal, gstack/developer-persona, gstack/brand, gstack/competitive-intel, gstack/skill-run, gstack/take Each declares frontmatter shape (typed fields with required/optional flags), retention policy (immutable / archive-after-90d / never-archive), and emits_links graph for mcp__gbrain__schema_graph rendering. getSchemaPackMutationPayload() returns JSON in the shape accepted by mcp__gbrain__schema_apply_mutations. Idempotent registration: gbrain skips when pack+version already installed. test/gstack-schema-pack.test.ts: 16 invariants on pack shape, retention policies, link verb consistency, JSON serializability. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * feat(brain): gstack-brain-cache CLI (T2a) — core subcommands bin/gstack-brain-cache: TS CLI with five subcommands: get <entity-name> [--project <slug>] refresh [--full] [--entity X] [--project <slug>] invalidate <entity-name> [--project <slug>] digest <entity-slug> meta [--project <slug>] Cache layout per Phase 0.5 design: ~/.gstack/brain-cache/ ← cross-project (user-profile) ~/.gstack/projects/<slug>/brain-cache/ ← per-project (everything else) Per-entity TTL drives staleness; per-entity byte budgets enforce compression at write time. Atomic writes via tmp+rename. Stale-but-usable fallback when brain unreachable (returns cached digest with diagnostic prefix instead of failing). Schema-version mismatch + endpoint switch both trigger full rebuild for the affected scope (D4 A4). Fetch+compress paths wired for the 7 entities (user-profile, product, goals, developer-persona, brand, competitive-intel, recent-decisions, salience) via gbrain CLI shell-out — works for local PGLite and local-stdio MCP, transparent over the existing spawnGbrain helper. Concurrent-refresh dedup (D3 / T15) is a follow-up commit. Salience allowlist gate (D9 / T17) is a follow-up commit. Bootstrap + lifecycle subcommands (T2b / T18) are follow-up commits. test/brain-cache-roundtrip.test.ts: 11 tests covering path resolution, meta lifecycle, endpoint detection, schema mismatch behavior, and the four cache states (warm / cold-refreshed / stale-fallback / missing). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * feat(brain): concurrent-refresh lockfile dedup (T15 / D3) When autoplan dispatches 4 planning skills back-to-back and they all hit a cold-miss on the same digest, only ONE actually fetches from the brain. The rest dedup via the project-scoped lockfile at ~/.gstack/projects/<slug>/brain-cache/.refresh.lock. Reuses the 5-min stale-takeover convention from /sync-gbrain. Lock is taken over when: - File is older than CACHE_REFRESH_LOCK_TIMEOUT_MS - PID is on the same host and dead (process.kill(pid, 0) fails) - Lock file is corrupt (defensive) withRefreshLock(projectSlug, fn) returns either the callback's value or the literal 'dedup'. The CLI emits exit code 3 + diagnostic stderr on dedup, so callers can choose to wait + retry (resolver does this) or fall through to stale-but-usable behavior. test/cache-concurrent-refresh.test.ts: 7 tests covering acquire/release, stale-takeover, dead-PID takeover, corrupt-lock recovery, error-path release, and cross-project lock location. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * feat(brain): salience privacy allowlist gate (T17 / D9) D9 cross-model finding from codex outside voice: salience-sourced digests can include emotionally-weighted personal pages (family, therapy, reflection). Pulling those into a coding-review prompt leaks sensitive context into work-flow reasoning. fetchSalience now strips entries whose slugs don't match an allowlist prefix BEFORE writing to the cache file. Default allowlist is SALIENCE_DEFAULT_ALLOWLIST = ['projects/', 'concepts/', 'gstack/']. User can extend via: gstack-config set salience_allowlist 'projects/,gstack/,concepts/,custom/' or override with GSTACK_SALIENCE_ALLOWLIST env var. Digest still records the strip count for transparency. Empty result emits 'all N entries stripped' note rather than silent absence. test/salience-allowlist.test.ts: 9 tests covering default permits, default blocks, empty allowlist, env override, whitespace trimming, and the invariant that defaults contain nothing sensitive (personal, family, therapy, reflection, private, medical, health). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * feat(brain): bootstrap + list + purge subcommands (T2b / T18) T2b — bootstrap synthesizes draft entity content from CLAUDE.md + README + recent learnings.jsonl and emits as JSON for the caller. Skill template is responsible for the AUQ-confirm-before-write flow (D10 T4 extraction- review requirement). Cli stays pure (no AUQ logic); agent owns user interaction. T18 — list/purge subcommands close the lifecycle loop: list [--project <slug>] — enumerate gstack-owned pages in brain (probe all 8 gstack/* page types) purge <slug> — delete one gstack page, refuses non-gstack/ slugs (defensive) list defaults to all-projects (cross-project user-profile included). With --project, filters to per-project pages plus the cross-project user-profile. --json flag emits machine-readable output for the agent. Retention sweep + audit subcommand are deferred to a follow-up commit (they need the lifecycle scheduling design, not just CLI plumbing). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * feat(brain): brain-aware planning resolvers + 3 new placeholders (T4) scripts/resolvers/gbrain.ts adds: - generateBrainPreflight(ctx) — emits per-skill ## Brain Context block + bash that loads digests via gstack-brain-cache get (one call per digest). Per-skill subset comes from SKILL_DIGEST_SUBSETS (single source). - generateBrainCacheRefresh(ctx) — at-skill-end background refresh hook; non-blocking; warms cache for next run. - generateBrainWriteBack(ctx) — Phase 2 / E5 calibration write-back with per-skill weight. Gated on personal trust policy + the BRAIN_CALIBRATION_WRITEBACK flag. Includes invalidation bash that busts affected digests after the write. scripts/resolvers/index.ts registers three new placeholders: {{BRAIN_PREFLIGHT}}, {{BRAIN_CACHE_REFRESH}}, {{BRAIN_WRITE_BACK}} All three resolvers return empty string for skills not in SKILL_DIGEST_SUBSETS (defensive — skill template authors can drop the placeholders into non-preflight skills with zero effect). D9 privacy is mentioned in the rendered preflight prose so the agent knows to expect filtered salience. D11 codex tension: write-back gates on brain_trust_policy@<hash> being personal — shared brains skip write-back to avoid polluting team calibration profile. test/brain-preflight.test.ts: 19 tests covering subset rendering, non-preflight skill gating, cross-project vs per-project --project flag emission, weight injection per skill, BRAIN_CALIBRATION_WRITEBACK flag mention, and registration in RESOLVERS map. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * feat(brain): gstack-config brain integration helpers (T5+T10+T16) Extends bin/gstack-config to support the brain-aware planning layer: KEY VALIDATION (T5): Plain alphanumeric/underscore now extended to allow @<hex-hash> suffix. Required for per-endpoint namespaced keys (brain_trust_policy@<sha8>, user_slug_at_<sha8>). Keys without the suffix still validate as before. VALUE WHITELISTING (D4 / D11): brain_trust_policy@* values gated to personal | shared | unset. Unknown values warn + default to unset (defense against typos). NEW DEFAULTS (lookup_default): brain_trust_policy@* -> unset salience_allowlist -> '' (resolver uses SALIENCE_DEFAULT_ALLOWLIST) user_slug_at_* -> '' (resolve-user-slug fills + persists on demand) NEW SUBCOMMANDS: endpoint-hash — print sha8 of active gbrain MCP URL from ~/.claude.json. Collision check escalates to sha16 when a prior endpoint stored at the same sha8 would conflict (T10 defensive default). resolve-user-slug — walks D4 A3 identity chain: 1. mcp__gbrain__whoami.client_name 2. $USER env var 3. sha8(git config user.email) 4. anonymous-<sha8(hostname)> Persists result on first call so subsequent calls are stable across sessions. test/user-slug-fallback.test.ts: 14 tests covering endpoint-hash output shape, fallback chain ordering, persistence, brain_trust_policy namespace value validation + per-endpoint isolation, and key validator extension for @-suffixed keys. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * feat(brain): wire 5 planning skill templates with BRAIN_* placeholders (T6) Adds three placeholders to each of the 5 planning SKILL.md.tmpl files: {{BRAIN_PREFLIGHT}} — top of skill body, before first interactive section. Loads the per-skill digest subset (5 files for office-hours, 2 for plan-eng- review, etc.) into the prompt context before any AskUserQuestion fires. {{BRAIN_WRITE_BACK}} — end of skill, before refresh hook. Phase 2 calibration write path; gated on personal policy + BRAIN_CALIBRATION_WRITEBACK flag. {{BRAIN_CACHE_REFRESH}} — end of skill, after write-back. Non-blocking background refresh so next invocation gets warm cache. Files touched (templates + regenerated SKILL.md): office-hours/SKILL.md.tmpl plan-ceo-review/SKILL.md.tmpl plan-eng-review/SKILL.md.tmpl plan-design-review/SKILL.md.tmpl plan-devex-review/SKILL.md.tmpl (matching .md files regenerated via bun run gen:skill-docs) All 5 generated SKILL.md files now contain the rendered ## Brain Context (preflight) section + write-back guidance + background-refresh hook. The resolver renders only for skills in SKILL_DIGEST_SUBSETS — these 5 + an empty string for any other skill that drops in the placeholders. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * feat(brain): setup-gbrain trust-policy step + sync-gbrain flags (T5b / T13+T5c) T5b — setup-gbrain Step 9.5: Inserts the brain trust policy AskUserQuestion before the verdict block. Detects active endpoint hash via gstack-config endpoint-hash. Branches per transport: * Local (sha == "local"): auto-set personal, one-line notice * Remote-MCP, unset: AskUserQuestion (personal vs shared) * Already-set: skip, just print current policy Personal default flips artifacts_sync_mode=full when still off. T13+T5c — sync-gbrain: Adds two flag short-circuits: --refresh-cache : route to gstack-brain-cache refresh --project <slug>; skip code + memory + brain-sync stages. Replaces the planned /brain-refresh-context skill per D1 fold (one fewer always-loaded skill in catalog). --audit : emit gstack-owned page summary + sensitive-content leak check via gstack-brain-cache list. Read-only. Step 1 trust policy gate: fires the same AskUserQuestion as setup-gbrain Step 9.5 when policy is unset for a remote endpoint. Local engines auto-set personal silently. Idempotent for already-set policies. Both templates re-rendered via bun run gen:skill-docs. Trust policy question wording centralized in setup-gbrain Step 9.5; sync-gbrain Step 1 references it to avoid prompt drift. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * test(brain): schema migration + fence-block fallback + preflight budget (T19+T21) 3 new gate-tier test files closing the most important coverage gaps in the brain-aware planning layer: test/schema-version-migration.test.ts (D4 A4): - Cache file with mismatched schema_version triggers wipe-and-rebuild - Matching version + fresh TTL stays warm-hit (no unnecessary rebuild) - Rebuild wipes ALL files in scope, not just the one being read test/takes-fence-fallback.test.ts: - Every preflight skill mentions both takes_add (preferred) and put_page fence-block (fallback for pre-T8 gbrain versions) - All 5 skills gate on BRAIN_CALIBRATION_WRITEBACK flag + personal trust policy - Per-skill weight matches SKILL_CALIBRATION_WEIGHTS (E5) - Write-back emits the kind=bet frontmatter shape and invalidates affected cache digests test/skill-preflight-budget.test.ts (T21 / D7): - Per-skill BRAIN_* instruction bytes stay under 3x the runtime digest budget (resolver bloat catch) - Autoplan total instruction bytes stay under 75 KB (3x of 25 KB runtime cap) - Non-preflight skills emit zero brain bytes - Per-skill subset references are present in the preflight bash Note on the 3x multiplier: SKILL_PREFLIGHT_BUDGET_BYTES governs runtime digest data (enforced by cache CLI truncateToBudget). Instruction text emitted by the resolver gets a separate 3x headroom — anything beyond that signals the instructions themselves are bloated and need a trim. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * docs(todos): brain-aware planning follow-ups (T11) Adds five deferred items from the v1.48.0.0 brain-aware planning plan: - P2: /gstack-reflect nightly synthesis skill (E2, deferred D4) - P3: cross-machine brain-cache sync (E3, deferred D5) - P3: /gstack-onboarding dedicated skill (E4, deferred D6) - P2: upstream gbrain takes_add + takes_resolve MCP ops (T8 wrap-up) - P3: background-refresh hook supervision (codex outside-voice T3) Each entry follows the TODOS.md format: What / Why / Pros / Cons / Context / Effort / Depends on. Each cross-references the v1.48.0.0 review decision (D-numbers from /plan-ceo-review and /plan-eng-review) that deferred it. The plan itself is at ~/.claude/plans/hm-interesting-well-why-dapper-eagle.md and is NOT a TODO entry (it's a one-shot design doc, not ongoing work). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * test(brain): bump schema-migration test timeout to 60s Rebuild path fans out to 7 per-project entity refreshes, each shelling gbrain with 10s internal timeout. Worst case ~70s. Default bun test 5s was timing out on slow brain unreachable cases. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * chore: bump version and changelog (v1.50.0.0) Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * fix(test): tighten put_page regression pin to CLI subcommand The test asserted no substring 'put_page' anywhere in the resolver, but the BRAIN_WRITE_BACK resolver legitimately references the MCP op `mcp__gbrain__put_page` as the fallback path for calibration takes when gbrain v0.42+'s `takes_add` op isn't available. The check conflated the deprecated `gbrain put_page` CLI subcommand (renamed in v0.18+ to `gbrain put`) with the still-valid MCP op of the same name. Narrow the assertion to `gbrain put_page` (with the space) so the fallback prose stays legal while the CLI rename regression stays caught. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * feat(brain): gstack-config gbrain-refresh subcommand Adds a new subcommand that re-detects gbrain installation state and persists the result to ~/.gstack/gbrain-detection.json. The detection file is consumed by gen-skill-docs --respect-detection (next commit) to decide whether to render the GBRAIN_CONTEXT_LOAD and GBRAIN_SAVE_RESULTS resolver blocks in user-local SKILL.md generation. Reuses the existing bin/gstack-gbrain-detect helper for the actual probe; this subcommand just persists + summarizes. Users run it after installing or uninstalling gbrain so their locally generated SKILL.md files match their installation state. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * feat(brain): gen-skill-docs respects gbrain-detection override Adds --respect-detection flag (and bun run gen:skill-docs:user script). When the flag is set, gen-skill-docs reads ~/.gstack/gbrain-detection.json and filters GBRAIN_CONTEXT_LOAD + GBRAIN_SAVE_RESULTS out of each host's suppressedResolvers when gbrain_local_status is "ok". When absent or gbrain isn't detected, suppression behaves as before. The default `bun run gen:skill-docs` (CI canonical) ignores the detection file so the committed SKILL.md stays reproducible regardless of any developer's local gbrain installation state. Use gen:skill-docs:user for user-local installs (./setup invokes it). No host config files modified — the static suppressedResolvers stay correct for the no-gbrain case; the override happens at gen-time. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * feat(brain): setup runs gbrain detection + conditional SKILL.md regen At the end of install, ./setup now: 1. Runs bin/gstack-gbrain-detect, persists the result to ~/.gstack/gbrain-detection.json 2. If gbrain_local_status == "ok", regenerates Claude-host SKILL.md via `bun run gen:skill-docs:user --host claude` so the user's local install picks up the compressed brain-aware blocks 3. If gbrain isn't detected, leaves the canonical no-gbrain SKILL.md files in place (zero token overhead) and surfaces the gstack-config gbrain-refresh path for users who install gbrain later Together with the prior two commits, this completes the setup-time conditional un-suppression: brain-aware blocks render iff the user has gbrain installed, regardless of which CLI host they're on. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * refactor(brain): compress GBRAIN_* resolvers, move template prose to docs/ generateGBrainContextLoad: 80 -> 115 tokens with explicit skip-header. generateGBrainSaveResults: 500-700 -> 161 tokens per skill with the skill metadata extracted into a typed skillSaveMap (slugPrefix + title + tag). Verbose prose (heredoc body, entity-stub instructions, throttle handling, backlink protocol) moved into a new doc: docs/gbrain-write-surfaces.md (Sections: §Context Load, §Save Template). The agent reads the doc on-demand only when actually saving — one Read call, cached by Claude's context. Net per-planning-skill overhead under un-suppression drops from ~1000 tokens (naive un-suppression) to ~275 tokens (compressed). Combined with the setup-time detection from prior commits, users WITHOUT gbrain pay zero overhead (block suppressed at gen-time) and users WITH gbrain pay ~275 tokens. The /investigate special-case (data-research routing in CONTEXT_LOAD) stays inline since it's skill-specific. docs/gbrain-write-surfaces.md also serves as the manual-probe reference for humans verifying live persistence + a topology summary covering trust-policy + .gbrain-source reads-only semantics. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * feat(brain): wire SAVE_RESULTS for plan-design-review + plan-devex-review Adds {{GBRAIN_SAVE_RESULTS}} placeholder to the two planning skills that were missing it, immediately before {{BRAIN_WRITE_BACK}} (mirrors plan-eng-review:324 + office-hours:650). The corresponding skillSaveMap entries (design-reviews/<feature-slug> + devex-reviews/<feature-slug>) landed with the resolver compression in the prior commit. Regenerated SKILL.md reflects the new placeholder position. The default no-gbrain generation (CI canonical) still suppresses the block — zero diff in the rendered output for non-gbrain users. All five planning skills now write a retrievable review page to gbrain when gbrain is detected at setup time, instead of three of five. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * test(brain): resolver compression + detection-override regression pins test/resolvers-gbrain-save-results.test.ts (140 LOC, 10 tests): - Per-skill assertions for all 5 planning skills: emits gbrain put + correct slug prefix + tag + title. - Skip-header present so agent can short-circuit when gbrain isn't on PATH. - Compression pin: each per-skill block stays under 750 chars (~190 tokens) — guards against a future "let me add one more line" refactor silently re-inflating toward the ~1000-token naive un-suppression baseline. - Generic fallback for unmapped skill names still works. - /investigate gets the data-research routing suffix; non-investigate skills do not. - generateGBrainContextLoad stays under 500 chars (~125 tokens). test/gbrain-detection-override.test.ts (120 LOC, 4 tests): - End-to-end through gen-skill-docs subprocess against an isolated temp GSTACK_HOME. Asserts: * detected:true un-suppresses GBRAIN_* → SKILL.md gains the block * detected:false (status != "ok") suppresses → no block * no detection file suppresses → no block (graceful default) * no --respect-detection flag IGNORES the detection file → no block (CI canonical path stays reproducible) Each detection-override test restores the canonical SKILL.md in a finally block so the working tree stays clean. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * test(brain): fake-CLI agent-obedience E2E for /office-hours writeback test/skill-e2e-office-hours-brain-writeback.test.ts (~210 LOC, periodic-tier, ~$0.50-1/run): Drives /office-hours via runSkillTest against a deterministic fixture brief (pixel.fund founder pitch). The workdir has: - A regenerated office-hours/SKILL.md with the compressed brain blocks (generated via gen-skill-docs --respect-detection against a temp GSTACK_HOME, then restored to canonical post-snapshot) - A fake gbrain shell script on PATH that uses printf %q quoting to preserve --content "$(cat <<'EOF' ... EOF)" heredoc payloads intact (naive `echo "$@"` would lose argv boundaries) - The docs/gbrain-write-surfaces.md the resolver points to Asserts: - gbrain-calls.log contains `gbrain put office-hours/pixel-fund` - Payload file at gbrain-payloads/office-hours/pixel-fund.md exists with valid YAML frontmatter (title: + tags: + design-doc tag) - At least one gbrain put entities/<name> call (entity stub enrichment is best-effort, soft warning if absent) Covers agent obedience to the SAVE_RESULTS instruction. Out of scope: gbrain CLI persistence contract (T11 covers that with real PGLite). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * test(brain): real PGLite round-trip E2E (matched-pair persistence) test/skill-e2e-gbrain-roundtrip-local.test.ts (~145 LOC, periodic-tier, ~$0.001/run on Voyage): Real gbrain CLI round-trip against an isolated temp HOME: 1. gbrain init --pglite --embedding-model voyage:voyage-code-3 2. gbrain put office-hours/<unique-slug> --content <markdown> 3. gbrain get <slug> 4. Assert every body line survives + title + tags + non-empty This is the matched-pair check for the v1.50.0.0 question "is the data we hope to save actually being saved?" — proves the gbrain CLI persistence contract gstack relies on, against a real engine. Does NOT involve the agent — pure CLI integration test. The agent obedience side is covered by the fake-CLI E2E in the prior commit. Skips cleanly when VOYAGE_API_KEY is unset OR gbrain CLI is missing from PATH, so CI without secrets degrades gracefully. Remote/Supabase routing is gbrain's contract — the same CLI shape works against every engine. gstack stops at local round-trip coverage to avoid re-testing gbrain's MCP client implementation. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * chore(brain): touchfiles + TODOS + CHANGELOG for v1.50.0.0 test/helpers/touchfiles.ts: register the two new E2Es in E2E_TOUCHFILES + E2E_TIERS (both periodic): - office-hours-brain-writeback: triggered by resolver / gen-pipeline / detection helper / refresh subcommand / office-hours template / docs / fixture / test file changes - gbrain-roundtrip-local: triggered by resolver / test file changes TODOS.md: append two P2 follow-ups carried over from the v1.50 plan: - Re-verify calibration takes when gbrain v0.42+ ships takes_add and BRAIN_CALIBRATION_WRITEBACK flips TRUE - Extend brain-writeback E2E to the other 4 planning skills (extract makeFakeGbrain to test/helpers/fake-gbrain.ts when second consumer arrives) CHANGELOG.md v1.50.0.0: add a "Save-results path: works under any CLI when gbrain is on PATH" section that documents the headline: - Conditional inclusion at setup-time (zero overhead for non-gbrain users, ~250 tokens with gbrain) - Wiring symmetry fix (5 of 5 planning skills now write a page) - Token cost table comparing detection states - Test coverage map (resolver unit + override mechanism + fake-CLI agent obedience + real PGLite round-trip) - Why remote routing isn't tested here (gbrain's contract) Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * test(brain): tighten prompt + relax slug assertion in writeback E2E Two fixes: 1. Prompt: "Slug it 'pixel-fund'" was ambiguous — agent could read it as "use pixel-fund as the FULL slug" instead of "substitute pixel-fund for <feature-slug>". Replaced with explicit guidance: "The feature-slug value to substitute into the SAVE_RESULTS template's <feature-slug> placeholder is exactly 'pixel-fund' (no path prefix — the template already provides the prefix). Apply the SAVE_RESULTS template literally." Also added "Do NOT explore gbrain --help" to short-circuit the discovery loop the agent fell into. 2. Slug assertion: was a strict /gbrain put .*office-hours\/pixel-fund/ regex. This conflated two concerns — agent obedience (does the agent actually invoke gbrain put?) vs resolver output shape (does the template emit the right prefix?). The latter is already pinned by test/resolvers-gbrain-save-results.test.ts at the resolver level (free, hermetic). The E2E now asserts /gbrain put .*pixel-fund/ (slug contains pixel-fund somewhere) plus a recursive payload-file search that accepts either office-hours/pixel-fund.md (template- faithful) or pixel-fund.md (agent dropped prefix). The YAML frontmatter + tag assertions on the payload remain strict — those are the real agent-obedience contract. 3. Entity-stub regex: was looking for entities/<name>; agent variability uses entity/<name>, people/<name>, companies/<name>. Loosened to match entit(y|ies) only. The soft-warning path stays (no hard fail) because entity extraction is best-effort prose, not a CLI contract. Verified passing locally: 7 expect() calls, 268s, ~$0.50. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * chore: bump version to 1.51.1.0 main advanced to 1.51.0.0 while this branch was in development. Bump to 1.51.1.0 (PATCH above main) so the branch lands cleanly above the current main version per the monotonic-ordered-release invariant. Renames the branch-internal [1.50.0.0] CHANGELOG entry to [1.51.1.0] — 1.50.0.0 never landed on main (main skipped to 1.51.0.0), so this consolidates the branch's brain-aware planning + save-results work under a single shipping version with no orphaned entry. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * v1.52.2.0 fix(make-pdf): render emoji instead of tofu (▯) on Linux (#1787) * fix(make-pdf): emoji font fallback in print CSS Emoji code points rendered as .notdef tofu (▯) because the body and @top-center font stacks had no emoji family for Chromium to fall back to. Add SANS_STACK / CJK_STACK / EMOJI_FAMILIES constants (one source of truth per family list) and append the emoji families before the generic sans-serif in the two stacks that can hold emoji. The @bottom-* boxes hold counters / a fixed CONFIDENTIAL string, so they share SANS_STACK without emoji. Non-emoji output is byte-identical. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> * feat(setup): auto-install color-emoji font on Linux macOS and Windows ship a color-emoji font; most Linux distros/containers ship none, so make-pdf emits tofu there. ensure_emoji_font() best-effort installs fonts-noto-color-emoji (apt, with dnf/pacman/apk fallbacks) and refreshes the fontconfig cache. Hardened: Linux-only guard, GSTACK_SKIP_FONTS escape hatch, fc-match color=True detection (the broad fc-list query false-matched LastResort), sudo -n so a password prompt fails fast instead of hanging, DEBIAN_FRONTEND=noninteractive, timeout 30 on apt update, and fc-cache under sudo. Warns instead of failing. After a fresh install, refresh_browse_daemon_for_fonts() runs 'browse stop' so the next render spawns a Chromium that sees the new font (font fallback is process-cached). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> * test(make-pdf): emoji render gate (pdffonts + pixel proof) pdftotext is a false oracle for emoji: Skia preserves the Unicode in the text cluster even when the glyph drew as .notdef tofu, so extraction passes on a broken render. The gate instead asserts (1) pdffonts shows an emoji family embedded and (2) pdftoppm rasterizes the page to color (measured ~1650 saturated pixels vs ~0 for tofu). pdfimages is not used: macOS embeds color emoji as Type 3 fonts, so it lists nothing even on a correct render. Adds resolvePopplerTool() (DRY resolver, returns null for clean skips) and a fixture exercising FE0F variation-selector emoji. Skips cleanly when poppler tools or a color-emoji font are unavailable. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> * ci(make-pdf): install emoji font + run emoji gate on Ubuntu Install fonts-noto-color-emoji before Chromium launches on the Ubuntu leg (macOS already ships Apple Color Emoji), refresh fontconfig, and log the fc-match result. Run the whole make-pdf/test/e2e/ dir so the emoji gate runs alongside the combined-features copy-paste gate. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> * harden(make-pdf): emoji gate + font install per adversarial review Codex adversarial pass on the implementation diff flagged five robustness gaps, all fixed here: - emoji-gate skipped green in CI when poppler/font prerequisites were absent, which could let the tofu regression ship behind a green build. Missing prerequisites are now a HARD FAILURE when process.env.CI is set; local dev still skips cleanly. - execFileSync children (make-pdf, pdffonts, pdftoppm, fc-match) had no timeout; a wedged binary or hostile GSTACK_*_BIN override could hang the job past Bun's test timeout. Each child now has a 25s ceiling. - PPM parser trusted header tokens blindly; malformed/variant output gave a silently-wrong count. Now validates magic/dimensions/maxval and pixel-buffer length, handles header comments, throws a hard diagnostic on mismatch. - predictable /tmp paths were collision/symlink-prone; now mkdtempSync under /tmp (kept under /tmp for browse's validateOutputPath allowlist). - only apt-get update was timeout-wrapped; dnf/pacman/apk installs and apt install can hang on locks/mirrors. All package installs now timeout-bound. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> * chore: bump version and changelog (v1.52.2.0) Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> * docs(make-pdf): document color-emoji font requirement + GSTACK_SKIP_FONTS Extend the Linux font note to cover the color-emoji font that make-pdf emoji rendering needs: setup auto-installs fonts-noto-color-emoji, the print CSS falls back through Apple/Segoe/Noto emoji families, and GSTACK_SKIP_FONTS=1 opts out. Edit the .tmpl and regenerate SKILL.md. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com> * chore: bump version and changelog (v1.53.0.0) Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com> |