Side A implements a coherent new feature (invite links) end-to-end: server events/reducer state, RPC handlers, CLI commands, HTML routes, and a dedicated integration test file, all wired through existing patterns with real design tradeoffs (TTL, exhaustion, redemption tying into OAuth flow). Side B is largely deployment/infra glue (Dockerfile, fly.toml, CI) plus a UI dashboard and audit-broadcast plumbing that, while functional, is more operational scaffolding and cosmetic CSS than durable core-domain logic, and it hardcodes org-specific repo/contributor config that is brittle and less generally reusable.
constitution · epochs · watch · epoch 3
c_55f1cdf12e22 (tommy-mor) vs c_7a129e904906 (tommy-mor)
download prompt · raw event · cmp_62b9ef89883cf9
council reasoning
A lands a full invite lifecycle (mint RPC, /join redemption into grants, multi-cap RoomGrant, RoomAudit, CLI, reducer/timeline types) with a dedicated invites integration test—durable product capability. B’s deploy pipeline, /watch SSE audit UI, and production repo/contributor config are operationally important but mostly wire the existing constitution loop for production rather than adding comparable core domain behavior.
Side A implements substantial new project functionality: an invite-based room access flow spanning server, CLI, RPC, authentication, state management, API types, routing, and end-to-end integration tests, while also extending grants to multiple capabilities and adding room audit support. Side B mainly adds deployment infrastructure, a production dashboard, SSE audit/status reporting, and CI/CD configuration; valuable operationally, but it contributes less core application behavior than the end-user invite and permission features in Side A.
sides
A — c_55f1cdf12e22 (tommy-mor)
message
[00be3a29] invite system
diff preview
diff --git a/bb.edn b/bb.edn
index 50be8232847e672b3f273a2fb25ddd1d12adb7e2..818f850765370d12d58f239e287764fc3649d78b 100644
--- a/bb.edn
+++ b/bb.edn
@@ -47,14 +47,16 @@
"RUST_LOG" "info"})})))}
test
- {:doc "Full test suite: integration + auth + grants"
+ {:doc "Full test suite: integration + auth + grants + invites"
:requires ([test.integration :as integration]
[test.auth :as auth]
- [test.grants :as grants])
+ [test.grants :as grants]
+ [test.invites :as invites])
:task (do
(integration/integration)
(auth/auth-test)
- (grants/grants-test))}
+ (grants/grants-test)
+ (invites/invites-test))}
perf
{:doc "Performance test: concurrent HTTP requests to detect blocking I/O"
diff --git a/cli/src/main.rs b/cli/src/main.rs
index e5833b0b93d8e667b94c574ba2b0f8cb758ff3df..8eda9f485bd1f7392f1e34be27176c21e20354eb 100644
--- a/cli/src/main.rs
+++ b/cli/src/main.rs
@@ -105,6 +105,23 @@ enum ScopedCmd {
#[arg(long)]
json: bool,
},
+
+ /// Mint a shareable invite link (24h TTL, in-memory until redeemed). Requires Manage on the room.
+ InviteLink {
+ /// Comma-separated: view, post, vote, add_item, manage
+ #[arg(long = "caps", value_delimiter = ',')]
+ caps: Vec<String>,
+ #[arg(long, default_value_t = 1)]
+ uses: usize,
+ #[arg(long)]
+ json: bool,
+ },
+
+ /// List principals granted access in this room (requires View or Manage)
+ Audit {
+ #[arg(long)]
+ json: bool,
+ },
}
#[derive(Subcommand, Debug)]
@@ -514,17 +531,35 @@ fn print_thread(resp: &ThreadDetailResponse) {
.duration_since(std::time::UNIX_EPOCH)
.unwrap_or_default()
.as_millis() as i64;
- if resp.total > resp.posts.len() {
- let end = resp.offset + resp.posts.len();
- eprintln!("# showing {}-{} of {} posts (--offset N --limit N to paginate)", resp.offset, end.saturating_sub(1), resp.total);
+ if resp.total > resp.items.len() {
+ let end = resp.offset + resp.items.len();
+ eprintln!(
+ "# showing {}-{} of {} rows (--offset N --limit N to paginate)",
+ resp.offset,
+ end.saturating_sub(1),
+ resp.total
+ );
}
- for (i, post) in resp.posts.iter().enumerate() {
- let timeago = slug_types::timeago::timeago_compact(now_ms, post.ts);
- let body = &post.body.trim();
- println!("<post index=\"{}\" timeago=\"{}\">", post.index, timeago);
- println!("{}", body);
- println!("</post>");
- if i + 1 < resp.posts.len() {
+ for (i, item) in resp.items.iter().enumerate() {
+ match item {
+ ThreadItem::Post {
+ index,
+ ts,
+ body,
+ ..
+ } => {
+ let timeago = slug_types::timeago::timeago_compact(now_ms, *ts);
+ let body = body.trim();
+ println!("<post index=\"{}\" timeago=\"{}\">", index, timeago);
+ println!("{}", body);
+ println!("</post>");
+ }
+ ThreadItem::System { ts, text } => {
+ let timeago = slug_types::timeago::timeago_compact(now_ms, *ts);
+ println!("<system timeago=\"{}\">{}</system>", timeago, text.trim());
+ }
+ }
+ if i + 1 < resp.items.len() {
println!();
println!();
}
@@ -1036,6 +1071,95 @@ async fn run_scoped(base: &str, room: &str, sub: ScopedCmd) -> Result<()> {
}
}
},
+ ScopedCmd::InviteLink { caps, uses, json } => {
+ let caps: Vec<String> = caps
+ .into_iter()
+ .flat_map(|s| {
+ s.split(',')
+ .map(|p| p.trim().to_lowercase())
+ .filter(|p| !p.is_empty())
+ .collect::<Vec<_>>()
+ })
+ .collect();
+ if caps.is_empty() {
+ return Err(anyhow!("--caps is required (e.g. --caps view,post,vote)"));
+ }
+ let bearer = effective_bearer().ok_or_else(|| {
+ anyhow!(
+ "no bearer token: run `slugsocial identity start --rig <rig> --model <model>` \
+ then `slugsocial identity poll <session>`, or set SLUG_BEARER_TOKEN / ~/.config/slugsocial/token"
+ )
+ })?;
+ let batch = send_rpc(
+ &client,
+ base,
+ Some(&bearer),
+ vec![RpcCommand::RoomMintInvite {
+ room: room.to_string(),
+ capabilities: caps,
+ max_uses: uses,
+ }],
+ )
+ .await?;
+ match rpc_line_ok(&batch.results[0])? {
+ RpcResult::RoomInviteMinted {
+ invite_url,
+ expires_at_ms,
+ max_uses,
+ } => {
+ if json {
+ println!(
+ "{}",
+ serde_json::to_string_pretty(&serde_json::json!({
+ "invite_url": invite_url,
+ "expires_at_ms": expires_at_ms,
+ "max_uses": max_uses,
+ }))?
+ );
+ } else {
+ println!("{invite_url}");
+ println!("(Expires in 24 hours. Max uses: {max_uses})");
+ }
+ }
+ _ => return Err(anyhow!("unexpected RPC result")),
+ }
+ }
+ ScopedCmd::Audit { json } => {
+ let bearer = effective_bearer().ok_or_else(|| {
+ anyhow!(
+ "no bearer token: run `slugsocial identity start --rig <rig> --model <model>` \
+ then `slugsocial identity poll <session>`, or set SLUG_BEARER_TOKEN / ~/.config/slugsocial/token"
+ )
+ })?;
+ let batch = send_rpc(
+ &client,
+ base,
+ Some(&bearer),
+ vec![RpcCommand::RoomAudit {
+ room: room.to_string(),
+ }],
+ )
+ .await?;
+ match rpc_line_ok(&batch.results[0])? {
+ RpcResult::RoomAudit(resp) => {
+ if json {
+ println!("{}", serde_json::to_string_pretty(&resp)?);
+ } else {
+ println!("room {}", resp.room);
+ if resp.grants.is_empty() {
+ println!("(no grants recorded)");
+ } else {
+ let w_user = resp.grants.iter().map(|g| g.username.len()).max().unwrap_or(0);
+ for g in &resp.grants {
+ let caps = g.capabilities.join(", ");
+ println!("{:<width$} {}", g.username, caps, width = w_user.max(8));
+ }
+ }
+ }
+ }
+ _ => return Err(anyhow!("unexpected RPC result")),
+ }
+ }
ScopedCmd::Check { file, json } => {
let mut text = String::new();
match file {
diff --git a/server/src/api/auth.rs b/server/src/api/auth.rs
index 995ce4a61d29b024c399c656134f541ecfd880cf..b45ba39419c84af8bf2333fc9b7d47e98525c45f 100644
--- a/server/src/api/auth.rs
+++ b/server/src/api/auth.rs
@@ -12,12 +12,61 @@ use tokio::sync::RwLock;
use crate::{
api::helpers::{api_error, now_ms, sha256_hex},
- events::{Event, TokenIssued, UserRegistered},
+ events::{Event, GrantAdded, TokenIssued, UserRegistered},
identity::{parse_agent, parse_username},
html::{auth_complete_page, auth_signed_in_fragment, choose_username_error_fragment, choose_username_page},
state::{AppState, PendingSession},
};
+/// Delegate id for browser users who land via `/join/inv_…` (no CLI agent).
+const INVITE_BROWSER_AGENT: &str = "00000000-0000-0000-0000-000000000000:invite:web/join";
+
+async fn apply_invite_redemption(state: &AppState, invite_token: &str, grantee_username: &str) -> Result<(), String> {
+ let now = now_ms();
+ let ga = {
+ let mut invites = state.invites.write().await;
+ let Some(inv) = invites.get_mut(invite_token) else {
+ return Err("invite not found".into());
+ };
+ if now > inv.expires_at_ms {
+ invites.remove(invite_token);
+ return Err("invite expired".into());
+ }
+ if inv.current_uses >= inv.max_uses {
+ return Err("invite exhausted".into());
+ }
+ inv.current_uses += 1;
+ Event::GrantAdded(GrantAdded {
+ ts: now,
+ room_id: inv.room_id.clone(),
+ username: grantee_username.to_string(),
+ capabilities: inv.capabilities.clone(),
+ granted_by: inv.inviter.clone(),
+ })
+ };
+
+ match state.event_log.append(&ga).await {
+ Ok(()) => {
+ let mut reduced = state.reduced.write().await;
+ reduced.apply_event(ga);
+ let mut invites = state.invites.write().await;
+ if let Some(inv) = invites.get(invite_token) {
+ if inv.current_uses >= inv.max_uses {
+ invites.remove(invite_token);
+ }
+ }
+ Ok(())
+ }
+ Err(e) => {
+ let mut invites = state.invites.write().await;
+ if let Some(inv) = invites.get_mut(invite_token) {
+ inv.current_uses = inv.current_uses.saturating_sub(1);
+ }
+ Err(format!("{e}"))
+ }
+ }
+}
+
fn pending_sessions(state: &AppState) -> Arc<RwLock<HashMap<String, PendingSession>>> {
state.pending_sessions.clone()
}
@@ -115,6 +164,42 @@ pub struct AuthLoginQuery {
pub session: String,
}
+pub async fn get_join_invite(Path(token): Path<String>, State(state): State<AppState>) -> impl IntoResponse {
+ let token = token.trim().to_string();
+ if token.is_empty() {
+ return api_error(StatusCode::NOT_FOUND, "invite invalid or expired", None).into_response();
+ }
+ let now = now_ms();
+ let valid = {
+ let invites = state.invites.read().await;
+ match invites.get(&token) {
+ None => false,
+ Some(inv) => now <= inv.expires_at_ms && inv.current_uses < inv.max_uses,
+ }
+ };
+ if !valid {
+ return api_error(StatusCode::NOT_FOUND, "invite invalid or expired", None).into_response();
+ }
+
+ let session = format!("p_{}", uuid::Uuid::new_v4().simple());
+ let s = PendingSession {
+ agent: INVITE_BROWSER_AGENT.to_string(),
+ created_ts: now_ms(),
+ provider: None,
+ provider_id: None,
+ redeem_invite: Some(token),
+ complete: None,
+ };
+ state.pending_sessions.write().await.insert(session.clone(), s);
+
+ let public_url = std::env::var("SLUG_PUBLIC_URL").unwrap_or_else(|_| "http://127.0.0.1:8080".to_string());
+ Redirect::temporary(&format!(
+ "{public_url}/auth/login?session={}",
+ urlencoding::encode(&session)
+ ))
+ .into_response()
+}
+
pub async fn get_auth_login(Query(q): Query<AuthLoginQuery>, State(state): State<AppState>) -> impl IntoResponse {
// Redirect to Google auth endpoint.
let sessions = pending_sessions(&state);
@@ -205,6 +290,7 @@ pub async fn get_auth_callback(Query(q): Query<AuthCallbackQuery>, State(state):
s.provider = Som
… preview truncated; 45,403 characters omittedB — c_7a129e904906 (tommy-mor)
message
[4e327784] deploy live constitution dashboard Expose auditable progress and event streaming, configure the production roots and runtime, and make tested main-branch commits the deployment authority. Co-authored-by: Cursor <cursoragent@cursor.com>
diff preview
diff --git a/.dockerignore b/.dockerignore
new file mode 100644
index 0000000000000000000000000000000000000000..c9d63a722beba0a0297fc853089332c460ab78dd
--- /dev/null
+++ b/.dockerignore
@@ -0,0 +1,7 @@
+.git
+.venv
+.hypothesis
+__pycache__
+tests
+*.json
+*.bsp
diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml
new file mode 100644
index 0000000000000000000000000000000000000000..76dcdf82d53177c1e47d86b23a54523239d232a6
--- /dev/null
+++ b/.github/workflows/deploy.yml
@@ -0,0 +1,49 @@
+name: Test and deploy
+
+on:
+ push:
+ branches: [main]
+
+concurrency:
+ group: production
+ cancel-in-progress: false
+
+permissions:
+ contents: read
+
+jobs:
+ test:
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/checkout@v4
+
+ - uses: astral-sh/setup-uv@v6
+ with:
+ enable-cache: true
+
+ - name: Run Python tests
+ run: uv run pytest -q
+
+ - name: Install Babashka
+ run: |
+ curl -fsSL https://raw.githubusercontent.com/babashka/babashka/master/install \
+ | sudo bash -s -- --dir /usr/local/bin
+
+ - name: Run process integration tests
+ run: bb TEST.sh
+
+ deploy:
+ needs: test
+ runs-on: ubuntu-latest
+ environment:
+ name: production
+ url: https://token.slug.social
+ steps:
+ - uses: actions/checkout@v4
+
+ - uses: superfly/flyctl-actions/setup-flyctl@master
+
+ - name: Deploy to Fly
+ run: flyctl deploy --remote-only
+ env:
+ FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }}
diff --git a/Dockerfile b/Dockerfile
new file mode 100644
index 0000000000000000000000000000000000000000..c9a5c00782371c19ad5ab5c58cf6f5a8ffec0141
--- /dev/null
+++ b/Dockerfile
@@ -0,0 +1,17 @@
+FROM ghcr.io/astral-sh/uv:python3.11-bookworm-slim
+
+RUN apt-get update \
+ && apt-get install -y --no-install-recommends git ca-certificates \
+ && rm -rf /var/lib/apt/lists/*
+
+WORKDIR /app
+COPY pyproject.toml uv.lock ./
+RUN uv sync --frozen --no-install-project
+
+COPY constitution.py ./
+
+ENV PATH="/app/.venv/bin:${PATH}" \
+ PYTHONUNBUFFERED="1"
+
+EXPOSE 8080
+CMD ["python", "constitution.py"]
diff --git a/constitution.py b/constitution.py
index 4bee9f83663ab7fb36db95129b92b64b4ef57258..a58257e1881b21d1d6fa8e68a3faa222e4f661ef 100644
--- a/constitution.py
+++ b/constitution.py
@@ -24,12 +24,12 @@ A daily GitHub Action backs up the JSONL ledger to the same repo.
Run: uv run constitution.py
"""
-from decimal import Decimal, getcontext
+from decimal import Decimal, getcontext, DefaultContext
from datetime import datetime, timezone
from fastapi import FastAPI, Request, Response
from fastapi.responses import PlainTextResponse, HTMLResponse
from starlette.middleware.sessions import SessionMiddleware
-import json, time, os, asyncio, httpx, pathlib, subprocess, hashlib, re, fcntl
+import json, time, os, asyncio, httpx, pathlib, subprocess, hashlib, re, fcntl, base64
import sympy as sp # type: ignore[reportMissingImports]
from tenacity import retry, retry_if_exception, stop_after_attempt, wait_exponential
from evaleval import (
@@ -37,6 +37,7 @@ from evaleval import (
exec_event, One, Two, Three, Selector, MORPH, PREPEND,
)
+DefaultContext.prec = 50
getcontext().prec = 50
app = FastAPI()
@@ -129,14 +130,47 @@ OPENROUTER_BASE_URL = os.environ.get("OPENROUTER_BASE_URL", "https://openrouter.
# using the exact same source; their normalized values are committed to every
# discovery event.
DEFAULT_REPOSITORIES = [
+ {
+ "id": "constitution",
+ "url": "https://github.com/sortersocial/constitution.git",
+ "refs": ["refs/heads/**"],
+ },
{
"id": "slug",
- "url": "https://github.com/tommy-mor/slug.git",
+ "url": "https://github.com/sortersocial/slug.git",
+ "refs": ["refs/heads/**"],
+ },
+ {
+ "id": "sorter",
+ "url": "https://github.com/sorterisntonline/sorter.git",
+ "refs": ["refs/heads/**"],
+ },
+ {
+ "id": "sorter2",
+ "url": "https://github.com/sortersocial/sorter2.git",
+ "refs": ["refs/heads/**"],
+ },
+ {
+ "id": "sorter-oldest",
+ "url": "https://github.com/tommy-mor/sorter.git",
"refs": ["refs/heads/**"],
},
]
DEFAULT_CONTRIBUTORS = {
"tommy-mor": ["thmorriss@gmail.com"],
+ "christopher-whitman": [
+ "chris@cwwhitman.com",
+ "7566903+cwwhitman@users.noreply.github.com",
+ ],
+ "jake-chvatal": [
+ "jake+github@uln.industries",
+ "jakechvatal@gmail.com",
+ "jake@isnt.online",
+ ],
+ "lara": ["me@lara.lv"],
+ "nat-reid": ["nathanielreid@gmail.com"],
+ "zod": ["jason.p.mcel@gmail.com", "me@zod.tf"],
+ "jovan": ["jovan@slug.social", "jovan@getcivicai.com"],
}
REPOSITORIES = json.loads(
@@ -147,6 +181,7 @@ CONTRIBUTORS = json.loads(
)
GIT_MIRROR_DIR = pathlib.Path(os.environ.get("GIT_MIRROR_DIR", "/data/git"))
GIT_TIMEOUT_SECONDS = int(os.environ.get("GIT_TIMEOUT_SECONDS", "120"))
+GITHUB_TOKEN = os.environ.get("GITHUB_TOKEN", "")
# Council model IDs: slug.social garden rank under this parent (bodies = OpenRouter URLs), then top-up from OpenRouter list.
SLUG_SOCIAL_BASE_URL = os.environ.get("SLUG_SOCIAL_BASE_URL", "https://slug.social").rstrip("/")
@@ -661,20 +696,30 @@ def _git(repo: pathlib.Path | None, *args: str, input_bytes: bytes | None = None
if repo is not None:
command += ["-C", str(repo)]
command += list(args)
+ git_env = {
+ **os.environ,
+ "GIT_CONFIG_NOSYSTEM": "1",
+ "GIT_CONFIG_GLOBAL": os.devnull,
+ "GIT_NO_REPLACE_OBJECTS": "1",
+ "LC_ALL": "C",
+ "TZ": "UTC",
+ }
+ if GITHUB_TOKEN:
+ credential = base64.b64encode(
+ f"x-access-token:{GITHUB_TOKEN}".encode()
+ ).decode()
+ git_env.update({
+ "GIT_CONFIG_COUNT": "1",
+ "GIT_CONFIG_KEY_0": "http.https://github.com/.extraHeader",
+ "GIT_CONFIG_VALUE_0": f"Authorization: Basic {credential}",
+ })
try:
result = subprocess.run(
command,
input=input_bytes,
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
- env={
- **os.environ,
- "GIT_CONFIG_NOSYSTEM": "1",
- "GIT_CONFIG_GLOBAL": os.devnull,
- "GIT_NO_REPLACE_OBJECTS": "1",
- "LC_ALL": "C",
- "TZ": "UTC",
- },
+ env=git_env,
timeout=GIT_TIMEOUT_SECONDS,
check=False,
)
@@ -844,9 +889,15 @@ def _build_discovery(epoch_n: int, boundary_ms: int, events: list) -> GitDiscove
canonical_location = min(
locations[qualified_oid], key=lambda x: (x[0], x[1])
)
+ # One commit may be reachable from dozens of refs in the same mirror.
+ # Verify its object once per repository, not once per source ref.
+ object_locations = {
+ (str(m), raw_oid): (m, raw_oid)
+ for _, _, m, raw_oid in locations[qualified_oid]
+ }
object_hashes = {
hashlib.sha256(_git(m, "cat-file", "commit", raw_oid)).hexdigest()
- for _, _, m, raw_oid in locations[qualified_oid]
+ for m, raw_oid in object_locations.values()
}
if len(object_hashes) != 1:
raise RuntimeError(f"conflicting Git objects share OID {qualified_oid}")
@@ -994,11 +1045,55 @@ async def discover_repositories(epoch_n: int, boundary_ms: int) -> GitDiscovery:
SSE_CLIENTS = []
+AUDIT_HISTORY = []
+AUDIT_SEQUENCE = 0
+PROCESS_STATE = {
+ "running": False,
+ "phase": "idle",
+ "progress": 100,
+ "message": "Waiting for the next epoch",
+}
+
+
+def _sse_event(event_name: str, payload: dict) -> str:
+ return (
+ f"event: {event_name}\n"
+ f"data: {json.dumps(payload, separators=(',', ':'))}\n\n"
+ )
+
+
+async def broadcast_audit(
+ kind: str,
+ message: str,
+ *,
+ progress: int | None = None,
+ phase: str | None = None,
+) -> dict:
+ global AUDIT_SEQUENCE
+ AUDIT_SEQUENCE += 1
+ if progress is not None:
+ PROCESS_STATE["progress"] = max(0, min(100, int(progress)))
+ if phase is not None:
+ PROCESS_STATE["phase"] = phase
+ PROCESS_STATE["message"] = message
+ payload = {
+ "id": AUDIT_SEQUENCE,
+ "timestamp_ms": int(time.time() * 1000),
+ "kind": kind,
+ "message": message,
+ **PROCESS_STATE,
+ }
+ AUDIT_HISTORY.append(payload)
+ del AUDIT_HISTORY[:-200]
+ wire = _sse_event("audit", payload)
+ for queue in list(SSE_CLIENTS):
+ await queue.put(wire)
+ return payload
async def broadcast_js(js: str):
"""Send a JS snippet to all connected SSE clients."""
- for queue in SSE_CLIENTS:
+ for queue in list(SSE_CLIENTS):
await queue.put(js)
@@ -1006,10 +1101,29 @@ async def rank_commits(commits: list[dict]):
if not commits:
return {}, []
- models = await fetch_top_models(n=3)
contributors = sorted(set(c["contributor"] for c in commits))
- if len(contributors) > 1 and not models:
+ if len(contributors) == 1:
+ await broadcast_audit(
+ "ranking",
+ f"Only {contributors[0]} is eligible; rank is 1.0",
+ progress=90,
+ phase="finalizing",
+ )
+ return {contributors[0]: Decimal("1")}, []
+ if not (OPENROUTER_API_KEY or "").strip():
+ raise RuntimeError(
+ "OPENROUTER_API_KEY is required when multiple contributors need ranking"
+ )
+
+ models = await fetch_top_models(n=3)
+ if not models:
raise RuntimeError("no council models available for contributor ranking")
+ await broadcast_audit(
+ "council",
+ f"Council selected: {', '.join(models)}",
+ progress=35,
+ phase="ranking",
+ )
await broadcast_js(exec_event(Three[Selector("#emission-log")][PREPEND][
["div.log-council", f"Council: {', '.join(models)} — {len(commits)} commits"]
]))
@@ -1035,6 +1149,11 @@ async def rank_commits(commits: list[dict]):
async def compare_fn(i, j):
a1, a2 = authors[i], authors[j]
+ await broadcast_audit(
+ "comparison",
+ f"Comparing {a1} with {a2}",
+ phase="ranking",
+ )
await broadcast_js(exec_event(Three[Selector("#emission-status")][MORPH][
["div#emission-status", f"Comparing {a1} vs {a2}…"]
]))
@@ -1050,6 +1169,11 @@ async def rank_commits(commits: list[dict]):
if winner_weight <= 0 or loser_weight <= 0:
raise ValueError("ratio weights must be positive")
results.append((w, l, winner_weight, loser_weight))
+ await broadcast_audit(
+ "vote",
+ f"{model}: {authors[w]} over {authors[l]} ({result['ratio']})",
+ phase="ranking",
+ )
await broadcast_js(exec_event(Three[Selector("#emission-log")][PREPEND][
["div.log-vote",
["span.model", model], " — ",
@@ -1059,6 +1183,11 @@ async def rank_commits(commits: list[dict]):
]
]))
except Exception as e:
+ await broadcast_audit(
+ "error",
+ f"{model} failed: {e}",
+ phase="error",
+ )
await broadcast_js(exec_event(Three[Selector("#emission-log")][PREPEND][
["div.log-error", f"⚠ {model}: {e}"]
]))
@@ -1068,8 +1197,13 @@ async def rank_commits(commits: list[dict]):
async def progress_fn(ev):
if ev["phase"] == "spanning_tree":
label = f"Spanning tree: {ev['step']}/{ev['total']}"
+
… preview truncated; 28,089 characters omittedHardlinks — judgments / attempts / prompt
judgments
attempts
Prompt text is loaded only by the download route.