Skip to content

Skills load their declared gbrain context at start, and harness status says unknown when its list fails - #4687

Merged
capy-ai[bot] merged 2 commits into
mainfrom
skill-start-gbrain-context-and-harness-status
Nov 22, 2026
Merged

capy-ai[bot] merged 2 commits into
mainfrom
skill-start-gbrain-context-and-harness-status

Conversation

@garrytan

@garrytan garrytan commented Nov 22, 2026 •

Copy link
Copy Markdown
Owner

/office-hours, /plan-ceo-review, /design-shotgun, /design-consultation and /retro now load the brain context they declare when they start, skill start stops telling a read-only repo to run a sync that can't help, and gstack-harness status says unknown when a harness's skill list fails.
Why: three outside reports (#4329, #4419, #4412), each reproduced on main by a test that fails before this change and passes after it.
Nothing to do; gstack-config set gbrain_context_load off turns the context load off.

What changed
Report Before After Test
#4329 (reported by @exGeni) nothing ran gstack-brain-context-load, though its header, setup-gbrain/memory.md and the 1.26.0.0 notes said every skill start did; the 16 declared queries never ran and gbrain_context_load off had no reader gstack-skill-start runs the loader for a skill whose SKILL.md declares gbrain.context_queries, only when gbrain is configured, never in a deny repo, and not when gbrain_context_load is off; output goes through the same _sanitize as learnings and keeps the loader's data envelope test/skill-start-gbrain-context.test.ts
#4419 (reported by @exGeni) in a read-only repo the unpinned hint said to run /sync-gbrain --full, which skips code ingest by policy and never pins, so the hint came back every start read-only gets a line saying code isn't indexed there and how to change the tier; deny gets no gbrain hint same file
#4412 (reported by @exGeni) harnessSees searched OpenClaw's AGENT_SELECTION_REQUIRED error text for skill names and reported every registered skill missing a failed or erroring list command is unknown with its first error line; a completed list still reports what is missing; docs/hosts.md notes --agent <id> test/harness-sees-failed-list.test.ts
Why

Each report described a skill start or status line that said one thing and did another, so people saw hints they could not act on or missing skills that were really there.

Blast radius

Only the five skills that declare queries run the loader; the generic fallback the loader has for other skills stays unwired. Each run is bounded by the loader's 500 ms per gbrain query, and a repo policy that can't be read counts as deny, so a broken store never turns brain access on (file read and test run: test/skill-start-gbrain-context.test.ts). The policy lookup reads the existing gbrain-repo-policy.json store with get --batch, which never moves a corrupt store aside.

Security read

Process spawning: skill start now spawns gstack-gbrain-repo-policy get --batch and, for the five skills, bun gstack-brain-context-load.ts with the Bun isolation flags; the skill name is checked against ^[a-z0-9-]{1,60}$ before it forms a path, and the SKILL.md path is inside the gstack checkout. Brain content reaching the model is wrapped in the loader's USER_TRANSCRIPT_DATA do-not-interpret-as-instructions envelope and passed through _sanitize, which strips forged GSTACK_INSTRUCTION and SESSION_ID: lines. A deny repo gets no gbrain call. No CI, install, dependency, auth or network change beyond the gbrain queries the loader already makes.

Test Coverage

Coverage: 83% value-weighted (83% including 0 weakly covered paths). Test value: 0 tests written, 0 rejected by the authoring gate, 0 existing tests extended, 0 paths weakly covered. Two small gaps stay open: the gstack-harness status line printing the error text, and a test that passes a bad skill name.
Tests ran: targeted 204

Pre-Landing Review

No blocking issues found in the final read-only review of this head. Earlier rounds fixed one blocker (skill start read the policy store with plain get, which could turn a corrupt store into "no policy"). Four second-model findings were ruled notes by the owner, listed in the agent notes.

Review notes

Below the blocking floor (advisory, informational, test-gap or wording items); recorded here and not fixed in this PR.

  • INFORMATIONAL sf-7f377291dcec security finding, details recorded privately
  • INFORMATIONAL bin/gstack-skill-start:417 pinned deny repo still gets the gbrain search hint (Low, Blocks: no)
  • INFORMATIONAL bin/gstack-skill-start:411 without jq every repo reads as deny, silently (Low, Blocks: no)
  • INFORMATIONAL lib/harness-register.ts:741 non-zero list exit reads unknown even with a valid list (Low, Blocks: no)
  • INFORMATIONAL bin/gstack-harness:130 first stderr line printed raw into status output (Low, Blocks: no)
Issues

Fixes #4329
Fixes #4412
Fixes #4419

Exploratory QA

No separate probe ran on this head. The final review's readers ran the two new test files (5 pass) and six neighbouring files (53 pass), and CI's full free suite passed at this tree.

Documentation

Scope: the committed diff on skill-start-gbrain-context-and-harness-status against main, which covers loading gbrain context at skill start for skills that declare context_queries, the read-only and deny repo-policy hints, and gstack-harness status reporting unknown with the harness error. The worktree had no staged, unstaged or new files.

Result: current. docs/hosts.md and setup-gbrain/memory.md were already updated in this branch and match the code. The five skills that declare context_queries match the skills the docs name, and the gbrain_context_load off switch is documented. No doc edits were needed.

Debt: historical CHANGELOG.md entries still say context load runs at every invocation. They were left as written because they are past release notes.

Tests
  • bun test on the 6 affected test files: 204 pass, 0 fail at 86cfbec
  • CI free-tests run 44996963175 at this tree: green, carried
Agent notes

Agent notes

Outside items triaged under GSTA-799 and built on main per R45 (issues only, no outside code carried).

Open in Capy

Approvals

Approved: yes (record r-249b53055310). The full approval record stays private.
Plan: exempt: bug fix (#4329, #4419, #4412)
Plan check: exempt bug fix

REVIEW_LOOP: passes=1 blocking_found=0 deferred=0 noted=5 fixed=0 scope=frozen unbound=1 ledgers_read=2 dispatches=4
Gate edits: none detected (2 listed, 0 read; patterns: RH-1,RH-3,RH-4,RH-12,RH-13,RH-14,RH-15,RH-16; unlisted idioms: none)
Ruled note: redacted at 86cfbec ruled by GSTA-36 at 2026-11-22T06:38:36.830Z: security finding, details recorded privately (approval a-cdff70819c3e)
Ruled note: bin/gstack-skill-start:438:reliability at 86cfbec ruled by GSTA-36 at 2026-11-22T06:38:36.981Z: context loader spawns gbrain directly: unchanged existing code (approval a-201b0e98d345)
Ruled note: bin/gstack-skill-start:417:correctness at 86cfbec ruled by GSTA-36 at 2026-11-22T06:38:37.083Z: pin overrides deny only in the hint text; the context load stays blocked (approval a-8825b58a58a1)
Ruled note: bin/gstack-skill-start:400:correctness at 86cfbec ruled by GSTA-36 at 2026-11-22T06:38:37.185Z: remote-MCP-only installs get no context load: unchanged existing code (approval a-1217e9cc6b10)

{
  "schema_version": 1,
  "pr": 4687,
  "head": "86cfbec6a53ba73e87c3aa2f4e83e57b9e422fdd",
  "version": "1.102.2.0",
  "base": "main",
  "gate": {
    "targeted": {
      "pass": 204,
      "fail": 0,
      "skip": 0
    }
  },
  "calls": 28,
  "session_kind": "unattended",
  "run": "/home/user/.gstack/ship-runs/ship-20261122T063915-c7b483",
  "head_tree": "544026086d6ca313f61c7a6275937ea94c4f923d",
  "product_patch_id": "6a1bd96da1d7c817c989ec338f3c63bc90753eac",
  "gstack_version": "1.102.2.0",
  "review_depth": {
    "depth": "light",
    "class": "code",
    "runtime_lines": 47,
    "rules": "630fd3101899e28e",
    "base": "ef72e4142fb0972089c41286fc160374d3f191c4",
    "registry": "ef72e4142fb0972089c41286fc160374d3f191c4",
    "gate_scan": {
      "tagged": 0,
      "head": "86cfbec6a53ba73e87c3aa2f4e83e57b9e422fdd"
    },
    "reasons": [
      "runtime=47"
    ],
    "risk": [],
    "mode": "panel"
  },
  "pregate": "requires-remote cleared @544026086d6c (8 checks, current for 86cfbec6a53b)",
  "requires_remote": [
    "free-tests.yml/macos-named-regressions: https://github.com/garrytan/gstack/actions/runs/44996963175/attempts/1",
    "pregate.json/remote_gate: remote-gate tree=544026086d6c tests=38820 skipped=89 runs=44996963175/1 profiles=ci-reuse/free-tests heads=86cfbec6a53b verified=2026-11-22T07:41:04.082Z"
  ],
  "issues": {
    "fixes": [
      4329,
      4412,
      4419
    ],
    "refs": [],
    "flakes": []
  },
  "docs": {
    "status": "current",
    "scope": "docs/, README.md, setup-gbrain/ against the branch diff"
  },
  "review_loop": {
    "passes": 1,
    "blocking_found": 0,
    "deferred": 0,
    "noted": 5,
    "fixed": 0,
    "scope": "frozen",
    "rounds": 1,
    "ledgers_read": 2,
    "unbound": 1,
    "dispatches": {
      "specialist": 3,
      "red-team": 1
    }
  },
  "ruled_notes": [
    {
      "finding": "redacted",
      "head": "86cfbec6a53ba73e87c3aa2f4e83e57b9e422fdd",
      "by": "GSTA-36",
      "reason": "security finding, details recorded privately",
      "at": "2026-11-22T06:38:36.830Z",
      "approval": "a-cdff70819c3e"
    },
    {
      "finding": "bin/gstack-skill-start:438:reliability",
      "head": "86cfbec6a53ba73e87c3aa2f4e83e57b9e422fdd",
      "by": "GSTA-36",
      "reason": "context loader spawns gbrain directly: unchanged existing code",
      "at": "2026-11-22T06:38:36.981Z",
      "approval": "a-201b0e98d345"
    },
    {
      "finding": "bin/gstack-skill-start:417:correctness",
      "head": "86cfbec6a53ba73e87c3aa2f4e83e57b9e422fdd",
      "by": "GSTA-36",
      "reason": "pin overrides deny only in the hint text; the context load stays blocked",
      "at": "2026-11-22T06:38:37.083Z",
      "approval": "a-8825b58a58a1"
    },
    {
      "finding": "bin/gstack-skill-start:400:correctness",
      "head": "86cfbec6a53ba73e87c3aa2f4e83e57b9e422fdd",
      "by": "GSTA-36",
      "reason": "remote-MCP-only installs get no context load: unchanged existing code",
      "at": "2026-11-22T06:38:37.185Z",
      "approval": "a-1217e9cc6b10"
    }
  ],
  "gate_dispositions": []
}

…ys unknown when its list fails

gstack-skill-start now runs gstack-brain-context-load for a skill whose
SKILL.md declares gbrain.context_queries, honoring gbrain_context_load off
and never in a deny repo (#4329). The unpinned /sync-gbrain hint follows the
repo's gbrain policy tier (#4419). harnessSees reports a failed list command
as unknown with its first error line instead of every skill missing (#4412).

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

trunk-io Bot commented Nov 22, 2026 •

Copy link
Copy Markdown

😎 This pull request was merged.

…pt store

A corrupt policy store now counts as deny at skill start instead of being moved aside and read as unset, so a set deny tier is never bypassed.

Review-Finding: p1/specialist-batched#1 reader=security
Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant