Summary
Extend setupOpenClawOrchestrator.ts so reruns always provision and preserve OpenClaw GitHub mention orchestration (@githubap, @ClawEngineer) in an idempotent way.
Required behavior
- Add dedicated
configureGithubMentionHooks(...) setup step after gateway/model config.
- Ensure config keys are set each run:
hooks.enabled=true
hooks.token=${OPENCLAW_HOOKS_TOKEN} (generate once if missing and persist in ~/.openclaw/.env)
hooks.allowRequestSessionKey=true
hooks.allowedSessionKeyPrefixes=["hook:github:"]
hooks.transformsDir="~/.openclaw/hooks/transforms"
- Upsert mapping
hooks.mappings["github-mentions"]:
- action
agent, agentId=main
transform.module="github-mentions.ts"
- match for
issue_comment, pull_request_review_comment, discussion_comment plus optional pull_request_review submitted body via transform.
- Materialize transform file
~/.openclaw/hooks/transforms/github-mentions.ts with:
- mention filter for
@githubap and @ClawEngineer (CLI override supported)
- loop prevention for bot/self authors
- deterministic session key format:
hook:github:<owner>/<repo>:<kind>:<id>
- structured agent payload message
- HMAC verification with
GITHUB_APP_WEBHOOK_SECRET
- Print final webhook metadata in JSON output:
webhookPath, hooksEnabled, mentionsHandles, transformPath
CLI/options
- Add repeatable:
--github-mention-handle <@handle>
- Add opt-out:
--disable-github-mention-hooks
- Add explicit rotation flag:
--rotate-hooks-token
Idempotency
- Never rotate existing
OPENCLAW_HOOKS_TOKEN unless --rotate-hooks-token is provided.
- Never rewrite transform when content hash is unchanged.
- Preserve existing custom mappings; only upsert/remove
github-mentions entry.
- Hard fail if mention hooks are enabled but
GITHUB_APP_WEBHOOK_SECRET is missing.
Validation
- Fresh run creates hooks config + transform + token.
- Re-run does not duplicate mapping or churn token.
- Mention payload accepted only with valid signature and matching handle.
- Non-mention/bot payload ignored.
- Config smoke verifies hooks settings and mapping target.
Summary
Extend
setupOpenClawOrchestrator.tsso reruns always provision and preserve OpenClaw GitHub mention orchestration (@githubap,@ClawEngineer) in an idempotent way.Required behavior
configureGithubMentionHooks(...)setup step after gateway/model config.hooks.enabled=truehooks.token=${OPENCLAW_HOOKS_TOKEN}(generate once if missing and persist in~/.openclaw/.env)hooks.allowRequestSessionKey=truehooks.allowedSessionKeyPrefixes=["hook:github:"]hooks.transformsDir="~/.openclaw/hooks/transforms"hooks.mappings["github-mentions"]:agent,agentId=maintransform.module="github-mentions.ts"issue_comment,pull_request_review_comment,discussion_commentplus optionalpull_request_reviewsubmitted body via transform.~/.openclaw/hooks/transforms/github-mentions.tswith:@githubapand@ClawEngineer(CLI override supported)hook:github:<owner>/<repo>:<kind>:<id>GITHUB_APP_WEBHOOK_SECRETwebhookPath,hooksEnabled,mentionsHandles,transformPathCLI/options
--github-mention-handle <@handle>--disable-github-mention-hooks--rotate-hooks-tokenIdempotency
OPENCLAW_HOOKS_TOKENunless--rotate-hooks-tokenis provided.github-mentionsentry.GITHUB_APP_WEBHOOK_SECRETis missing.Validation