Repository navigation
refactor: move Workshop authority checks off the Gateway thread - #169966
Conversation
Reuse history-worker authority facts until existing session and transcript write receipts change. Preserve strict effect-time checks for provider dispatch and skill file writes without repeated main-thread SQL.
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: needs real behavior proof before merge. What this changesThis PR replaces repeated Workshop authority queries with worker-validated facts invalidated by existing session and transcript write receipts. Example: A Workshop review checks unchanged source authority five times.
Review scores
ProductKind: Performance · Worth it: Yes · Fix scope: Complete Merge readiness⛔ Blocked before merge - 3 items remain Keep this PR open: it addresses a remaining main-thread SQL path with a focused, owner-approved refactor; source review found no concrete introduced defect. Priority: P2 Before merge
FindingsNone. Tests
Agent review detailsHow this fits togetherBackground Workshop reviews fork completed conversation context, call a model, and update learned skill files; source-session authority guards provider dispatch and filesystem effects. flowchart TD
A[Completed conversation] --> B[Workshop review]
B --> C[History worker validation]
C --> D[Retained authority and write receipts]
E[Session and transcript writers] --> D
D --> F[Final authority guard]
F --> G[Provider send or skill file mutation]
Technical reviewBest possible solution: Retain the existing worker and receipt owners while preserving current authority checks immediately before each external effect. Do we have a high-confidence way to reproduce the issue? Current-main source directly shows the repeated synchronous authority query; no target code or tests were executed during this read-only review. Is this the best way to solve the issue? Reusing existing worker validation and write receipts is a focused solution that preserves one authority owner and explicitly records conservative cancellation behavior. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 037aa311e132. Merge-risk optionsMaintainer options:
Provenance checked
TestingProof path: in-process harness. SecurityNeeds attention: No concrete bypass was found, but final-effect validation of the changed authority mechanism remains unproven. EvidenceWhat I checked:
PR surfaceSource +51, Tests +12, Docs -3. Total +60 across 3 files. Added test files: 0. View PR surface stats
LabelsLabel changes: No label changes. Label justifications:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior. WorkflowClawSweeper edits this one comment on every review. Comment Reviewed October 12, 2026, 11:14 AM ET / 15:14 UTC. |
|
ClawSweeper found no concrete introduced defect. The additional end-to-end provider revocation trace is retained as a follow-up under the maintainer's relaxed landing policy, rather than a request for another review. Executed final-head CI passed all eight Workshop tests. They use real session permission/membership/lifecycle writes and real filesystem mutation, proving that revocation during file preparation prevents the write and subsequent actions remain denied. The provider-send guard is exercised through its production admission callback contract; that test does not claim to send an HTTP request. The live isolated baseline/candidate run will separately verify successful Workshop provider dispatch and finalization, and its SQL counts will be recorded in the PR body before merge. |
…claw#169966) Reuse worker-validated session authority and scoped Gateway write receipts while preserving effect-time revocation checks. Remove repeated synchronous anchor reads without adding worker requests. Live attribution: Workshop SQL 152 to 17, MAIN 135 to 0, requests unchanged at four. Focused CI, type/static gates, and two Codex review rounds passed; the sole inherited lint failure is fixed on main by 6db1d81.
What Problem This Solves
Autonomous Workshop reviews repeatedly queried the source session's permissions, lifecycle, and accepted transcript anchor on the Gateway thread. These checks ran from the review's general liveness callback, including provider dispatch and filesystem effects; the idle scheduler triggered the review, rather than a separate authority polling timer.
User Impact
Workshop keeps its effect-time authority checks while avoiding SQL for unchanged source authority. Permission changes, reset, replacement, deletion, transcript rewrite, and membership writes invalidate the retained fact. No schema, stored-data, retention, SDK, or update behavior changes.
A benign source write can conservatively cancel a review if an unprepared liveness check runs before async refresh. A fresh effect scope can still validate an accepted anchor after later appends. This favors a safe, recoverable cancellation over weakening the provider-send guard.
Why This Change Was Made
Reuse the existing history-worker anchor operation and the Gateway's existing scoped write receipts for the logical session and transcript. The initial worker read supplies the cached authority; later effect scopes refresh it only after a relevant receipt changes. The final synchronous guard compares its retained receipt, physical source identity, and live Workshop configuration without SQLite. It stays strict outside prepared scopes too, because provider dispatch uses that callback directly.
Removed check: the repeated joined session/anchor SELECT in the Workshop liveness callback. Accepted edge case: external processes must use the Gateway or hold exclusive ownership while it is stopped; independent foreign SQLite writes are outside the single-owner contract. No new generations, handshake, worker protocol, or synchronous fallback.
Workshop's indirect MAIN SQL route is 1 → 0. Direct Workshop T1 primitives remain 0 → 0; shared session kernels retain their other callers and are not reclassified as worker-only. The existing detached validator stays available to its other owners.
Related: #169871, #169894, #169594.
Evidence
git diff --check: passed.src/gateway/server-methods/users-github.test.ts:679:typescript/no-unnecessary-type-argumentsoncreateDeferredCore<void>(). The CI merge base used file blobc1c09082fa2438b05c6ae522290d013b035cc143, identical to the independently reproduced main failure at13e0925afdba3d6fdca82f1a15d610d3c1f675d9. Main subsequently fixed that exact unnecessary type argument in34671d49ec92; this PR does not touch the file and its merge preserves the fix. Knip was not selected by CI; its separate CPU-gated script, production, and full-tree export scans all passed with zero entries. No update cell or SDK API diff is applicable.Scope: this removes the repeated review-authority route. A separate change-notice generation read in
review-outcome.tsremains for the follow-up; the no-change live review does not exercise it. Direct T1 primitive counts therefore do not imply every Workshop caller is already asynchronous.One pair measured base
380c115e3926against candidatea5afb5e17930; ten warmed turns per side. This was a heavily loaded host, so timings are not performance claims.Workshop attribution includes worker request IDs whose transport stacks no longer contain the original caller: model context 7 SQL, transcript anchors 9 SQL across two requests, and changes list 1 SQL, unchanged on both sides. The saving is exactly 135 repeated MAIN authority SELECTs, with no additional worker request or SQL. Those baseline checks ran during cron (32) and compaction (103); neither side ran Workshop SQL during warmed turns or literal idle. The earlier idle-only rate therefore does not reproduce in this pair. Warmed mean SQL is 417.0 → 419.1 and requests 98.2 → 97.1; these raw totals include unrelated background activity.
The one candidate warmed MAIN statement is the unchanged cron session-reaper
agent_deletion_journalSELECT. Its whole-run count is exactly 3 → 3: baseline first-turn/cron/idle versus candidate warm turn 7/cron/idle. Workshop MAIN remains zero. The extra warmed snapshot also comes from timer placement: memory-corpus snapshots 8 → 7, registry maintenance 0 → 1, cron reaper 0 → 1. Both maintenance owners have exactly two snapshots per whole run; total snapshots fall 29 → 24. Their relevant source hashes are identical, and this PR's authority path first runs after all warmed turns. These are displaced unchanged maintenance operations, not added checks or invalidation work.LOC: production +57/-6, tests +67/-55, docs +19/-22; net +60 across three files.