Repository navigation
v1.92.23.0 feat(harness): opt-in start hook for OpenClaw and Hermes, so agents run a skill's start command (GST-718) - #3786
Conversation
gstack-harness register openclaw|hermes --start-hook (or GSTACK_HARNESS_START_HOOK, or gstack-config harness_start_hook) adds a gstack-start plugin that puts a one-line note on every user turn to run a gstack skill's start command as written. Activation goes through each harness's own CLI and is read back; a run that turns it on and ends inactive exits 4. Off by default. Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
…nd never re-enable a user disable (GST-718) Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
…n folder turns the hook off instead of failing refresh (GST-718) Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
…tion, re-enable after kept edits Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
…t edits Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
… paths; a failed opt-out can rerun; a saved hook survives OPENCLAW_CONFIG_PATH Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
… opt-out deletes through it Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
… an interrupted explicit activation, symlink checks on every hook opt-out and folder cleanup Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
|
😎 This pull request was merged. |
E2E Evals: ✅ PASS (flaky: 1 case(s) passed on their one rerun)125 executed, 0 reused rule/judge records | 0 manual accepted (unscored; no score-cache credit) | $33.70 rule/judge cost | reconcile exit: 0 Profile: pr / mode Derived dependents (scripts/pr-dependencies.ts):
Rule and judge shards
Fail-closed reconciliationSliced lane: planner → duration-packed executors → fail-closed report. Behavior cases run a pre-registered 3-trial panel (PASS at 2/3 with no contract violation); a PASS 2/3 is shown with its failed trial, never as a clean pass. Reused results retain their original provenance and expiry. Flaky: failed once, passed on its one rerun (rule 16)Each failed and passed on its rerun in run 41286154098 at the attempts named above. Logged for the daily flaky-fix pass in this run's Dispatched narrow screen (gstack-ship-queue ready --screen) of merge commit |
What changed
gstack-harness register gains an opt-in
--start-hookfor OpenClaw and Hermes, off unless you ask.Before/after as text: gstack-harness register gains an opt-in --start-hook for OpenClaw and Hermes, off unless you ask
Why
HARN-18's keyless runs found that agents in OpenClaw and Hermes read gstack's skills but ran the skill's start command on 1 of 29 chances (HARN-18 free report, GSTA-135 handoff
harn18-free-report.md). Garry approved an opt-in hook on 2026-11-01 ("Keep and do it", GST-718). Now--start-hook(orgstack-config set harness_start_hook on, orGSTACK_HARNESS_START_HOOK=1) adds agstack-startplugin that puts one short note on every user turn, so HARN-18's three-arm panel can measure whether that note changes the rate.Blast radius
Nothing changes for anyone who does not opt in. With no flag, env var or config value,
registerwrites no plugin and runs no harness command (test "default registration adds no plugin and runs no harness command"). For people who opt in, the change touches OpenClaw'sopenclaw.jsonor Hermes'sconfig.yamlonly through each harness's own CLI, with an environment of PATH, HOME and the profile variable only. I ran both real CLIs in temporary profiles with a temporary HOME and no keys, and both reported the hook active.Approvals
Source: gstack-approvals record for gst-718-start-hook (display only; not an approval citation).
The second and third rows are GStack Minder's calls under Garry's 2026-11-01 "Keep and do it", not new words from Garry. The third row (gate_rev 3) uses the same reply as the second. It also accepts the plan v3 changes (uc1-uc3) that no autoplan phase reviewed, because every phase had reached its round cap. GStack Minder separately approved one review pass beyond the rule 23 cap (approval a-ccf991b44100).
Summary
Agents in OpenClaw and Hermes skipped gstack's start command, so the skills ran without their preamble. This PR adds an opt-in
gstack-startplugin for OpenClaw'sbefore_prompt_buildhook and Hermes'spre_llm_callhook. gstack turns it on through each harness's own CLI and reads it back, and an explicit opt-in that does not end active exits 4 after the skills are registered (HARNESS_HOOK_INACTIVE). The choice follows one order (flag, then env, then gstack-config, then the saved ledger choice), and it is saved across refreshes and upgrades. A plugin the user disables in the harness stays off. Each profile has one owner, so agstack-startfolder this registration did not write is refused (HARNESS_HOOK_OWNED_ELSEWHERE).--no-start-hook, unregister and uninstall turn it off through the harness and keep any edited file. Review hardened teardown: no deletes through a symlink below the profile, Hermes only disables a plugin folder holding a kept edit, and a failed or interrupted run can be rerun.Test Coverage
New
test/harness-start-hook.test.ts(fake openclaw and hermes CLIs on PATH, so it runs no harness and spends nothing) covers each item in the round-2 resolution map:--skills-dir,OPENCLAW_CONFIG_PATH): "an invalid choice and a hook for a target or folder without one stop before anything is written"; "a profile path with a trailing slash under a symlinked parent still takes the hook"../setup --host).config unset); "unregister removes the plugin through Hermes"; "bash-only uninstall: an edited plugin file is kept and Hermes only disables it".ANTHROPIC_API_KEYandOPENCLAW_CONFIG_PATHand the temporary HOME. This deviates from the plan. WhenOPENCLAW_CONFIG_PATHis set, the hook is refused (or left off for an env or config opt-in), instead of clearing the variable, because a cleared variable would edit a config OpenClaw does not read.Each review fix landed with a test that fails on the code before it. Tests ran: harness 82, guards 19.
Pre-Landing Review
The review found real bugs, and all of them are fixed. They were an inactive hook failing refresh, a refresh re-enabling a user disable, Hermes uninstall deleting kept edits, teardown following a swapped symlink, a failed opt-out stranding files, a one-shell
OPENCLAW_CONFIG_PATHturning off a saved opt-in, an interrupted activation never retried, and a trailing slash breaking the symlink check. GStack Minder allowed one pass beyond the rule 23 cap to fix four more items rated Low. The final native adversarial pass at the frozen tree said: "I found nothing at the blocking floor."REVIEW_LOOP: passes=3 blocking_found=0 deferred=0 noted=3 fixed=1 scope=unknown fix_checks=2
The line above is the tool's summary of the review-log rows. Those rows were logged after the passes ran, so its counts are not a full tally. The full tally: pass 1 found 2 CRITICAL, both fixed. The pass 3 voices found 4 CRITICAL (3 from the outside voice, 1 native), all fixed. 3 INFORMATIONAL findings from pass 3 and 2 from the fix-checks were fixed. Each fix has a test that fails first. Two passes bound to the frozen tree followed: f276da8 (4 FIXABLE, fixed in the extra pass) and 7e8cb67 (nothing at the blocking floor). Below-floor items are listed under Review notes.
Gate edits: 1 hunk tagged in
bin/gstack-config(a newharness_start_hookkey with on/off validation). It adds a check and relaxes none.Outside review: the cross-family outside voice (openai/gpt-6.1-sol) completed on pass 3 and its three findings are fixed.
Review notes
Below the blocking floor, left as follow-ups:
config unsetwhile you turn the hook off, the ledger says off andplugins.entries.gstack-startstays enabled. Turning off ignores the release's exit status (lib/harness-register.ts).timeoutis missing (stock macOS), a hung harness CLI hangsgstack-uninstall.parseJsonstill fails when a CLI prints a log line after its JSON. It is not verified that the real CLIs ever do this.GSTACK_HARNESS_START_HOOK=enabled) fails refresh loudly for every later registration.gstack-harness autodoes not exit 4 on an inactive hook. Stderr still says so..edited-*copies, the ledger dropshook_profile. A later symlink swap can then remove an empty folder through it, and no data is lost.inspectHookdoc comment sits aboveREAD_TIMEOUT.docs/troubleshooting.md#harness-unsafe-destinationdoes not yet describe the start-hook symlink refusals.ledger:andremove:lines can be missing from the setup log when register exits 4. stderr keeps the fix.Exploratory QA
Step 9.2.1 QA passed. Beyond the fakes, the real
openclawandhermesbinaries ran in temporary profiles with a temporary HOME and no keys. At b9fda18,register --start-hookprintedstart hook: activeand exited 0 for both (exit codes read directly withpipefailset), and both unregistered with exit 0. An earlier run of the same check also covered disable, refresh and--no-start-hook.Design Review
No frontend files changed, so design review was skipped.
Eval Results
No paid gstack eval ran on this PR. The plugin's note is a prompt the harness adds to each user turn, but gstack's eval suites do not run OpenClaw or Hermes. Measuring the note is HARN-18's three-arm panel, which runs after merge and has not run yet. This PR does not claim the note changes behavior. It ships the opt-in switch the panel needs. The merge queue's narrow screen (evals.yml run 41286154098) covers the shared runtime this PR touches.
Plan Completion
Plan v3 (autoplan run autoplan-20261101001825, APPROVED gate_rev 3) is built: an opt-in hook, the hook alone, and unchanged entry text. Two deviations. First,
OPENCLAW_CONFIG_PATHis refused instead of cleared (see Test Coverage). Second, the plan said setup should read the hook field with bun, not sed. Setup reads no hook field at all and branches onregister's exit code (4 means the skills are registered and the hook is not active). Setup's existing sed still extracts the receipt for its log, and it cuts the line at an escaped quote, so the hook fix command can be missing from the setup log when register exits 4. stderr still prints it. This is listed under Review notes.TODOS
No TODO items completed in this PR.
Documentation
Status: updated. Two factual doc fixes for the opt-in OpenClaw/Hermes start hook (GST-718), no blockers.
Scope: base 482ffd1, head 7e8cb67 on
gst-718-start-hook, 8 commits and 12 files. There were no staged, unstaged or new files. I checked the docs the branch changed againstlib/harness-start-hook.ts,lib/harness-register.ts,bin/gstack-harness,bin/gstack-harness-ledger.sh,bin/gstack-configandsetup, then grepped the doc tree for other harness, config and uninstall claims.Documentation health:
docs/hosts.md Updated (start-hook "Check it" now lists the
uncheckedstate that receipts andstatus --no-checkprint)docs/uninstall.md Updated (the script line mentions turning off the start hook; manual removal now says how to turn off and delete the
gstack-startplugin)docs/OPENCLAW.md Current (start-hook paragraph matches the code)
docs/troubleshooting.md Current for the four new HARNESS_HOOK_* entries (headings match the error text); see debt
changelog.d/gst-718-start-hook.md Current (matches docs/hosts.md)
README.md Current (no harness content)
CONTRIBUTING.md Current
CHANGELOG.md Skipped (ship-owned: not touched)
TODOS.md Skipped (ship-owned: not touched)
Documentation coverage:
[entity] [reference] [how-to] [tutorial] [explanation]
register --start-hook/--no-start-hook✅ hosts.md ✅ hosts.md ❌ ✅ hosts.mdharness_start_hookconfig key ✅ hosts.md, gstack-config header ✅ hosts.md ❌ ❌GSTACK_HARNESS_START_HOOK✅ hosts.md ✅ hosts.md ❌ ❌exit 4 / HARNESS_HOOK_* codes ✅ troubleshooting.md ✅ troubleshooting.md ❌ ✅ troubleshooting.md
Documentation Debt
HARNESS_UNSAFE_DESTINATION(docs/troubleshooting.md#harness-unsafe-destination): the entry does not cover the start-hook refusals (a symlink between the harness profile andgstack-start, or a profile that is not a plain absolute path), and its fix text sends users to the skills folder. Needs a reference fix in the doc and inHARNESS_CODES.Diagram drift: none (no diagrams reference the changed code).
Test plan