Skip to content

feat(ethos): add handoff snapshot profile for full-gate - #105

Closed
jmf-pobox wants to merge 2 commits into
mainfrom
devin/1795656629-handoff-snapshot-profile
Closed

jmf-pobox wants to merge 2 commits into
mainfrom
devin/1795656629-handoff-snapshot-profile

Conversation

@jmf-pobox

@jmf-pobox jmf-pobox commented Nov 26, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Adds the DES-086 nested sidecar .punt-labs/ethos/checks/snapshots/prfaq.yaml so the existing handoff check full-gate (make verify, unchanged) runs inside ethos's verified read-only snapshot.

  • No runtime bundle: TeX Live, biber/perl, python3, jq, git are host system tools (system.tools, hashed into the key). TeX config/format trees outside /usr are system.dirs: [/etc/texmf, /var/lib/texmf].
  • scratch.checkout: [.tmp]: the whole .tmp because verify does rm -rf .tmp/tex-check (a mount point can't be removed); .tmp/permission-tests lives there too. Tracked PDFs are never written.
  • env.PYTHONDONTWRITEBYTECODE=1: otherwise the prose tests write plugin/**/__pycache__ into the read-only checkout.
  • git: {}: test_pdf_fresh needs HEAD + index for git ls-files; without .git its stale-PDF cases wrongly pass and the test fails.
  • No network: the installer tests' ssh -T git@github.com fails fast and takes the HTTPS fallback (install.sh:94-110).

Merge waits on the ethos schema PR (field names may still change).

Verification

Linux parity was verified on prfaq 690c75f28b30b8b8045e36e007768cd84e506681 with Ethos 98776d16ba91d17e7027abc558693f1da6f72004. The committed profile and existing make verify command were unchanged. No tests were filtered.

Tree Live gate verdict / exit Live wall Snapshot gate verdict / exit Snapshot hook wall
Clean Pass / 0 12.01 s Pass / 0; hook stdout empty, outcome completed 9.55 s
Clean repeat — — Cached pass; hook stdout empty, outcome reused 0.13 s
Broken Fail / 2 1.40 s Fail / 2; hook JSON decision block 2.28 s

The clean live run reported 56 permission tests passed, 132 prose tests passed, and test_pdf_fresh: all passed. Both broken runs reported that prfaq-parity-probe-missing-file.tex was not found and no PDF was produced. Both gate failures exited 2, not an interruption code (129/130/137/143). The hook process itself exited 0 on all runs; the broken verdict is in its JSON.

Reproduce

Run with Bash and GNU time on Linux with the profile's declared tools and TeX trees installed. Use a fresh disposable prfaq clone: the first Ethos invocation may perform startup storage upgrades that edit .gitignore or install local hooks before the sandbox launches.

work="$HOME/work"
source_prfaq="$HOME/repos/prfaq"
ethos_src="$work/ethos-schema"
ethos="$work/ethos-runner"
git -C "$ethos_src" fetch origin devin/1795655587-handoff-worktree-runner
git -C "$ethos_src" checkout --detach 98776d1
env -C "$ethos_src" go build -o "$ethos" ./cmd/ethos

receipts="$(mktemp -d "$work/prfaq-105-parity.XXXXXXXX")"
repo="$receipts/prfaq"
git clone --local --no-checkout "$source_prfaq" "$repo"
git -C "$repo" checkout --detach 690c75f
cp "$repo/.gitignore" "$receipts/gitignore.original"
mkdir "$receipts/prime-home"
# Prime the startup upgrade with a payload that requests no handoff.
printf '%s\n' '{}' | env -C "$repo" HOME="$receipts/prime-home" \
  "$ethos" hook subagent-stop > "$receipts/prime.stdout" 2> "$receipts/prime.stderr"
cp "$receipts/gitignore.original" "$repo/.gitignore"
git -C "$repo" status --porcelain --untracked-files=all

replay() {
  local r="$receipts/$1"
  mkdir -p "$r/home" "$r/tmp"
  printf '%s\n' '{"session_id":"replay","agent_id":"worker","agent_type":"implementer"}' |
    /usr/bin/time -f 'wall=%e sec exit=%x' -o "$r/time" \
    env -C "$repo" HOME="$r/home" ETHOS_SESSION=replay ETHOS_AGENT_ID=worker \
      CLAUDE_AGENT_TYPE=implementer "$ethos" hook subagent-stop \
      > "$r/stdout" 2> "$r/stderr"
  cat "$r/time" "$r/stdout"
  rg 'check=full-gate' "$r/home/.punt-labs/ethos/logs/ethos.log"
}

live() {
  local r="$receipts/$1" rc=0
  mkdir -p "$r/home" "$r/tmp"
  /usr/bin/time -f 'wall=%e sec exit=%x' -o "$r/time" \
    env -i -C "$repo" HOME="$r/home" TMPDIR="$r/tmp" PATH=/usr/local/bin:/usr/bin:/bin \
      PYTHONDONTWRITEBYTECODE=1 LANG=C.UTF-8 make verify \
      > "$r/stdout" 2> "$r/stderr" || rc=$?
  cat "$r/time"
  return "$rc"
}

replay snapshot-clean
replay snapshot-clean-repeat
live live-clean

cp "$repo/prfaq.tex" "$receipts/prfaq.tex.original"
{ printf '%s\n' '\input{prfaq-parity-probe-missing-file.tex}'; cat "$receipts/prfaq.tex.original"; } > "$repo/prfaq.tex"
replay snapshot-broken
live live-broken || test "$?" -eq 2
cp "$receipts/prfaq.tex.original" "$repo/prfaq.tex"
for hook in pre-commit commit-msg; do
  if test -f "$repo/.git/hooks/$hook"; then
    mv "$repo/.git/hooks/$hook" "$receipts/generated-$hook"
  fi
done
git -C "$repo" status --porcelain --untracked-files=all

Receipts from the measured run: ~/work/prfaq-105-parity.s26S8bLf/{snapshot-clean,snapshot-clean-repeat,snapshot-broken,live-clean,live-broken}/ (stdout, stderr, timing, and the snapshot hook diagnostics under each home). Build log: ~/work/ethos-runner-98776d1-build.log.


Vikram - Latency Optimizer opened this PR for Jim
Implemented in session Add handoff snapshot profile to prfaq
Review with Devin · Open in Devin Desktop


Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
@devin-ai-integration

Copy link
Copy Markdown
Contributor

I'll fix CI failures and address comments from users with write access. I'll skip comments containing "(aside)".

  • Disable automatic comment, CI, and merge conflict monitoring

@qodo-code-review

qodo-code-review Bot commented Nov 26, 2026 •

Copy link
Copy Markdown

PR Summary by Qodo

Add an ethos snapshot profile for the full handoff gate

⚙️ Configuration changes 🕐 10-20 Minutes

Grey Divider

AI Description

• Adds a snapshot profile so the existing full-gate can run in a read-only worktree.
• Provides host TeX tools, writable .tmp, Git index access, and bytecode suppression without
 changing make verify.
• Requires the pending ethos schema support before snapshot parity can be verified.
Merge Risk 🟢 Low

Blast radius 🟢 Low 💥 1 capability

  • 1 affected end-to-end capability after fault-specific containment; implementation boundaries do not widen its functional scope.
  • The changed snapshot configures one bounded end-to-end outcome: running the repository's full verification gate during handoff.
  • The declared profile, tools, scratch checkout, and Git access are execution prerequisites for that same verification behavior, not independent capabilities.
Sources

.punt-labs/ethos/checks/snapshots/prfaq.yaml[11-18]

    env:
      PYTHONDONTWRITEBYTECODE: "1"
    system:
      tools: [bash, sh, make, git, pdflatex, biber, kpsewhich, perl, python3, jq, ssh]
      dirs: [/etc/texmf, /var/lib/texmf]
    scratch:
      checkout: [.tmp]
    git: {}

.punt-labs/ethos/checks/snapshots/prfaq.yaml[5-10]

checks:
  full-gate:
    profile: linux-worktree-v1
    epoch: prfaq-v1
    sources:
      mode: worktree
Behavioral complexity 🟢 Low 🧩 Straightforward

  • Before, the base branch had no repository snapshot for this check.
  • After, the file declares one full-gate profile, source mode, environment setting, required tools and directories, scratch checkout, and Git capability.
  • The changed correctness condition is that these declarations must match the runner's supported execution contract; there are no new application branches, data transformations, persistent-state transitions, or concurrency protocols.
Sources

.punt-labs/ethos/checks/snapshots/prfaq.yaml[5-10]

checks:
  full-gate:
    profile: linux-worktree-v1
    epoch: prfaq-v1
    sources:
      mode: worktree

.punt-labs/ethos/checks/snapshots/prfaq.yaml[11-18]

    env:
      PYTHONDONTWRITEBYTECODE: "1"
    system:
      tools: [bash, sh, make, git, pdflatex, biber, kpsewhich, perl, python3, jq, ssh]
      dirs: [/etc/texmf, /var/lib/texmf]
    scratch:
      checkout: [.tmp]
    git: {}
Potential damage 🟡 Medium 🩹 Temporary loss

  • If the snapshot is rejected, incomplete, or interpreted incompatibly, handoff verification may fail to run or remain unavailable.
  • This affects the verification capability only; the repository's application and document behavior are not changed.
  • The external runner's failure and fallback semantics are not present in this repository, so the exact failure mode is unresolved.
  • Revert the snapshot or correct its declarations to restore gate execution; no persistent application state or external business effect is introduced by this file.
Sources

.punt-labs/ethos/checks/snapshots/prfaq.yaml[5-10]

checks:
  full-gate:
    profile: linux-worktree-v1
    epoch: prfaq-v1
    sources:
      mode: worktree

.punt-labs/ethos/checks/snapshots/prfaq.yaml[11-18]

    env:
      PYTHONDONTWRITEBYTECODE: "1"
    system:
      tools: [bash, sh, make, git, pdflatex, biber, kpsewhich, perl, python3, jq, ssh]
      dirs: [/etc/texmf, /var/lib/texmf]
    scratch:
      checkout: [.tmp]
    git: {}
Assessed commit 690c75f
Diagram

graph TD
  H["Handoff check"] --> P["Snapshot profile"] --> R["Snapshot runner"] --> V["make verify"] --> T["Writable .tmp"]
  R --> S["Host toolchain"]
  R --> G["Git index"]
Loading
High-Level Assessment

Keep the profile alongside the existing handoff check rather than duplicating make verify or bundling the host toolchain. Merge for use only after the ethos schema supports these fields and a runnable snapshot confirms clean-pass and broken-fail parity.

Files changed (1) +18 / -0

Other (1) +18 / -0
prfaq.yamlConfigure a read-only snapshot for full-gate +18/-0

Configure a read-only snapshot for full-gate

• Adds a worktree snapshot profile with host tools and TeX directories, writable '.tmp' scratch, Git metadata access, and disabled Python bytecode writes. It supports the existing 'make verify' handoff check without modifying the check itself.

.punt-labs/ethos/checks/snapshots/prfaq.yaml

@qodo-code-review

Copy link
Copy Markdown

Code Review by Qodo

🐞 Bugs (1) 📘 Rule violations (1) 📜 Skill insights (0)


Action required

1. Snapshot profile is ignored 🔴 High ●● Moderate 🔗 Cross-repo conflict 👈 Shift left
Description
The new checks/snapshots/prfaq.yaml sidecar cannot configure full-gate because pinned Ethos only
loads check sets from checks/<slug>.yaml and has no sidecar profile loader. With the existing
full-gate check still lacking an inline snapshot, Ethos defers its automatic handoff gate instead
of running the requested profile.
Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
Pinned Ethos does not discover or execute the new snapshot sidecar, so it cannot enable the intended full-gate profile.

## Fix Focus Areas
- .punt-labs/ethos/checks/snapshots/prfaq.yaml[5-18]
- .punt-labs/ethos/checks/prfaq.yaml[74-83]
- /cross_repos/ethos/internal/checkset/store.go[28-52]
- /cross_repos/ethos/internal/hook/handoff_gate.go[60-65]

## Recommended Fix
Implement and release sidecar discovery, schema validation, and the required execution facilities in Ethos, then verify this manifest against that version before merging or activating it. Keep the existing blocking check until passing and failing `make verify` cases have been demonstrated under the new profile.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

Dismiss ↗ | View ↗


View medium (1)
Remediation recommended
2. Scratch output bypasses the ethos store 🟠 Medium ●● Moderate 📘 Rule violation 👈 Shift left
Description
The scratch.checkout entry declares .tmp as the writable scratch location, and the header
comment says the unchanged make verify target removes and recreates .tmp/tex-check there, a
repo-relative path outside S/.punt-labs/local/ethos/. Temporary build artifacts from this check
therefore land outside the designated ethos local directory, and the rule lists scratch files among
the artifacts that must live under that base, so a reviewer should confirm whether this
checkout-scoped scratch is an accepted exception.
Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The sidecar check config at `.punt-labs/ethos/checks/snapshots/prfaq.yaml` declares `.tmp` as the writable scratch location for the `full-gate` check. The compliance rule requires runtime scratch and temporary artifacts to live under `S/.punt-labs/local/ethos/`, and `.tmp` sits outside that base.

## Fix Focus Areas
- .punt-labs/ethos/checks/snapshots/prfaq.yaml[16-18]

## Recommended Fix
If the `make verify` target can be pointed at a different scratch directory, change `scratch.checkout` to a path under `S/.punt-labs/local/ethos/` and update the mount and the `.tmp/tex-check` location accordingly. If the unchanged verify target fixes `.tmp` and cannot be moved, document this as an accepted exception to the rule in the PR description, since the PR notes say the verify command must remain unchanged.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

Dismiss ↗ | View ↗


@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no bugs or issues to report.

Devin Review

@devin-ai-integration

Copy link
Copy Markdown
Contributor

Closing as moot. #107 removed ethos from this repo, including .punt-labs/ethos.yaml and the full-gate check set that this sidecar extends, so ethos never loads the sidecar on main. Linux parity was proven on the ethos runner branch (98776d1 to c837cd1) while the check set existed. Merged ethos main 038e901 also defers on /etc/texmf (system-input allowlist), which has been reported to the ethos owner. The branch devin/1795656629-handoff-snapshot-profile is kept, so this can be reopened if ethos returns to prfaq.

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