Multiplayer agent harness for work.
Explain wall of shame categories and require each in review (#2131)
Regan Bell5867c42a3d7d
diff --git a/AGENTS.md b/AGENTS.mdindex 1b00af8ea..fa5bf8833 100644--- a/AGENTS.md+++ b/AGENTS.md@@ -43,7 +43,7 @@ Two habits that keep task-focused changes from scarring the rest of the repo:is correct, and that belief is the bias review exists to defeat. Never self-review in theauthoring context, however small the diff; a green CI run is not review either. Whatscales with risk is how deep the reviewer goes — a change with a narrow blast radius- warrants one reviewer at modest effort scoped to the diff, while core control flow, auth+ warrants modest effort scoped to the diff for each reviewer, while core control flow, authand credentials, data loss or migrations, concurrency and retry logic, spend, public APIcontracts, the shared helpers above that every path flows through, or a diff too large tohold in your head warrant high effort and several reviewers with distinct lenses. Judge@@ -51,6 +51,31 @@ Two habits that keep task-focused changes from scarring the rest of the repo:fifty importers is not a small change. The reviewer, not the author, has the last word ondepth: a modest pass that spots risk it wasn't scoped for escalates on its own initiativerather than staying in its lane. Resolve what they find before merging.+- **Run independent Wall of shame reviews in parallel for every PR.** Dispatch a+ separate fresh-context subagent or independent reviewer for each lens in the current+ [Wall of shame](./docs/SPEC.md#wall-of-shame), including newly added lenses. Only+ Honorable mentions may share one combined reviewer. Launch reviews asynchronously+ and in parallel within available capacity, queuing any overflow. Do not wait for+ reviews before opening or updating the PR, running checks, or continuing other work.+ Each reviewer reads their lens and examples, examines the diff and affected paths,+ and returns **accept** or **request changes**, a **score out of 100** (higher is+ better), and **1–2 sentences** explaining their assessment. Cite concrete findings+ and state the smallest correction needed; explain when a lens has no applicable+ concerns. Scores are informational, with no aggregate score or numeric merge threshold.+ Put each reviewer's actual verdict, score, and concise assessment in the **PR+ description**, labeled by lens and reviewer and tied to the reviewed commit. Update+ the description as reviews arrive; mark pending reviews honestly and never invent+ results or substitute the author's self-review. After edits, have independent+ reviewers reassess affected lenses and explicitly carry forward unaffected results.+ These reviews run alongside PR work; before merging, every lens must have accepted+ and all requested changes must be resolved. They supplement the correctness,+ security, and regression review above.+- **Disclose config-matrix and database-schema changes in the PR description.** Name+ added, removed, or changed settings, flags, modes, and providers, including changes to+ defaults, precedence, and supported combinations. Name changed tables, columns,+ indexes, and constraints, and describe migrations or backfills and any rollout or+ compatibility implications. Explain why the changes are needed. If either area is+ unchanged, say so explicitly; keep the disclosure proportional to the change.- **Verify locally with the affected tests, not the whole suite.** Run the tests coveringwhat you changed plus typecheck and lint, then push and let CI be the full gate — CIshards the suite across parallel runners, and reproducing that serially costs severaldiff --git a/docs/SPEC.md b/docs/SPEC.mdindex 8c91b4eea..86a9f671b 100644--- a/docs/SPEC.md+++ b/docs/SPEC.md@@ -34,87 +34,149 @@Patterns from this repo's history, with the PRs that introduced or removed them.-### Overengineering (3 examples)+### Overengineering (6 examples)-- **qm#1311** (2026-09-16): Admin redesign (#1276) shipped an Original/New comparison toggle, duplicate original cards/styles and variant URL plumbing; replacement PR removed ~1,006 net lines of scaffolding. _Status:_ wound back in qm#1311.-- **qm#896** (2026-09-02): An optional core-search backend injection point had no production caller and existed only for tests; removed. _Status:_ wound back in qm#896.-- **qm#894** (2026-09-02): Procedural memory ('Memorable') landed as a pluggable provider under a new scope-aware memory router (#700) with MEMORY_PROVIDER_CONFIG routes, alongside a separate MEMORY_STRATEGY switch.+Let sLOC +/- be your guide here. Small and net-negative LOC fixes will be rewarded. This codebase at baseline is flabby -- many bugs can be fixed by _deleting_, _removing_, _simplifying_. For features: use restraint when adding new subsystems that increase surface area and widen the config matrix we will have to support.-### Band-aid fixes (8 examples)+Past mistakes and examples:-- **qm#1743** (2026-09-30): Refusal fallback extended by regex-matching Anthropic usage-policy text and 'gateway model is unavailable' to trigger a hard-coded alternate-model ladder (claude-opus-5 / claude-sonnet-5), plus a new admin fallbackRuntime.-- **qm#1748** (2026-09-30): Every non-Modal sandbox took one exclusive sandbox-resource:<id> advisory lock around each command/file op, so sessions sharing a computer queued behind each other; replaced a backend!=='modal' special case with shared locks and a parksOnTeardown profile property. _Status:_ wound back in qm#1748.-- **qm#1753** (2026-09-30): Session-counter recount ran on every store init under the global maintenance lock (not a one-time migration), freezing chat writes during blue/green promotion; removed. _Status:_ wound back in qm#1753.-- **qm#1432** (2026-09-19): Per-turn reconciliation of a shared skills/ index under a sandbox-wide advisory lock (skill projection) stalled turns 5 minutes; replaced with an explicit skill tool and per-turn skill dirs. _Status:_ wound back in qm#1432.-- **qm#1133** (2026-09-12): A factory-specific retry ladder (FACTORY_READ_RETRIES=6) was added around sandbox readProcess polling after one timeout under load. _Status:_ wound back (factory code absent on current main).-- **qm#965** (2026-09-07): One legacy \u0000 payload bricked sessions; fixes proposed tolerating poisoned rows and sanitizing every Postgres text write. _Status:_ unknown.-- **qm#394** (2026-08-13): Memory tool silently coerces malformed `remember` calls (content/query/bare string) into facts instead of fixing the tool schema.-- **qm#469** (2026-08-13): Sandbox status collapses any unanswering shell into a 'wedged' verdict with baked-in 'restart the computer' advice.+- Amendments to the master spec that are way too large for the importance of what the PR actually adds [qm#2138](https://github.com/yc-software/qm/pull/2138).+- The loops subsystem should have just re-used the crons machinery, but it built its own little empire for no reason [qm#963](https://github.com/yc-software/qm/pull/963).+- The artifact pages in the web UI could have all used the same group-by backbone, but each one got its own design for no reason [qm#963](https://github.com/yc-software/qm/pull/963).+- **Delivery retries** (2026-08-30): Undeliverable Slack notices prompted a proposal for attempt counters, scheduled exponential backoff, a parked state, and admin visibility. The proposal optimized for eventually delivering messages long after they were useful; simply expiring stale deliveries addressed the actual need. [qm#2133](https://github.com/yc-software/qm/pull/2133).+- **Harness/model selection** (2026-07-17): A selector grew into a proposed "agent profile" platform with its own catalog, preference layers, upgrade acknowledgments, readiness handling, and cohort rollout. The smaller solution extended the existing scoped setting with a `{ harness, model }` pair and reused the existing configuration and picker machinery. [qm#2134](https://github.com/yc-software/qm/pull/2134).+- **Admin tool** (2026-09-17–18): Concern about oversized responses grew into a 43-file, roughly 4,580-line patch with field limits, custom JSON validation, layered timeouts, duplicate concurrency limits, and a special handshake. Only after pushback did the agent inventory actual calls and identify large transcripts as the concrete risk. The replacement used bounded transcript pagination and a thin read-only tool: 9 files, +329/−18. _Source/status:_ original transcript and patch not yet recovered; size and rejection claims are unverified.-### Duplication (8 examples)+### Band-aid fixes (10 examples)-- **qm#1776** (2026-09-30): Sprites cold-boot '503 Process not ready' exec re-send implemented on main after the same fix (qm#1489) had already landed only on the long-lived factory side branch.-- **qm#1520** (2026-09-22): Factory required pasted factory-anthropic/-github/-linear/-slack keychain secrets duplicating core's own model auth and connectors (two sources of truth); QM-73..76 resolve from core config/owner connectors instead. _Status:_ wound back in qm#1520, qm#1522, qm#1523, qm#1524 (on factory branch).-- **qm#1476** (2026-09-21): Context settings had its own model picker separate from the composer's; switched to reuse the composer model/preset picker. _Status:_ wound back in qm#1476 (both plugins/web-ui/src/model-picker.ts and context-model.ts still exist).-- **qm#1427** (2026-09-19): The 'software factory' loop (wrapper, workflows, own Linear/GitHub/Slack/Anthropic credentials, own sizing knobs) was developed as a parallel system on side branch qm-29-port-factory-loop (~QM-29..QM-84 PRs) rather than on native Loops on main. _Status:_ unknown (factory/ absent from main; branch still receives merges).-- **qm#1272** (2026-09-16): Session transcripts are kept in both session_entries and session_tape, with SESSION_TAPE_MODE shadow/serve choosing between them.-- **qm#1185** (2026-09-15): Each subscriber held its own LISTEN connection and pg-boss kept its own pool; consolidated to one listener per process and the shared query pool. _Status:_ wound back in qm#1185.-- **qm#993** (2026-09-08): Chat search queried both the dedicated search index and legacy entry history for every visible conversation, causing timeouts. _Status:_ wound back in qm#993.-- **qm#488** (2026-08-13): Web-UI /api router had ~50 hand-copied body-parse/relay/path-decode fragments that drifted (some returned 400 instead of 413). _Status:_ wound back in qm#488.+Hiding a symptom while leaving its true cause unfixed. Smells here are special cases (string matching and regex are especially bad), many-branched conditionals acquiring _yet another_ branch. A bug isn't a problem to fix, it is useful evidence that the system we have built is flawed.-### Hand-rolling (2 examples)+- **Slack task completion:** A proposed acknowledgment fix reconstructed completion from descendant runs, mailbox returns, the latest conversation turn, and delivery-key prefixes. Core needed to own request completion through delegation and final delivery, then expose that state to Slack; moving the same guesses into a helper would not fix the missing ownership. [qm#2135](https://github.com/yc-software/qm/pull/2135).+- **Transcript row grouping:** A proposed UI fix joined adjacent assistant rows only when the second contained subagent activity. Multiple commentary messages, intervening tools, and resumed turns defeated the special case. Grouping events by their actual turn/run identity would give streaming and reloaded history the same response structure. [qm#2136](https://github.com/yc-software/qm/pull/2136).+- **Credential capture:** Indiscriminate credential collection swept up oversized browser profiles. The proposed fix recognized browser-profile marker files and skipped those directories, adding another exception to the sweep. The deeper fix was to let the agent identify which credential files to preserve, or explicitly request capture of changes from an authentication turn. [qm#2137](https://github.com/yc-software/qm/pull/2137).+- **[qm#1743](https://github.com/yc-software/qm/pull/1743)** (2026-09-30): Refusal fallback extended by regex-matching Anthropic usage-policy text and 'gateway model is unavailable' to trigger a hard-coded alternate-model ladder (claude-opus-5 / claude-sonnet-5), plus a new admin fallbackRuntime.+- **[qm#1748](https://github.com/yc-software/qm/pull/1748)** (2026-09-30): Every non-Modal sandbox took one exclusive sandbox-resource:<id> advisory lock around each command/file op, so sessions sharing a computer queued behind each other; replaced a backend!=='modal' special case with shared locks and a parksOnTeardown profile property. _Status:_ wound back in [qm#1748](https://github.com/yc-software/qm/pull/1748).+- **[qm#1432](https://github.com/yc-software/qm/pull/1432)** (2026-09-19): Per-turn reconciliation of a shared skills/ index under a sandbox-wide advisory lock (skill projection) stalled turns 5 minutes; replaced with an explicit skill tool and per-turn skill dirs. _Status:_ wound back in [qm#1432](https://github.com/yc-software/qm/pull/1432).+- **[qm#1133](https://github.com/yc-software/qm/pull/1133)** (2026-09-12): A factory-specific retry ladder (FACTORY_READ_RETRIES=6) was added around sandbox readProcess polling after one timeout under load. _Status:_ wound back (factory code absent on current main).+- **[qm#965](https://github.com/yc-software/qm/pull/965)** (2026-09-07): One legacy \u0000 payload bricked sessions; fixes proposed tolerating poisoned rows and sanitizing every Postgres text write. _Status:_ unknown.+- **[qm#394](https://github.com/yc-software/qm/pull/394)** (2026-08-13): Memory tool silently coerces malformed `remember` calls (content/query/bare string) into facts instead of fixing the tool schema.+- **[qm#469](https://github.com/yc-software/qm/pull/469)** (2026-08-13): Sandbox status collapses any unanswering shell into a 'wedged' verdict with baked-in 'restart the computer' advice.-- **qm#1419** (2026-09-22): Sprites backend used raw REST fetches; moved to Sprites SDK 0.2.3 (WebSocket exec, filesystem APIs, checkpoints); sibling PRs #1420-#1422 aligned Modal/E2B/Smolmachines with provider docs. _Status:_ wound back in qm#1419.-- **qm#1407** (2026-09-22): Internal Fly transports piped data through `fly ssh console` (broke on Windows PTY); replaced with Machines exec API stdin. _Status:_ wound back in qm#1407.+### Duplication (7 examples)-### Non-durability (4 examples)+Giving the same behavior or fact multiple independent implementations or sources of truth. These copies drift, disagree, and multiply maintenance work; reuse the existing owner or consolidate the competing paths.-- **qm#1789** (2026-09-30): Docker-published apps have no persistent /data mount, so app data is lost on redeploy.-- **qm#1694** (2026-09-28): Recurring jobs were told to keep checkpoints on sandbox workspace disk, lost when the computer is replaced; now published to durable scoped Files. _Status:_ wound back in qm#1694.-- **qm#452** (2026-08-13): Multiview layout lived only in localStorage and was lost on a new device or profile. _Status:_ wound back in qm#452.-- **qm#64** (2026-08-04): Cron fire log was stored inside the cron's jsonb row, grew without bound, and every fire rewrote the whole log. _Status:_ wound back (src/cron/fire-store.ts; cron-store.ts migrates legacy fireLog out, cron_fires table).+- **[qm#1776](https://github.com/yc-software/qm/pull/1776)** (2026-09-30): Sprites cold-boot '503 Process not ready' exec re-send implemented on main after the same fix ([qm#1489](https://github.com/yc-software/qm/pull/1489)) had already landed only on the long-lived factory side branch.+- **[qm#1520](https://github.com/yc-software/qm/pull/1520)** (2026-09-22): Factory required pasted factory-anthropic/-github/-linear/-slack keychain secrets duplicating core's own model auth and connectors (two sources of truth); QM-73..76 resolve from core config/owner connectors instead. _Status:_ wound back in [qm#1520](https://github.com/yc-software/qm/pull/1520), [qm#1522](https://github.com/yc-software/qm/pull/1522), [qm#1523](https://github.com/yc-software/qm/pull/1523), [qm#1524](https://github.com/yc-software/qm/pull/1524) (on factory branch).+- **[qm#1476](https://github.com/yc-software/qm/pull/1476)** (2026-09-21): Context settings had its own model picker separate from the composer's; switched to reuse the composer model/preset picker. _Status:_ wound back in [qm#1476](https://github.com/yc-software/qm/pull/1476) (both plugins/web-ui/src/model-picker.ts and context-model.ts still exist).+- **[qm#1272](https://github.com/yc-software/qm/pull/1272)** (2026-09-16): Session transcripts are kept in both session_entries and session_tape, with SESSION_TAPE_MODE shadow/serve choosing between them.+- **[qm#1185](https://github.com/yc-software/qm/pull/1185)** (2026-09-15): Each subscriber held its own LISTEN connection and pg-boss kept its own pool; consolidated to one listener per process and the shared query pool. _Status:_ wound back in [qm#1185](https://github.com/yc-software/qm/pull/1185).+- **[qm#993](https://github.com/yc-software/qm/pull/993)** (2026-09-08): Chat search queried both the dedicated search index and legacy entry history for every visible conversation, causing timeouts. _Status:_ wound back in [qm#993](https://github.com/yc-software/qm/pull/993).+- **[qm#488](https://github.com/yc-software/qm/pull/488)** (2026-08-13): Web-UI /api router had ~50 hand-copied body-parse/relay/path-decode fragments that drifted (some returned 400 instead of 413). _Status:_ wound back in [qm#488](https://github.com/yc-software/qm/pull/488).-### Config-matrix expansion (10 examples)+### Hand-rolling (5 examples)-- **qm#1784** (2026-09-30): Security screening had three overlapping env knobs (SECURITY_SCREEN_BACKEND, SECURITY_SCREEN_ALL_POSTURES, SECURITY_SCREEN_PROXY_ROLLOUT) plus per-posture inboundScreening; collapsed into one SECURITY_SCREEN=off|observe|enforce. _Status:_ wound back in qm#1784.-- **qm#1747** (2026-09-30): New SANDBOX_CAPABILITY_TTL_HOURS env var (48h default, or 0/none for non-expiring bearer tokens) right after #1518 hard-set 48h.-- **qm#1619** (2026-09-25): Separate org runtime defaults for conversations, crons/loops and sub-agents, then per-cron overrides (#1593) and a fallback runtime (#1743): four overlapping runtime settings with precedence rules.-- **qm#1201** (2026-09-15): Security screening gained an off/model/proxy backend plus ALL_POSTURES, four PROXY_* vars and a timeout, layered on HARNESS_SECURITY_POSTURE and the org-level Auto flagger settings from qm#878.-- **qm#1208** (2026-09-15): EAGER_PROVISION was an opt-in flag no deploy template set, so every deployment missed a 66s-to-3s median speedup until it defaulted on. _Status:_ partly wound back; flag remains (src/config.ts).-- **qm#1162** (2026-09-14): Gateway deployments had to maintain an environment model allowlist; replaced by discovering models from the gateway's key-scoped list. _Status:_ wound back in qm#1162.-- **qm#1044** (2026-09-10): The unified `sandbox` tool shipped behind SANDBOX_RESOURCES_ENABLED alongside the legacy execute/background tools, so two tool surfaces and both flag states must be supported.-- **qm#922** (2026-09-04): Another sandbox backend (agent37) was added, bringing providers to about ten (agent37, aws, e2b, modal, porter, smolmachines, sprites, superserve, local/docker); qm#954 proposed Kubernetes as well.-- **qm#876** (2026-09-02): Porter added as yet another SANDBOX_BACKEND and DEPLOY_PROVIDER (plus a Helm chart), shortly after Modal and E2B.-- **qm#478** (2026-08-13): Added smolmachines as yet another sandbox backend, then SMOLMACHINES_CPUS/MEMORY_MB/DISK_GB env knobs (qm#507).+Reimplementing a capability that an existing SDK, library, or supported API already provides. Custom protocols and plumbing make us own edge cases that the maintained integration already handles; use that integration when it meets the requirements.-### God files (1 example)+- **[qm#1005](https://github.com/yc-software/qm/pull/1005): Run-queue retries.** Added a `retry_after` column, a matching in-memory deadline map, a custom exponential-backoff-with-jitter function, delayed-claim predicates, and an inline polling loop to keep delayed retries moving. pg-boss already provides durable deferred jobs, retry limits, and backoff; we implemented those mechanics again beside the pg-boss cron queue. _Status:_ custom retry scheduling remains in `src/runs/`.+- **[qm#1255](https://github.com/yc-software/qm/pull/1255): Run-queue worker wakeups.** Sixteen idle workers issued about 64 claim UPDATEs per second. The fix built a `qm_run_available` notification channel, worker generation counters, reconnect rescans, recovery timers, and a shared availability probe. This is another layer of queue infrastructure to maintain when pg-boss provides worker polling and notification-based wakeups. _Status:_ the custom notification and worker machinery remains.+- **[qm#963](https://github.com/yc-software/qm/pull/963): Delivery-queue claims and recovery.** The imported implementation has its own `claim_expires_at`, `FOR UPDATE SKIP LOCKED` claims, expired-row sweep, and Slack poller with per-row expiry tracking and a three-attempt `reclaimOwnership` loop. pg-boss can own job claiming, expiry, and retries instead of making the delivery subsystem implement another queue. Delivery records, Slack idempotency, and session ordering still belong to the application; they are not reasons to rebuild the queue mechanics. _Status:_ the custom delivery queue remains.+- **[qm#1419](https://github.com/yc-software/qm/pull/1419)** (2026-09-22): Sprites backend used raw REST fetches; moved to Sprites SDK 0.2.3 (WebSocket exec, filesystem APIs, checkpoints); sibling PRs #1420-#1422 aligned Modal/E2B/Smolmachines with provider docs. _Status:_ wound back in [qm#1419](https://github.com/yc-software/qm/pull/1419).+- **[qm#1407](https://github.com/yc-software/qm/pull/1407)** (2026-09-22): Internal Fly transports piped data through `fly ssh console` (broke on Windows PTY); replaced with Machines exec API stdin. _Status:_ wound back in [qm#1407](https://github.com/yc-software/qm/pull/1407).-- **qm#1296** (2026-09-16): The AWS deploy backend keeps absorbing capacity proofs, ownership handover and candidate logic.+### Non-durability (5 examples)-### Mismatched UI (3 examples)+This is a distributed system that needs work to endure through deploys and crashes without hiccups. A common agent mistake has been to store data in process memory. Postgres is effectively the core's filesystem -- think of core memory as a cache at best.-- **qm#1545** (2026-09-22): Transcript elements each hardcoded their own font-size, so multiview panes showed 15px/14px headers beside 12px text; unified on one --chat-font-size base. _Status:_ wound back in qm#1545.-- **qm#1053** (2026-09-11): A parallel 'Beautiful UI' design system (10 stacked PRs) and an admin redesign with an Original/New toggle were built next to the existing web UI styles. _Status:_ wound back in qm#1053 (closed with #1054-#1062, #992, #1215).-- **qm#513** (2026-08-13): Multiview panes showed two stacked headers (pane chrome plus the hosted chat's own top bar). _Status:_ wound back in qm#513.+- **Operational error history:** `createErrorLog()` kept the admin Errors history in a 5,000-event process-local ring buffer, even with a production database configured. A deploy erased the history; a request routed to another instance could not see it. The fix added Postgres `error_events` and wired production reads and writes to it. _Status:_ fixed; original code and fix preserved in [qm#2140](https://github.com/yc-software/qm/pull/2140).+- **Scoped configuration:** Soul overrides, command policies, egress rules, and publishing flags lived in process-local `Map`s. Restarting core discarded the overrides and restored defaults. The fix added Postgres backing and hydrated the read cache before serving. _Status:_ fixed; original code and fix preserved in [qm#2140](https://github.com/yc-software/qm/pull/2140).+- **Pending Slack approvals:** Run/Deny cards depended on `pendingSlackAgentRequests`, a `Map` in the Slack process. Deploys erased outstanding requests; clicks routed to another instance could report that the request had expired and leave the originating status stuck. The fix persisted the requests and approval linkage in Postgres with atomic claims. _Status:_ fixed; the Map removal and durable replacement are in [qm#963](https://github.com/yc-software/qm/pull/963).+- **Completed runs with missing replies:** A run was durably marked complete, but enqueueing its delivery depended on an in-process `onTerminal` callback. A crash between completion and enqueue left finished work with no delivery. The fix scans persisted terminal runs and reconstructs missing deliveries. _Status:_ fixed in [qm#2053](https://github.com/yc-software/qm/pull/2053).+- **Webhook work already in flight:** `runOnce` guarded running webhook work with a process-local `inflight` Set, while the receiver's durable idempotency check recognized only committed fires. A retry routed to another instance during a long turn could start the same work again. _Status:_ still present on main; [qm#1943](https://github.com/yc-software/qm/pull/1943) proposes shared Postgres claims and includes a two-instance regression test.++### Config-matrix expansion (11 examples)++Helpful KPIs here are: how many env vars do we have? how large is the database schema? Implicit modes in the form of conditionals, text matching or hard-coded flags also count. The combined footprint of this config matrix is currently enormous and makes our task much more difficult. Driving this down is critical and PRs that reduce the size of these will be rewarded.++- **Adding a provider that subtly deviates from the general sandbox contract (this has been done several times).** For example, ordinary teardown parks E2B, AWS, and local Docker computers, while Modal needs different handling. [qm#1748](https://github.com/yc-software/qm/pull/1748) removes a `backend !== "modal"` locking exception and introduces a `parksOnTeardown` profile property; the distinct lifecycle behaviors remain part of the matrix.+- **[qm#1784](https://github.com/yc-software/qm/pull/1784)** (2026-09-30): Security screening had three overlapping env knobs (SECURITY_SCREEN_BACKEND, SECURITY_SCREEN_ALL_POSTURES, SECURITY_SCREEN_PROXY_ROLLOUT) plus per-posture inboundScreening; collapsed into one SECURITY_SCREEN=off|observe|enforce. _Status:_ wound back in [qm#1784](https://github.com/yc-software/qm/pull/1784).+- **[qm#1747](https://github.com/yc-software/qm/pull/1747)** (2026-09-30): New SANDBOX_CAPABILITY_TTL_HOURS env var (48h default, or 0/none for non-expiring bearer tokens) right after #1518 hard-set 48h.+- **[qm#1619](https://github.com/yc-software/qm/pull/1619)** (2026-09-25): Separate org runtime defaults for conversations, crons/loops and sub-agents, then per-cron overrides (#1593) and a fallback runtime (#1743): four overlapping runtime settings with precedence rules.+- **[qm#1201](https://github.com/yc-software/qm/pull/1201)** (2026-09-15): Security screening gained an off/model/proxy backend plus ALL_POSTURES, four PROXY_* vars and a timeout, layered on HARNESS_SECURITY_POSTURE and the org-level Auto flagger settings from [qm#878](https://github.com/yc-software/qm/pull/878).+- **[qm#1208](https://github.com/yc-software/qm/pull/1208)** (2026-09-15): EAGER_PROVISION was an opt-in flag no deploy template set, so every deployment missed a 66s-to-3s median speedup until it defaulted on. _Status:_ partly wound back; flag remains (src/config.ts).+- **[qm#1162](https://github.com/yc-software/qm/pull/1162)** (2026-09-14): Gateway deployments had to maintain an environment model allowlist; replaced by discovering models from the gateway's key-scoped list. _Status:_ wound back in [qm#1162](https://github.com/yc-software/qm/pull/1162).+- **[qm#1044](https://github.com/yc-software/qm/pull/1044)** (2026-09-10): The unified `sandbox` tool shipped behind SANDBOX_RESOURCES_ENABLED alongside the legacy execute/background tools, so two tool surfaces and both flag states must be supported.+- **[qm#922](https://github.com/yc-software/qm/pull/922)** (2026-09-04): Another sandbox backend (agent37) was added, bringing providers to about ten (agent37, aws, e2b, modal, porter, smolmachines, sprites, superserve, local/docker); [qm#954](https://github.com/yc-software/qm/pull/954) proposed Kubernetes as well.+- **[qm#876](https://github.com/yc-software/qm/pull/876)** (2026-09-02): Porter added as yet another SANDBOX_BACKEND and DEPLOY_PROVIDER (plus a Helm chart), shortly after Modal and E2B.+- **[qm#478](https://github.com/yc-software/qm/pull/478)** (2026-08-13): Added smolmachines as yet another sandbox backend, then SMOLMACHINES_CPUS/MEMORY_MB/DISK_GB env knobs ([qm#507](https://github.com/yc-software/qm/pull/507)).++### God files (4 examples)++Letting one file or module absorb unrelated responsibilities until changes require understanding the whole system. Keep responsibilities with clear owners and boundaries; splitting a file by line count alone does not untangle those responsibilities.++- **[qm#1296](https://github.com/yc-software/qm/pull/1296)** (2026-09-16): The AWS deploy backend keeps absorbing capacity proofs, ownership handover and candidate logic.+- **[qm#1636](https://github.com/yc-software/qm/pull/1636): Core orchestrator.** `src/core/orchestrator.ts` absorbed memory-audience changes, transcript cutoffs, provenance dependency capture, harness resets, and approval invalidation inside the same turn-execution closure. The diff shows memory-disclosure policy reaching into retry replay and pending approvals; those responsibilities remain embedded in the orchestrator despite separate memory helpers.+- **[qm#175](https://github.com/yc-software/qm/pull/175): Chat surface.** `plugins/web-ui/src/chat.ts` combines transcript rendering and pagination, pane lifecycle and URL state, command-approval submission, active-run recovery, session forking, and connector-auth widgets inside `createChatSurface`. The multiview change rewrites that shared closure, so changing how a pane mounts also means navigating approval and execution-recovery state. _Status:_ these responsibilities still share `chat.ts`.+- **[qm#488](https://github.com/yc-software/qm/pull/488): Web server entrypoint.** `plugins/web-ui/server/index.ts` combines session cookies and sign-in, OAuth callback forwarding, core API transport, request-body handling, and route handlers for sessions, files, projects, and crons. The PR extracts a shared router and relay helpers, but keeps the product domains and authentication flows in the same server module. _Status:_ partial cleanup; the shared entrypoint still owns those domains.++### Mismatched UI (4 examples)++Building interface pieces that disagree with the surrounding product in appearance, structure, or interaction. Reuse the existing components and design rules, and check the result in its containing surface so duplicated chrome and inconsistent typography do not slip through.++- **Admin UI versus web UI:** The same product has separate admin and web interfaces with different layouts, styling, and controls. Moving between them should not feel like switching products. [qm#1441](https://github.com/yc-software/qm/pull/1441) migrated admin views to Lit while explicitly retaining the existing admin CSS and layout; sharing a rendering library did not unify the UI.+- **Artifact pages under Browse:** Skills, crons, webhooks, apps, and files each developed their own search, filters, and toggles when they could use more or less the same controls. Skills has its own scope/source/status filters; crons has ownership tabs and a disabled toggle; apps has another tab implementation; files renders its own search and ownership/type filters. The implementations are visible together in [qm#963](https://github.com/yc-software/qm/pull/963). Artifact-specific options can vary, but the common search, filtering, and toggle interactions should be shared across Browse.+- **[qm#1545](https://github.com/yc-software/qm/pull/1545)** (2026-09-22): Transcript elements each hardcoded their own font-size, so multiview panes showed 15px/14px headers beside 12px text; unified on one --chat-font-size base. _Status:_ wound back in [qm#1545](https://github.com/yc-software/qm/pull/1545).+- **[qm#513](https://github.com/yc-software/qm/pull/513)** (2026-08-13): Multiview panes showed two stacked headers (pane chrome plus the hosted chat's own top bar). _Status:_ wound back in [qm#513](https://github.com/yc-software/qm/pull/513).### Over-indexing on YC (3 examples)-- **qm#1315** (2026-09-16): The generic web UI onboarding says 'the agent harness we use to run YC' and 'your YC partner in a box', and the welcome ideas cite 'YC Deal' and 'the YC investor database'.-- **qm#1008** (2026-09-09): A 29-file 'software factory' loop (Linear auto-triage, forge ship contract) built for YC's own workflow was ported into public src/loops/factory before it had ever run end to end. _Status:_ wound back in qm#1026.-- **qm#530** (2026-08-15): Assistant and org names were fixed across prompts, manifests, auth and UI; made deployment-configurable with neutral defaults. _Status:_ wound back in qm#530.+QM is for organizations in general. YC's usage guides development but architecture should not be _warped_ to fit our purposes and customizations. Leaking YC _data_ is a separate concern.++- **Dedicated people-directory configuration:** Role lookup from a people website became its own People directory admin card, org-wide URL setting, and save path in the generic product. This could have been ordinary organization knowledge or a deployment tool. _Status:_ [qm#1441](https://github.com/yc-software/qm/pull/1441) removes the dedicated admin card.+- **[qm#1008](https://github.com/yc-software/qm/pull/1008)** (2026-09-09): A 29-file 'software factory' loop (Linear auto-triage, forge ship contract) built for YC's own workflow was ported into public src/loops/factory before it had ever run end to end. _Status:_ wound back in [qm#1026](https://github.com/yc-software/qm/pull/1026).+- **[qm#530](https://github.com/yc-software/qm/pull/530)** (2026-08-15): Assistant and org names were fixed across prompts, manifests, auth and UI; made deployment-configurable with neutral defaults. _Status:_ wound back in [qm#530](https://github.com/yc-software/qm/pull/530).### Regex (3 examples)-Regex standing in for a parser, a typed error, a stored field or a model call. Main has 1,443 production regex sites in 380 files; cleanup is the regex-removal backlog.+Some people, when confronted with a _**problem**_, think “I know, I'll use _**regular expressions**_.” Now they have _**two problems**_.++Main has 1,443 production regex sites in 380 files; cleanup is the regex-removal backlog.++- **[qm#1354](https://github.com/yc-software/qm/pull/1354)** (2026-09-17): The web UI re-parses shell commands with a hand-written tokenizing regex (and sniffs `sed -n Np` and Markdown headings by pattern) to decide how to present tool activity, instead of using the structured call data.+- **[qm#1210](https://github.com/yc-software/qm/pull/1210)** (2026-09-15): Composio consent links are found by regex-scanning model text for URLs and Markdown links, then stripped with dynamically built `RegExp`s, rather than arriving as a typed connector-link field.+- **[qm#169](https://github.com/yc-software/qm/pull/169)** (2026-08-03): The agent self-API allowlist is a chain of path regexes (`/^\/v1\/projects\/[^/]+$/`, …) instead of matching on the router's declared routes.++### YC info leaking into public qm (2 examples)++Publishing organization-specific information in the public repository through code, docs, fixtures, screenshots, or change descriptions. Inspect outgoing content for private identities, operational details, and internal references; keep private deployment material in private storage.++- **[qm#1315](https://github.com/yc-software/qm/pull/1315)** (2026-09-16): The generic web UI onboarding says 'the agent harness we use to run YC' and 'your YC partner in a box', and the welcome ideas cite 'YC Deal' and 'the YC investor database'.+- **[qm#1504](https://github.com/yc-software/qm/pull/1504)** (2026-09-22): Public docs/test fixtures had org-specific rollout guidance and identity examples plus 92 tracked screenshots (8.1 MB); scrubbed and AGENTS.md now bans committed screenshots. _Status:_ wound back in [qm#1504](https://github.com/yc-software/qm/pull/1504) (partially; YC welcome copy remains).++### Discarded error evidence (3 examples)++Replacing or swallowing a failure so the evidence needed to diagnose it disappears.++- **Sandbox startup and cleanup** (2026-10-02): A provider authentication failure reached the tool transcript as a bare "Command execution failed." The cleanup wrappers in `src/sandbox/sandbox.ts` dropped the original causes, destruction retries in `src/core/orchestrator/sandboxes.ts` swallowed every exception, and `src/harness/agent-tools.ts` recorded only the generic status. _Status:_ wound back in [qm#2018](https://github.com/yc-software/qm/pull/2018).+- **Rejected session titles:** `sanitizeTitle` returned `undefined` for rejected model output. The fallback title made the request look successful, while neither the rejected text nor the rule that rejected it reached the error log. _Status:_ [qm#1303](https://github.com/yc-software/qm/pull/1303) records the rejection rule and a bounded sample in the durable error log.+- **Failed transaction rollback:** `withPgTransaction` and copied transaction handlers awaited `ROLLBACK` before rethrowing the original error. If rollback also failed, its exception replaced the actual transaction failure. _Status:_ still present on main; [qm#1834](https://github.com/yc-software/qm/pull/1834) proposes preserving the original error and discarding the broken connection.++### Over-testing++Description and examples pending human input.++### Performance (4 examples)-- **qm#1354** (2026-09-17): The web UI re-parses shell commands with a hand-written tokenizing regex (and sniffs `sed -n Np` and Markdown headings by pattern) to decide how to present tool activity, instead of using the structured call data.-- **qm#1210** (2026-09-15): Composio consent links are found by regex-scanning model text for URLs and Markdown links, then stripped with dynamically built `RegExp`s, rather than arriving as a typed connector-link field.-- **qm#169** (2026-08-03): The agent self-API allowlist is a chain of path regexes (`/^\/v1\/projects\/[^/]+$/`, …) instead of matching on the router's declared routes.+Doing unnecessary work, repeating expensive work, or making independent work wait. Watch for hot polling loops, unbounded database reads, unstable prompt prefixes that defeat caching, and locks that serialize unrelated operations.-### YC info leaking into public qm (1 example)+- **Polling that writes even when nothing is due:** The cron scheduler sent a synthetic tick job every second and repeatedly submitted cron jobs. Idle scheduling still generated database writes and queue churn. _Status:_ [qm#2007](https://github.com/yc-software/qm/pull/2007) removes the per-second tick job; mutation and completion hooks keep jobs current, with periodic repair on the scheduler lease holder.+- **Unbounded admin list queries:** The session list combined per-row JSON subqueries with full-history sorting and OFFSET pagination. A routine admin page could saturate Postgres and starve the shared connection pool used by actual turns. _Status:_ [qm#2076](https://github.com/yc-software/qm/pull/2076) makes the list query bounded and removes repeated work from each row.+- **Serializing independent sandbox operations:** A single exclusive machine lock covered commands, file operations, and status checks. One long-running command blocked unrelated sessions using the same computer. _Status:_ [qm#1748](https://github.com/yc-software/qm/pull/1748) lets ordinary operations share the lock while keeping destructive lifecycle operations exclusive.+- **Defeating prompt caching with incidental changes:** Changing countdowns, fresh sandbox/job snapshots, and inventories rendered in discovery order kept changing otherwise reusable prompt prefixes. _Status:_ [qm#1618](https://github.com/yc-software/qm/pull/1618) stabilizes snapshots and timestamps; [qm#1690](https://github.com/yc-software/qm/pull/1690) fixes the remaining inventory-order churn.-- **qm#1504** (2026-09-22): Public docs/test fixtures had org-specific rollout guidance and identity examples plus 92 tracked screenshots (8.1 MB); scrubbed and AGENTS.md now bans committed screenshots. _Status:_ wound back in qm#1504 (partially; YC welcome copy remains).+### Honorable mentions-### Discarded error evidence (1 example)+These can be addressed by a single combined reviewer.-- **Sandbox startup and cleanup** (2026-10-02): A provider authentication failure reached the tool transcript as a bare "Command execution failed." The cleanup wrappers in `src/sandbox/sandbox.ts` dropped the original causes, destruction retries in `src/core/orchestrator/sandboxes.ts` swallowed every exception, and `src/harness/agent-tools.ts` recorded only the generic status. Keep the primary failure and every cleanup failure, redacted, in access-controlled diagnostics; a short user-facing message never replaces the evidence. _Status:_ unresolved on main 5dbebac6.+- **Screenshots:** The repo is not to be cluttered with screenshots or images of any kind that aren't actually used in UI.+- **Code comments:** Not allowed -- these historically have reinforced drift and reward-hacky agent decisions, providing air cover for future agents to do the same.