Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
0390067
[FIRE-1932] docs: design for shipping the hook logs (phases 2-3)
amos-qualifire Aug 11, 2026
6db83c7
Merge branch 'feature/FIRE-1932/differentiate-between-log-files-for-c…
amos-qualifire Aug 11, 2026
21c22e5
[FIRE-1932] docs: plugin-side log shipping as the baseline capability
amos-qualifire Aug 11, 2026
3440ae4
[FIRE-1932] docs: plugin log shipper implementation design
amos-qualifire Aug 12, 2026
f3b64c9
[FIRE-1932] docs: address review — identity granularity, redaction sc…
amos-qualifire Aug 12, 2026
5cf1646
[FIRE-1932] docs: per-line attribution, and a table instead of a hash
amos-qualifire Aug 12, 2026
d8ab12c
[FIRE-1932] docs: address CodeRabbit — fragment math, .1 drain, path-…
amos-qualifire Aug 12, 2026
f08010f
[FIRE-1932] docs: the shipper inherits the actor, it never re-resolve…
amos-qualifire Aug 12, 2026
d9342ba
[FIRE-1932] docs: oversized lines, Windows MDM path, zero-valued caps
amos-qualifire Aug 12, 2026
f0aa364
Merge branch 'feature/FIRE-1932/differentiate-between-log-files-for-c…
amos-qualifire Aug 12, 2026
9973536
Merge origin/main into feature/FIRE-1932/log-shipping
amos-qualifire Aug 12, 2026
85f064c
[FIRE-1932] feat: the log shipper
amos-qualifire Aug 12, 2026
d100580
[FIRE-1932] feat: call the shipper from every plugin's session start
amos-qualifire Aug 12, 2026
8b67c6d
[FIRE-1932] test: contract, PowerShell and end-to-end coverage for th…
amos-qualifire Aug 12, 2026
926b8c1
[FIRE-1932] docs: the shipper's manual command, and five spec correct…
amos-qualifire Aug 12, 2026
c6e9fb1
[FIRE-1932] test: run setup.sh with bash in the e2e, not sh
amos-qualifire Aug 12, 2026
fe38e14
[FIRE-1932] fix: shipping is opt-in until /hooks/logs exists, plus th…
amos-qualifire Aug 12, 2026
6ea4efc
[FIRE-1932] fix(cursor): a short FileStream.Read sent a truncated fil…
amos-qualifire Aug 12, 2026
8df26c1
[FIRE-1932] test: run the Windows shipper for real, on Windows
amos-qualifire Aug 12, 2026
e84899f
[FIRE-1932] docs: the backend/agent spec, and the opt-in in all six s…
amos-qualifire Aug 12, 2026
222585f
[FIRE-1932] fix(test): two bugs the new Windows job found on its firs…
amos-qualifire Aug 12, 2026
a98a2d2
[FIRE-1932] test: fold path separators in the antigravity marker asse…
amos-qualifire Aug 12, 2026
f2d458d
[FIRE-1932] test: Windows PowerShell 5.1 drops an empty native-comman…
amos-qualifire Aug 12, 2026
504d9cb
[FIRE-1932] test: pass the probe's credentials base64, not as raw JSON
amos-qualifire Aug 12, 2026
a78027a
[FIRE-1932] test: steer the child's $HOME on Windows via HOMEDRIVE/HO…
amos-qualifire Aug 12, 2026
fe793fd
[FIRE-1932] test: the USERPROFILE fallback case is POSIX-only, so ski…
amos-qualifire Aug 12, 2026
a12e733
[FIRE-1932] test: $IsWindows does not exist in Windows PowerShell 5.1
amos-qualifire Aug 12, 2026
442df84
[FIRE-1932] test: a live runbook through Claude Code itself
amos-qualifire Aug 12, 2026
10c1646
[FIRE-1932] fix(shipper): an env file's ROGUE_SHIP_LOGS=0 is a kill s…
amos-qualifire Aug 13, 2026
414d943
[FIRE-1932] docs: run the shipper as a child process, and send Copilo…
amos-qualifire Aug 13, 2026
79c6df7
[FIRE-1932] fix(status): resolve the plugin root instead of trusting …
amos-qualifire Aug 13, 2026
deee414
[FIRE-1932] fix(status): the Windows form skipped the authoritative r…
amos-qualifire Aug 13, 2026
f7969aa
[FIRE-1932] test: two assertions that could not fail, and support-com…
amos-qualifire Aug 13, 2026
7eaf245
Merge the log-file split branch into the shipper branch
amos-qualifire Aug 16, 2026
7a137aa
[FIRE-1932] fix(shipper): an unrepresentable byte budget is a typo, n…
amos-qualifire Aug 16, 2026
3e0777f
[FIRE-1932] fix(shipper): review round — wire-contract, identity, and…
amos-qualifire Aug 16, 2026
6475ab3
[FIRE-1932] test: the snippet case must use the key the receiver accepts
amos-qualifire Aug 16, 2026
3b89fbc
[FIRE-1932] chore: the backend scrub missed the shipper sources and t…
amos-qualifire Aug 16, 2026
b7d1dc7
[FIRE-1932] Merge the log-file split branch into log-shipping
amos-qualifire Aug 18, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
202 changes: 201 additions & 1 deletion .github/workflows/validate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,12 @@ jobs:
manifests:
runs-on: ubuntu-latest
steps:
# persist-credentials: false - checkout otherwise writes the job token into
# .git/config, and every step below runs product scripts out of the checked-out
# tree. They need the source, never the credential.
- uses: actions/checkout@v4
with:
persist-credentials: false

# Pinned so the Gemini dispatcher is actually exercised: tests/test_hook_logs.sh
# SKIPS its gemini leg when `node` is missing, which would pass silently.
Expand Down Expand Up @@ -75,9 +80,92 @@ jobs:
while IFS= read -r f; do
if head -1 "$f" | grep -q bash; then chk="bash -n"; else chk="dash -n"; fi
if ! $chk "$f"; then echo "::error file=$f::$chk parse error"; fail=1; fi
done < <(git ls-files 'plugins/**/scripts/*.sh' 'install.sh' 'scripts/*.sh')
done < <(git ls-files 'plugins/**/scripts/*.sh' 'install.sh' 'scripts/*.sh' 'scripts/shared/*.sh')
[ "$fail" = 0 ] || exit 1

- name: Command and skill snippets parse
# Every fenced sh/bash and powershell block in a /rogue:setup or /rogue:status
# document is RUN VERBATIM by the agent when a user invokes the command, so a
# syntax error there is a product bug in the only diagnostic path support has -
# and nothing else in this workflow reads these files. Parse-only (`sh -n`, the
# PowerShell parser), so a block that references a variable set by an earlier
# block is fine; what it catches is an unbalanced quote, paren or heredoc.
run: |
python3 - <<'PY'
import re, subprocess, sys
listing = subprocess.run(['git', 'ls-files', 'plugins/*/skills/*/SKILL.md',
'plugins/*/commands/*.md'],
capture_output=True, text=True)
files = listing.stdout.split()
# A failed `git` or a glob that stopped matching would leave this empty, and
# the step would pass having validated nothing - the silent green this whole
# workflow exists to avoid. There is always at least one status document.
if listing.returncode or not files:
print(f"::error::git ls-files found no command/skill documents "
f"(rc={listing.returncode})")
sys.exit(1)
bad = 0
ps_blocks = []
for path in files:
text = open(path, encoding='utf-8').read()
for match in re.finditer(r'```(bash|sh|powershell)\n(.*?)```', text, re.S):
line = text[:match.start()].count('\n') + 1
if match.group(1) == 'powershell':
ps_blocks.append((path, line, match.group(2)))
continue
result = subprocess.run(['sh', '-n'], input=match.group(2),
capture_output=True, text=True)
if result.returncode:
print(f"::error file={path},line={line}::sh -n: "
f"{result.stderr.strip()}")
bad = 1
# The PowerShell blocks go through the real parser in one pwsh start-up.
for index, (path, line, code) in enumerate(ps_blocks):
open(f'/tmp/ps_block_{index}.ps1', 'w', encoding='utf-8').write(code)
script = '\n'.join([
'$bad = 0',
'foreach ($f in (Get-ChildItem /tmp/ps_block_*.ps1 | Sort-Object Name)) {',
' $errs = $null',
' $null = [System.Management.Automation.Language.Parser]::ParseFile(',
' $f.FullName, [ref]$null, [ref]$errs)',
' if ($errs -and $errs.Count -gt 0) { $bad = 1',
' Write-Host ($f.Name + " :: " + ($errs[0].Message)) }',
'}',
'exit $bad'])
open('/tmp/parse_ps_blocks.ps1', 'w', encoding='utf-8').write(script)
if ps_blocks:
result = subprocess.run(['pwsh', '-NoProfile', '-File',
'/tmp/parse_ps_blocks.ps1'],
capture_output=True, text=True)
reports = [r for r in result.stdout.splitlines() if 'ps_block_' in r]
for report in reports:
index = int(re.search(r'ps_block_(\d+)', report).group(1))
path, line, _ = ps_blocks[index]
print(f"::error file={path},line={line}::PowerShell parse error: "
f"{report.split(' :: ', 1)[-1]}")
bad = 1
# A non-zero exit with no structured report means pwsh itself failed
# (missing binary, a runtime error writing only to stderr). Silence is
# not a pass: without this the whole PowerShell half would go green
# while checking nothing.
if result.returncode and not reports:
print(f"::error::pwsh exited {result.returncode} without reporting "
f"any block: {result.stderr.strip() or '(no stderr)'}")
bad = 1
print(f"checked {len(files)} documents, {len(ps_blocks)} PowerShell blocks")
sys.exit(bad)
PY

- name: Shared plugin scripts are in sync
# scripts/shared/ holds the ONLY editable copy of ship-logs.sh / ship-logs.ps1;
# each plugin carries a committed byte-identical copy, because three plugins
# install straight from a git clone of this repo with no build step, so a
# generated-at-release file would simply be missing for them. Without this
# gate an edit to scripts/shared/ that was never propagated ships five stale
# copies, and an edit made directly to a plugin's copy is silently reverted by
# the next sync — neither is visible in review.
run: bash scripts/sync-shared-scripts.sh --check

- name: Hook-log contract (sh + mjs dispatchers)
# The per-agent log file, line format and rotation policy are duplicated
# across six dispatchers (no shared library), so drift in one of them is
Expand All @@ -89,6 +177,29 @@ jobs:
SH=dash sh tests/test_hook_logs.sh
SH=bash bash tests/test_hook_logs.sh

- name: Log-shipper contract (sh)
# The shipper is a byte-offset state machine over a file another process is
# appending to and rotating underneath it, so its failure modes are silent by
# construction: a one-byte error in the chunk-boundary arithmetic leaves the
# offset lagging one byte per run forever, and a skip that lands mid-line
# ships fragments that the server parser cannot reject. Both shells, for the
# same reason as the hook-log suite: `dash` is what Claude Code actually
# invokes hooks with, and the trailing-fragment maths goes through awk.
run: |
set -euo pipefail
SH=dash sh tests/test_ship_logs.sh
SH=bash bash tests/test_ship_logs.sh

- name: Log-shipper end to end (real HTTP)
# The contract suite above stubs `curl`, so it can only assert what the
# shipper WOULD send. This one runs the real pipeline - real dispatcher, real
# rotation in hook.sh, real curl, real server (tests/e2e_receiver.mjs) - and
# `cmp`s the file on disk against the file the server rebuilt from the wire.
# It covers the class of bug a stub cannot: a body curl refuses, an envelope
# that stops being valid JSON once a log line contains a quote, a base64
# wrap that survives `tr -d` in one shell but not another.
run: sh tests/e2e_ship_logs.sh

- name: PowerShell scripts parse
# The .ps1 dispatchers are the Windows half of every plugin and cannot be
# run on a dev Mac (no pwsh) — this is the only gate that ever parses
Expand All @@ -108,6 +219,48 @@ jobs:
}
exit $bad'

- name: No dash or quote lookalikes in PowerShell code
# These characters inside a STRING are a Windows PowerShell 5.1 parse error,
# and the failure mode is total. 5.1 reads a BOM-less file as ANSI, so the
# trailing byte of an em dash (U+2014 -> 0x94), an en dash (0x93) or an arrow
# (U+2192 -> 0x92) decodes to a SMART QUOTE — which PowerShell honors as a
# string delimiter. The string ends early, the braces stop matching, and the
# file does not parse at all. In a dispatcher that means hooks.json's
# `catch { '{}' }` swallows it and every Windows user silently loses
# enforcement. pwsh 7 reads the very same file as UTF-8 and sees nothing
# wrong, which is exactly why a parse check cannot catch this and this step
# exists. Found by the new windows-latest job, on tests/test_hook_ps1_*.
#
# Only these characters, not all non-ASCII: `…` (U+2026 -> 0xA6) and `é`
# (0xA9) are harmless, and one test asserts non-ASCII passthrough on purpose.
# Comments are exempt — they are never parsed as code. `#`-stripping is a
# heuristic (a `#` inside a string hides the rest of that line), so this can
# miss a violation but never invents one.
run: |
python3 - <<'PY'
import re, subprocess, sys
DANGEROUS = '‐‑‒–—―‘’‚‛“”→←'
bad = 0
listing = subprocess.run(['git', 'ls-files', '*.ps1'],
capture_output=True, text=True)
paths = listing.stdout.split()
# Same silent-green guard as the snippet step: an empty list here would
# "check" nothing and report success. The repo always ships .ps1 files.
if listing.returncode or not paths:
print(f"::error::git ls-files found no .ps1 files (rc={listing.returncode})")
sys.exit(1)
for path in paths:
for number, line in enumerate(open(path, encoding='utf-8'), 1):
code = re.sub(r'#.*', '', line)
hits = sorted({c for c in code if c in DANGEROUS})
if hits:
print(f"::error file={path},line={number}::"
f"{''.join(hits)} outside a comment - breaks Windows PowerShell 5.1"
f" (BOM-less ANSI decode turns it into a string delimiter)")
bad = 1
sys.exit(bad)
PY

- name: PowerShell unit tests
# All of these load their dispatcher through the ROGUE_PS_LIB_ONLY seam, so
# the functions run on Linux even though the main body stands down there.
Expand All @@ -117,3 +270,50 @@ jobs:
pwsh -NoProfile -File tests/test_hook_ps1_copilot.ps1
pwsh -NoProfile -File tests/test_hook_ps1_antigravity.ps1
pwsh -NoProfile -File tests/test_hook_logs.ps1
pwsh -NoProfile -File tests/test_ship_logs.ps1

windows:
# The job the seam CANNOT stand in for. Every PowerShell test in the job above
# runs on ubuntu-latest through ROGUE_PS_LIB_ONLY, which loads the helpers and
# skips the main body — so Invoke-WebRequest, the %USERPROFILE% state directory,
# Windows file sharing/locking and the -EncodedCommand child process the
# heartbeats spawn were executed NOWHERE in CI, on the half of the feature that
# cannot be run on a dev Mac. A Windows-only runtime failure there is invisible
# by construction: hooks.json swallows it into `catch { '{}' }` and every Windows
# user silently loses the feature.
runs-on: windows-latest
steps:
# persist-credentials: false - checkout otherwise writes the job token into
# .git/config, and this job runs product scripts and a Node receiver out of
# the checked-out tree. It only needs the source, never the credential.
- uses: actions/checkout@v4
with:
persist-credentials: false

Comment thread
coderabbitai[bot] marked this conversation as resolved.
Resolved
# The e2e receiver is Node; the shipper itself needs nothing but PowerShell.
- uses: actions/setup-node@v4
with:
node-version: '20'

- name: Log-shipper end to end (real ship-logs.ps1, real HTTP)
run: pwsh -NoProfile -File tests/e2e_ship_logs.ps1

- name: PowerShell unit tests under Windows PowerShell 5.1
# NOT a duplicate of the pwsh run on ubuntu: Copilot and Claude both fall back
# to Windows PowerShell 5.1 when pwsh 7 is absent, and 5.1 is a different
# engine — `Add-Content -Encoding UTF8` emits a BOM there, `Start-Process
# -ArgumentList` quotes differently, and several 7-only APIs simply do not
# exist. pwsh 7's parser cannot catch any of that.
shell: powershell
run: |
$ErrorActionPreference = 'Stop'
powershell -NoProfile -File tests/test_hook_ps1.ps1
if ($LASTEXITCODE -ne 0) { exit 1 }
powershell -NoProfile -File tests/test_hook_ps1_copilot.ps1
if ($LASTEXITCODE -ne 0) { exit 1 }
powershell -NoProfile -File tests/test_hook_ps1_antigravity.ps1
if ($LASTEXITCODE -ne 0) { exit 1 }
powershell -NoProfile -File tests/test_hook_logs.ps1
if ($LASTEXITCODE -ne 0) { exit 1 }
powershell -NoProfile -File tests/test_ship_logs.ps1
if ($LASTEXITCODE -ne 0) { exit 1 }
Loading
Loading