Skip to content

fix: escape backticks in umbrella-gates rules template (pi extension parse error) - #7

Merged
github-actions[bot] merged 2 commits into
mainfrom
feat/fix-umbrella-gates-backtick-parse
Aug 22, 2026
Merged

github-actions[bot] merged 2 commits into
mainfrom
feat/fix-umbrella-gates-backtick-parse

Conversation

@atrawog

@atrawog atrawog commented Aug 22, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Fixes the pi extension load failure at the umbrella root:

Error: Failed to load extension ".../.pi/extensions/umbrella-gates.ts": ParseError: Missing semicolon.
 ...umbrella-gates.ts:100:7

The buildRulesBlock() template literal contained an unescaped backtick pair around `CHANGELOG/<calver>.md` (line 100). The first backtick terminated the template literal early, producing invalid syntax. As a result pi's jiti loader rejected the module and the extension never loaded — killing all three of its functions at once: the bash tool_call gate interception (pre-commit/pre-push mechanics), the umbrella_load_skills tool, and the every-turn system-prompt rules injection.

The fix escapes the pair to \`CHANGELOG/<calver>.md\`, matching the already-correct pattern on the Assisted-by line (line 102). The same change ships an in-tree regression gate (scripts/check-umbrella-gates-syntax.mjs, wired into task verify and .github/workflows/verify.yml) so the repo's own CI fails on a recurrence of this defect.

Claim-keyed sweep — command + real output (run on the committed tree):

$ grep -n '`' .pi/extensions/umbrella-gates.ts
5: * Fork of charly's `charly-gates.ts` (see HARNESS-PARITY.md — keep in sync
11: * extension is the Pi equivalent of the `.reasonix`/kimi `PreToolUse(Bash)`
12: * wiring of `.claude/hooks/pre-commit-gate.sh` and `pre-push-gate.sh`. It
13: * intercepts every `bash` tool call and runs both gate scripts against the
18: *   - `git commit --no-verify` / `-n` / `core.hooksPath` bypass
20: *   - `git push --force` / `--force-with-lease` / `-f`
21: *   - a direct push to `main`
41: * do not mention `git commit` / `git push`), so running them for every bash
59:  return `## Umbrella Engineering Rules
62:Before the first tool call of every task, use \`umbrella_load_skills\` to load the
77:pin is a sync (\`task sync\` + PR), not a hand-pin.
83:Check \`git status\` before destructive actions. No force-push, pushed-history
84:rewrite, hook bypass, or direct push to \`main\`. Run submodule git through
85:\`git -C <path>\` from the umbrella root. Never edit inside a submodule.
88:Run \`task verify\` (the CI gate) on the final tree and retain the output.
100:   to \`CHANGELOG/<calver>.md\` at merge time
102:   footer in the EXACT form, e.g. \`*Assisted-by: pi openrouter/deepseek/deepseek-v4-flash-0731 (fully tested and validated)*\` (rule A1)
107:| \`fully tested and validated\` | \`task verify\` passed on the final tree; changed paths executed live |
108:| \`analysed on a live system\` | Changed runtime path ran live with retained output; full gate did not pass |
109:| \`documentation reviewed\` | Docs-only change class (forbidden if pins/scripts changed) |
110:| \`syntax check only\` | Dry-run only — do not commit |
111:| \`theoretical suggestion\` | No validation — never ship |
116:defective cycle.`;
137:    const path = match[2].trim().replace(/`/g, ""); // Strip Markdown backticks
238:          results.push(`=== ${skillDir}/SKILL.md ===\n${skillContent}`);
240:          results.push(`[SKILL NOT FOUND: ${skillPath} — tried ${globalPath}]`);
250:                `No skills matched triggers: ${params.triggers.join(", ")}. ` +
251:                `Available dispatcher entries: ${dispatcher.length}. ` +
252:                `Try broader keywords or check AGENTS.md for the full list.`,
264:              `Loaded ${results.length} skill(s) matching your triggers.\n\n` +
291:      `umbrella-gate-${process.pid}-${Date.now()}-${Math.random().toString(36).slice(2)}.json`,
307:          result = await pi.exec("bash", ["-c", `"${script}" < "${tmp}"`], {
320:            reason: `umbrella gate (${rel}) BLOCKED: ${detail || "command violates a git-workflow mechanic"}`,

Interpretation: the buildRulesBlock template literal spans lines 59–116; every backtick-bearing line inside it uses the escaped \` form except line 100, which now carries the escaped pair — the only line that had bare backticks before this fix. Line 137 is a RegExp literal (//g`), not a template. Lines 238–320 are separate template literals with correctly matched delimiters. Conclusion: line 100 was the sole unescaped backtick inside a template literal.

Fork-specificity — the defect is not upstream charly's (read-only check, submodule):

$ grep -c 'CHANGELOG/<calver>' charly/.pi/extensions/charly-gates.ts
0

How tested

RCA of the red validate / validate check on the earlier head 2ddd7c8: the check run was the pr-validator's first review of this PR (run 32598245495), which BLOCKed on two body findings — B14(d) unpasted sweep claim and A1 missing R5/R9 rows. Both are resolved in this body (sweep pasted above; R5/R9 rows present below); the second validator run marked both findings stale-superseded. Nothing in the tree caused the failure — it was a review verdict on the earlier body. The check re-runs on this new head (synchronize) and must land green.

  1. In-tree regression gate — fails on the pre-fix file, passes on the fixed tree (new scripts/check-umbrella-gates-syntax.mjs, run through Node's own type-strip parser):
$ node scripts/check-umbrella-gates-syntax.mjs /tmp/umbrella-main.ts    # origin/main (pre-fix)
FAIL: /tmp/umbrella-main.ts does not parse:
Expected ';', got 'ident'
exit=1

$ node --disable-warning=ExperimentalWarning scripts/check-umbrella-gates-syntax.mjs   # fixed tree
OK: /home/atrawog/Sync/Atrapub/coder/pi/opencharly/.pi/extensions/umbrella-gates.ts parses (node type-strip pass)
exit=0
  1. Live load through pi's own loader (jiti) — replicates dist/core/extensions/loader.js (createJiti + the same @earendil-works/pi-coding-agent/typebox aliases, jiti.import(path, { default: true })):
$ node /tmp/test-umbrella-gates-load.mjs /tmp/umbrella-main.ts        # origin/main version
[Error: ParseError: Missing semicolon.
 /tmp/umbrella-main.ts:100:7]

$ node /tmp/test-umbrella-gates-load.mjs .pi/extensions/umbrella-gates.ts   # fixed
OK: module loaded, factory is a function
OK: factory executed; registered 1 tool(s): umbrella_load_skills
OK: subscribed to channels: before_agent_start, tool_call
LOAD TEST PASSED
  1. R10 — gate on the final committed tree (task verify now runs pins + harness syntax):
$ task verify
task: [verify] bash scripts/verify-pins.sh
verify-pins: OK — 23 submodules, policy B holds
task: [verify] node --disable-warning=ExperimentalWarning scripts/check-umbrella-gates-syntax.mjs
OK: /home/atrawog/Sync/Atrapub/coder/pi/opencharly/.pi/extensions/umbrella-gates.ts parses (node type-strip pass)
exit=0
  1. Harness parity (unchanged shared files):
$ task harness
task: [harness] bash scripts/check-harness-parity.sh
check-harness-parity: OK — 6 shared harness files identical to charly/
  1. Mirror audit — opencode plugin (the umbrella's other gates host; it is a different implementation with no template literals):
$ grep -c '`' .opencode/plugin/umbrella-gates.ts
0
$ grep -n 'buildRulesBlock\|CHANGELOG/<calver>' .opencode/plugin/umbrella-gates.ts
(no output, exit 1)

Rulebook compliance

Rule Applicability
R1 — RCA every anomaly Parse error root-caused (unescaped backtick terminating the template literal at 100:7), reproduced against origin/main before fixing; the red validate check RCA'd above
R2 — no deferral Fixed in this change, no follow-up classification
R3 — no duplication One-line escape fix + one canonical regression gate (the syntax script owns the check); no new abstraction needed (escape pattern already exists on line 102)
R4 — no workarounds No sleeps/retries/pins; the gate uses Node's built-in type-strip parser (zero deps), not a fragile grep
R5 — no stale identifiers N/A — no identifiers removed/renamed; the only sweep (backtick claim sweep, pasted above) is clean
R6 — git safety git status checked before branching; no force-push, no direct push to main
R7 — prove the gate task verify (now pins + harness syntax) and task harness both green (output pasted above); CI verify workflow extended with the same syntax step
R8 — harness parity .pi/extensions/umbrella-gates.ts is a fork (not a shared file) — task harness confirms the 6 shared files remain identical to charly/; opencode mirror audit pasted above (no backticks, no template literals)
R9 — artifact rebuild N/A — no deployed binary / target-image rebuild; the added CI step runs the syntax gate, not a rebuild
R10 — fresh disposable proof Syntax gate + load test re-run against the committed tree (git show HEAD:... / task verify on the final tree), not the edited state

Change classification

  • Change class: bugfix (harness configuration — pi extension source + regression gate)
  • Verification gate: task verify (R7) + in-tree syntax gate + live load test through pi's jiti loader (R10)
  • Attribution tier: fully tested and validated — task verify passed on the final tree and the changed path (extension load) executed live with retained output

Assisted-by: pi deepseek/deepseek-v4-flash (fully tested and validated)

The buildRulesBlock() template literal contained an unescaped backtick
pair around `CHANGELOG/<calver>.md` (line 100). The first backtick
terminated the template literal early, so pi's jiti loader failed with
"ParseError: Missing semicolon ... umbrella-gates.ts:100:7" and the
extension never loaded — killing the bash gate interception, the
umbrella_load_skills tool, and the every-turn rules injection.

Escape the pair to \`...\`, matching the already-correct pattern on
the Assisted-by line. Upstream charly-gates.ts has no such line, so the
defect is fork-specific.
@github-actions

Copy link
Copy Markdown
Contributor

Review — BLOCK

Head SHA: 2ddd7c8f8148 (branch: feat/fix-umbrella-gates-backtick-parse)

Change class: code/config — one-line backtick-escape fix in .pi/extensions/umbrella-gates.ts (pi extension template literal).

Security screen: PASS — no secrets, no scope mismatch, no weakened guardrails; the fix restores the previously-broken extension load (gates preserved). T4: the change is a minimal syntax repair, matches its stated intent exactly.

Blocks

  1. B14(d) — described-but-unpasted sweep claim (anti-cheat catalog). The Summary asserts: "verified by a claim-keyed sweep of the whole file: line 100 was the only unescaped backtick inside a template literal." No actual sweep command and no sweep output are pasted anywhere in the body. This is exactly the banned "I grepped and found none without pasted output" pattern, and the body relies on it to conclude fork-specificity and that line 100 was the sole defect. The load-test outputs do not substitute for it: on origin/main the parse failed at line 100, so they cannot prove no second unescaped backtick existed later in the original file. Fix: paste the real sweep command and its real output (or drop the unverifiable claim and state the defect was the only one observed).

  2. A1 — rulebook-compliance table is incomplete. The ## Rulebook compliance table covers R1–R4, R6–R8, R10 but omits R5 and R9 with no N/A — <reason> row. Per A1 every applicable rule must be answered with a one-line HOW, and rules excluded by the change class must be marked N/A — <reason>. Fix: add R5 — N/A — no identifiers removed/renamed, no false claims to sweep and R9 — N/A — no deployed binary / target rebuild in this change.

Note (non-blocking)

get_ci_status shows both checks (validate / validate, verify) still in_progress. Ensure they land green on the final head; this does not factor into the verdict above.

Verdict: BLOCK


deepseek.com/deepseek-v4-flash — pi-review-action.

View action run

@github-actions

Copy link
Copy Markdown
Contributor

Review — BLOCK

Head SHA: 2ddd7c8f8148 (branch: feat/fix-umbrella-gates-backtick-parse)

Change class: code/config — one-line backtick-escape fix in .pi/extensions/umbrella-gates.ts (pi extension template literal). Diff matches the summary exactly; fix is syntactically correct (escapes the pair inside the buildRulesBlock() template literal, mirroring the already-correct line 102 pattern); pasted sweep output is internally consistent with the diff.

Blocks

  1. R1/B18 — unexplained CI failure on the current head, no RCA. get_ci_status shows validate / validate = failure (completed) on head 2ddd7c8, while verify = success. The body never mentions the failed validate check: it claims task verify green, pi list clean, and asserts "fully tested and validated", but the repo's own validate gate is red on the exact head under review. Per R1 every failure/warning must carry a root-cause RCA and a real fix; per B18 CI gates must be green on the final head. Fix: root-cause the validate / validate failure (paste its output), fix it in-tree per R2 (no deferral), and show the check green on the final head.

  2. B12 — no in-tree coverage proving the fix. The only regression proof is a /tmp/test-umbrella-gates-load.mjs script that is not in the diff; the repo's own validate gate fails on the head. A fix whose proving test lives outside the tree and whose in-tree gate is red does not satisfy R10 coverage. Fix: ship the load check in-tree (or make the validate workflow itself the green regression gate that fails on the pre-fix file), and show it passing on the committed tree.

  3. B14(d) — unpasted mirror-audit claim. The R8 row asserts .opencode/plugin/umbrella-gates.ts was "audited and free of the defect" with no command or output pasted. This is a described-but-unrun sweep claim; with validate failing, the assertion is unverifiable and potentially contradicted by CI. Fix: paste the real audit command + output, or drop the claim.

Comments considered

  • github-actions[bot] (5382574893) finding 1 (unpasted sweep): stale-superseded — the current body now pastes grep -n '\' .pi/extensions/umbrella-gates.ts` with full output, internally consistent with the diff.
  • Same comment finding 2 (missing R5/R9 rows): stale-superseded — the current body's rulebook table now contains both R5 — N/A and R9 — N/A rows with reasons.
  • Same comment CI note ("ensure they land green"): materialized — verify landed green but validate / validate landed failure, which is block item 1 above.

Verdict: BLOCK


deepseek.com/deepseek-v4-flash — pi-review-action.

View action run

Addresses the pr-validator's B12 finding: the load check that proved the
backtick fix lived only in /tmp. Add scripts/check-umbrella-gates-syntax.mjs
(zero-dependency; runs Node's own type-strip parser over
.pi/extensions/umbrella-gates.ts) and wire it into both task verify and
.github/workflows/verify.yml so the repo's CI gate fails on a recurrence.

Verified: the gate throws on the pre-fix file ('Expected ;, got ident')
and passes on the fixed tree.
@github-actions

Copy link
Copy Markdown
Contributor

Review — PASS

Head SHA: 707a14f99472 (branch: feat/fix-umbrella-gates-backtick-parse)

Security screen: PASS — no secrets/exfiltration; diff matches the stated intent exactly (one-line backtick escape in the pi extension + in-tree regression gate wired into task verify and verify.yml); no weakened guardrails — the change restores the previously-broken bash-gate extension and adds a CI gate.

Checklist: All applicable rules PASS or NA. Change class: harness/config bugfix (no charly runtime, no candies, no generated files — R9/R10 target/bed items N/A with reasons given). A1 complete: all 4 files accounted for (53+/2− matches the diff exactly), task verify + live jiti load test pasted, R1–R10 table fully populated, *Assisted-by: pi deepseek/deepseek-v4-flash (fully tested and validated)* footer present and consistent with the authoring runtime evidence. Prior BLOCK findings all re-derived and resolved on the current head: B14(d) sweep and mirror-audit claims now have pasted command+output; A1 R5/R9 rows present; B12 coverage now shipped in-tree (scripts/check-umbrella-gates-syntax.mjs, demonstrated to FAIL on the pre-fix file and PASS on the fixed tree); the earlier red validate check is RCA'd as the pr-validator's own first-review BLOCK verdict (runs 32598245495/32598394544 on head 2ddd7c8, both visible in the thread), with the checks re-triggered on this head (currently in_progress — no failure on the current head). Placement: CORRECT (fix in the pi extension, gate in scripts/, no core/sdk/candy movement, no alias/kit issues). Two commits noted as intended-squash candidates; no partial/split work pattern.

Comments considered: 5382574893 — both findings stale-superseded; 5382586105 — all three findings stale-superseded (CI red RCA'd, in-tree gate shipped, mirror audit pasted).

Verdict: PASS


deepseek.com/deepseek-v4-flash — pi-review-action.

View action run

@github-actions
github-actions Bot enabled auto-merge (squash) August 22, 2026 21:08
@github-actions
github-actions Bot merged commit f5d8a3c into main Aug 22, 2026
2 checks passed
github-actions Bot pushed a commit that referenced this pull request Aug 22, 2026
…aky cron (#8)

RCA: tag delivery was driven entirely by GitHub's best-effort cron
(measured 21-44 min gaps vs the configured 15; PR #3's tag 4+ h late;
PR #7's tag still missing 30 min after merge). The pull_request:closed
trigger added in PR #4 never fired a single run (0 runs across 7 merges,
API-confirmed), and the earlier workflow_run design died 15x in a row
with startup_failure. The one trigger that demonstrably fires at merge
time is the push to main that IS the squash-merge (verify.yml push runs
arrive ~20s after each merge). Re-trigger on push: branches: [main];
the org reusable workflow is idempotent, so the CHANGELOG bot push
re-trigger is a cheap no-op sweep.
github-actions Bot pushed a commit that referenced this pull request Aug 22, 2026
…ge commits are run-suppressed) (#9)

* ci: tag-on-merge via push-to-main instead of dead closed trigger + flaky cron

RCA: tag delivery was driven entirely by GitHub's best-effort cron
(measured 21-44 min gaps vs the configured 15; PR #3's tag 4+ h late;
PR #7's tag still missing 30 min after merge). The pull_request:closed
trigger added in PR #4 never fired a single run (0 runs across 7 merges,
API-confirmed), and the earlier workflow_run design died 15x in a row
with startup_failure. The one trigger that demonstrably fires at merge
time is the push to main that IS the squash-merge (verify.yml push runs
arrive ~20s after each merge). Re-trigger on push: branches: [main];
the org reusable workflow is idempotent, so the CHANGELOG bot push
re-trigger is a cheap no-op sweep.

* ci: tag-on-merge on pr-validator completion + push (corrected RCA)

The push-only trigger shipped in #8 was based on a false premise: the
verify.yml 'push' runs cited were changelog-bot commits, not merge pushes.
Measured reality: native-auto-merge merges (actor app/github-actions) fire
their webhook events (visible in the public event stream) but GitHub Actions
creates ZERO workflow runs for them — platform-level run suppression. The
pull_request:closed trigger never fired either (0 runs in history). The only
trigger whose event delivery is proven is workflow_run on the pr-validator
run — the run that arms the auto-merge. This fires on its completion, waits
(bounded) for the squash merge to land, then runs the org's idempotent
tag-on-merge sweep. push remains as a secondary trigger for human/bot pushes
(which do create runs). No cron: measured delivery was 21-44 min late.
charly-auto-merge Bot added a commit that referenced this pull request Aug 22, 2026
@atrawog
atrawog deleted the feat/fix-umbrella-gates-backtick-parse branch August 22, 2026 22:06
atrawog added a commit that referenced this pull request Sep 4, 2026
Advance gitlinks for the merged remainder of the openclaw 2.0 batch:
- layer-container-nesting (pre-pull fix, PR #2)
- layer-openclaw-full (pod-openclaw 2.0 pin, PR #7)
- marketplace (corpus regenerations, PRs #281/#282)
- pod-selkies-core (GPU-check fixes, PR #17)
- pod-selkies-desktop (GPU-check pin, PR #11)

distro-cachyos stays at the charly box/cachyos gitlink (policy B).
github-actions Bot pushed a commit that referenced this pull request Sep 4, 2026
* chore(gitlink): advance the openclaw-2.0 batch remainder to main

Advance gitlinks for the merged remainder of the openclaw 2.0 batch:
- layer-container-nesting (pre-pull fix, PR #2)
- layer-openclaw-full (pod-openclaw 2.0 pin, PR #7)
- marketplace (corpus regenerations, PRs #281/#282)
- pod-selkies-core (GPU-check fixes, PR #17)
- pod-selkies-desktop (GPU-check pin, PR #11)

distro-cachyos stays at the charly box/cachyos gitlink (policy B).

* re-trigger: paste real task verify output
atrawog added a commit that referenced this pull request Sep 8, 2026
…, marketplace #293, layer-charly-internals #12, layer-charly-distros #7, dotgithub #84) + bump the pi-omarchy-eval pin to v2026.251.0738
github-actions Bot pushed a commit that referenced this pull request Sep 8, 2026
….0738 (#163)

* chore: close-out the eval/fix wave — advance gitlinks (eval-omarchy #39, marketplace #293, layer-charly-internals #12, layer-charly-distros #7, dotgithub #84) + bump the pi-omarchy-eval pin to v2026.251.0738

* fix(dispatcher): actions: write is REQUIRED for the cancel-in-progress concurrency dedupe (otherwise dispatches fail to expand — the #163 infra regression)

* revert(dispatcher): drop the actions:write permission line from #163 — T4-deferred (no maintainer sign-off granted); the dispatcher works without it post-#85 and the dedupe cannot cancel without the permission anyway. #163 is now a pure gitlink+pin change: no workflow permission change.
github-actions Bot pushed a commit that referenced this pull request Nov 25, 2026
… releases land (#1274)

`charly task sync` on a tree current with origin/main (7f11b25): 74 leaf
submodules rolled to their default-branch HEAD (11 moved), 321 leaf pins
advanced in the index (11 moved) — 22 pins total. The five distro-* pin_map
edges were re-pinned from charly's own gitlinks and did not move.

Two of the moves are what this wave is for (#1273):

  sdk                2bfea23e -> dd87eb2c   sdk#640 — a unit never runs as container root
  plugin-deploy-pod  c87f056c -> c10caae    #97 — a CDI device rides a keep-id unit via a
                                            derived devices-only spec; #95 writes the
                                            deploy entry's image before any overlay write

The other 20 travelled on the same mechanism, each a merged upstream PR:
charly #1275, layer-cdi #20, layer-vectorchord #13, marketplace #652,
plugin-enc #11, pod-charly-mcp #15, pod-immich #23, pod-qwen3-tts #15/#13,
spec #440, plus eleven unmaterialized paths advanced in the index
(layer-devops-tools #8, layer-ollama-cuda #11, layer-ollama-rocm #9,
layer-pre-commit #9, layer-versatiles-style #7, pod-airflow #15,
pod-android-emulator-layer #21, pod-appium-server #9, pod-dbus #8,
pod-jupyter-ml #15, pod-pmtiles-viewer #7).

The plugin-deploy-pod advance moved engineDefaultRuntime from engine_ops.go:139-146 to
129-136, out from under the citation DESIGN A.13 records for "containerd namespace per
deployment" (design/dulling.tsv). The row is re-anchored to the construct's new range and
design/cite-baseline.tsv regenerated for that one row; the construct read at the new pin is
the same one, and the regenerated baseline changes no other row.

Agent: `immich-consolidation` · Claude Code session `113f762e-5d70-484a-9ed9-e34c6423c926`
Assisted-by: Claude Code deepseek-v4.1-flash:cloud (fully tested and validated)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant