Skip to content

build(bootstrap): make the SessionStart prover hook synchronous#324

Merged
hyperpolymath merged 1 commit into
mainfrom
claude/sync-session-hook
Jun 26, 2026
Merged

build(bootstrap): make the SessionStart prover hook synchronous#324
hyperpolymath merged 1 commit into
mainfrom
claude/sync-session-hook

Conversation

@hyperpolymath

Copy link
Copy Markdown
Owner

Summary

Flip .claude/hooks/session-start.sh from async to synchronous, as requested. The session now blocks until Coq/Idris2/Zig are provisioned, so the first prompt is guaranteed a working prover instead of racing the background install.

Why this is the right trade-off (not just a slower start)

The ~10–15 min Idris2 source build is paid once on a cold container. Claude Code on the web caches the container after the SessionStart hook completes, so every subsequent session hits the installers' idempotent early-exits and starts fast — with the prover guarantee intact each time. And because the installers are fail-soft + idempotent, a cold build truncated by any hook timeout simply resumes on the next session until the container is cached. Net: pay once, fast + guaranteed thereafter.

Change

  • Removed the async opt-in ({"async": true, ...}) so the hook runs synchronously.
  • The verbose Idris2 build is redirected to $TMPDIR/ephapax-bootstrap.log; only a one-line-per-prover summary reaches the session transcript (no build spam).
  • A header comment documents how to revert to async if the cold-start wait is ever unwelcome.

Only .claude/hooks/session-start.sh changes; the installer scripts, devcontainer, .tool-versions, and just bootstrap are untouched.

Validated in-session

  • Emits no async JSON (true sync mode).
  • Runs bootstrap-provers.sh to completion and prints the Coq/Idris2/Zig summary.
  • No-ops silently when CLAUDE_CODE_REMOTE is unset (devcontainers use postCreate instead).
  • This environment confirms CLAUDE_CODE_REMOTE=true, so the remote path is the one that fires.

Hook execution mode

Synchronous. Pro: provers guaranteed before the first prompt (no race). Con: first cold session waits for the build; amortized to ~0 by container caching thereafter.

🤖 Generated with Claude Code

https://claude.ai/code/session_01AGFqWzByua4dKbA7W7oVsL


Generated by Claude Code

Flip .claude/hooks/session-start.sh from async to synchronous so session
start blocks until Coq/Idris2/Zig are provisioned — the first prompt is
guaranteed a working prover instead of racing the background install.

The ~10-15 min Idris2 source build is paid once on a cold container;
Claude Code on the web caches the container after the hook completes, so
subsequent sessions hit the idempotent early-exits and start fast. Still
fail-soft + idempotent, so a timeout-truncated cold build just resumes on
the next session until the container is cached. The verbose build is
logged to a file; only a one-line-per-prover summary reaches the transcript.

Validated in-session: emits no async JSON; runs bootstrap to completion;
prints the prover summary; no-ops silently when CLAUDE_CODE_REMOTE is unset.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AGFqWzByua4dKbA7W7oVsL
@hyperpolymath
hyperpolymath marked this pull request as ready for review June 26, 2026 22:50
@hyperpolymath
hyperpolymath merged commit 28c0e94 into main Jun 26, 2026
15 of 18 checks passed
@hyperpolymath
hyperpolymath deleted the claude/sync-session-hook branch June 26, 2026 22:50
hyperpolymath added a commit that referenced this pull request Jun 27, 2026
…SPDX + trusted-base) (#329)

## Summary

Two governance checks have been red on **every** PR (#322#324) for
reasons unrelated to any diff — both are repo-level. This clears the two
that are in ephapax's control. Fixes were derived from the **exact
`standards@d135b05` check-script regexes** (fetched via raw HTTPS and
verified locally, not guessed).

### 1. `governance / Licence consistency`
Root `LICENSE` is the verbatim MPL-2.0 text with **no SPDX header**.
`check-licence-consistency.sh` does:
```sh
grep -m1 -E '^[[:space:]]*SPDX-License-Identifier:' "$lic_file"
```
then normalises the identifier and checks it matches the manifest.
**Fix:** prepend `SPDX-License-Identifier: MPL-2.0` (normalises to
`mpl-2.0`, matches `Cargo.toml` `license = "MPL-2.0"`). Verified the
grep now matches.

### 2. `governance / Trusted-base reduction policy`
`check-trusted-base.sh` flags `^[[:space:]]*(Axiom|Admitted|admit\.)`.
`formal/RegionEnvL1.v:17` is a **prose comment** — *"Axiom budget: this
file is axiom-free"* — that happens to start with "Axiom". A false
positive. **Fix:** reword to *"On the axiom budget: …"* so the line no
longer matches (verified).

Chosen over a `.trusted-base-ignore` entry deliberately: the file stays
**fully scanned**, so a genuine future axiom there is still caught — and
a `TRUSTED:`/`AXIOM:` inline annotation would be *false* (the file
really is axiom-free; that's the whole point of `RegionEnvL1.v`).

## Not fixable here
`scan / Hypatia Neurosymbolic Analysis` fails on an Elixir
`CompileError` (`real_subdirs`) **inside the `standards`/Hypatia repo**
— out of ephapax's reach. Flagging, not fixing.

## Verification
- Both fixes checked against the actual fetched regexes
(`standards@d135b05`).
- `formal/RegionEnvL1.v` still compiles under `coqc 8.18.0`
(comment-only change).
- 2 files, +3/−1.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

https://claude.ai/code/session_01AGFqWzByua4dKbA7W7oVsL

---
_Generated by [Claude
Code](https://claude.ai/code/session_01AGFqWzByua4dKbA7W7oVsL)_

Co-authored-by: Claude <noreply@anthropic.com>
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.

2 participants