Skip to content

feat: ClawSweeper-style reference demo of the operating loop (#19) - #40

Merged
BunsDev merged 2 commits into
mainfrom
feat/issue-19-demo
Jul 7, 2026
Merged

feat: ClawSweeper-style reference demo of the operating loop (#19)#40
BunsDev merged 2 commits into
mainfrom
feat/issue-19-demo

Conversation

@BunsDev

@BunsDev BunsDev commented Jul 7, 2026

Copy link
Copy Markdown
Member

Closes #19 — the last link on the Wave 1 critical path (#2 → #4 → #10 → #13 → #19).

What this is

A runnable, offline, self-verifying reference demo of the full operating loop, driving the real coven-github serve binary — no network, no GitHub App registration, no credentials:

examples/demo/run-demo.sh

How it works

Piece What it is
examples/demo/run-demo.sh Orchestrator: throwaway RSA key + random webhook secret, builds and starts the real adapter, replays HMAC-signed GitHub webhook deliveries in seven acts, asserts 18 properties against recorded state
examples/demo/github-stub.py In-memory GitHub API stand-in (stdlib only) covering exactly the adapter's API surface; records every mutation in an audit trail attributed to the token role that made it
examples/demo/fake-coven-code Headless-contract-v2-conformant runtime stand-in; fabricates a familiar-voice fix and verifies the brief is tokenless with git authority arriving only via COVEN_GIT_TOKEN
docs/demo.md Narrated walkthrough mapping each act to the ClawSweeper disciplines

What the acts prove (all asserted, not eyeballed)

  1. Issue assigned → full loop: scoped tokens (orchestration / agent-git / publication — the Split agent read auth from publication write auth #4 auth split, visible in the audit trail), Check Run on the resolved head SHA, ONE marker-backed status comment edited in place to done, draft PR back to the issue in Cody's voice
  2. Casual mention → zero API calls
  3. Familiar's own comment → never re-triggers (loop guard)
  4. Unknown verb → clarification reply, edited into the same single surface
  5. @cody status → answered from the durable task store (the state Cave polls)
  6. Below-write retry → declined pre-flight at the permission gate; no Check Run, no session spent
  7. Maintainer retry → full re-run; still exactly one status comment

Closing surfaces: the per-token-role audit trail and GET /api/github/tasks (the Cave oversight view). Cave intervention from the dashboard is honestly scoped to #18 in the doc.

Verification

  • examples/demo/run-demo.sh → exit 0, 18/18 assertions green (run twice, including the cleanup path)
  • cargo check --all-targets, cargo clippy --all-targets -- -D warnings, cargo test --all — green (no Rust changes)
  • hosted adapter python compile + unittest — green

BunsDev added 2 commits July 6, 2026 19:48
…op (#19)

Replay the full ClawSweeper-style loop against the real adapter binary with
an in-memory GitHub API stub and a headless-contract-conformant fake
coven-code runtime: issue assignment -> Check Run -> edited-in-place status
comment -> familiar-voice draft PR, plus maintainer steering (status, retry,
unknown-verb clarification), the write-access permission gate, casual-mention
and self-comment suppression, and a per-token-role audit trail. Every
property is asserted programmatically; a green exit proves the loop.

Signed-off-by: Val Alexander <bunsthedev@gmail.com>
Signed-off-by: Val Alexander <bunsthedev@gmail.com>
Copilot AI review requested due to automatic review settings July 7, 2026 00:49
@BunsDev
BunsDev merged commit 3ea97ec into main Jul 7, 2026
2 checks passed

Copilot AI 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.

Pull request overview

Adds a runnable reference demo (ClawSweeper-style) that exercises the end-to-end “operating loop” using the real coven-github serve binary, driven by signed webhook deliveries against a local in-memory GitHub API stub, and documents how to run and interpret it.

Changes:

  • Add examples/demo/run-demo.sh to orchestrate a full local loop run with assertions against recorded stub state.
  • Add examples/demo/github-stub.py and examples/demo/fake-coven-code to provide an in-memory GitHub API and a headless-contract-v2-conformant runtime stand-in.
  • Document and link the demo from README.md and add a narrated walkthrough in docs/demo.md.

Reviewed changes

Copilot reviewed 5 out of 7 changed files in this pull request and generated 9 comments.

Show a summary per file
File Description
README.md Links the new demo and marks the operating-loop reference demo as implemented.
examples/demo/run-demo.sh Orchestrates the demo run (builds, starts services, replays signed webhooks, asserts outcomes).
examples/demo/github-stub.py Implements an in-memory GitHub API surface plus audit/state endpoints for assertions.
examples/demo/fake-coven-code Implements a contract-v2 stand-in runtime that validates tokenless brief + env-only git token.
docs/demo.md Provides a narrated, act-by-act walkthrough plus requirements for running the demo.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread README.md
Comment on lines +39 to +43
**Want to see the whole loop run?** `examples/demo/run-demo.sh` drives the
real adapter through the full operating loop — issue assignment, Check Run,
edited-in-place status comment, maintainer steering commands, permission
gate, familiar-voice draft PR — offline and self-verifying in about a minute.
[docs/demo.md](docs/demo.md) narrates it.
Comment thread README.md
| Label trigger | Implemented | Routes configured `trigger_labels` such as `coven:fix`. |
| Maintainer command protocol | Implemented | Typed `@familiar <verb>` grammar; casual mentions ignored; write-access gate; self-comments never re-trigger. |
| Marker-backed status comments | Implemented | One edited-in-place status surface per issue/PR; no duplicate bot comments. |
| Reference demo of the operating loop | Implemented | Offline, self-verifying replay of the full loop with a real adapter binary — see [docs/demo.md](docs/demo.md). |
Comment thread docs/demo.md
Comment on lines +3 to +7
This is the ClawSweeper-style reference demo of the coven-github operating
loop (issue #19): the **real adapter binary**, driven by signed webhook
deliveries, publishing to an in-memory GitHub API stub through a
contract-conformant fake `coven-code` runtime. No network, no GitHub App
registration, no credentials — one command, about a minute, self-verifying.
Comment thread docs/demo.md
Comment on lines +65 to +66
**Act 5 — steering: `status`.** Answered from the durable task store (the same
state Cave polls), listing the issue's tasks and their lifecycle states.
Comment thread docs/demo.md
Comment on lines +114 to +116
`cargo`, `python3` (stdlib only), `openssl`, `curl`. The script builds the
adapter with `cargo build -p coven-github`, picks free ports, and cleans up
after itself (scratch dir is kept on failure, or with `KEEP=1`).
Comment thread examples/demo/run-demo.sh
Comment on lines +55 to +56
for dep in cargo python3 openssl curl; do
command -v "$dep" >/dev/null || { echo "error: $dep is required" >&2; exit 64; }
Comment thread examples/demo/run-demo.sh
Comment on lines +187 to +206
issue_comment_payload() { # $1=commenter login $2=comment body
cat <<EOF
{
"action": "created",
"issue": {
"number": $ISSUE,
"title": "$ISSUE_TITLE",
"body": "$ISSUE_BODY",
"user": { "login": "$MAINTAINER" }
},
"comment": { "body": "$2", "user": { "login": "$1" } },
"repository": {
"name": "$REPO_NAME",
"owner": { "login": "$REPO_OWNER" }
},
"installation": { "id": $INSTALLATION_ID },
"sender": { "login": "$1" }
}
EOF
}
Comment on lines +109 to +112
def _actor(self):
auth = self.headers.get("Authorization", "")
token = auth.removeprefix("Bearer ").strip()
return WORLD.tokens.get(token, "app-jwt")
Comment on lines +43 to +49
"tests_run": [
{
"command": "cargo test -p auth refresh",
"status": "passed",
"output_summary": "9/9 passing",
}
],
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.

Produce ClawSweeper-style reference demo of the operating loop

2 participants