Repository navigation
fixing github workflow for unit testing - #2
Merged
Merged
Conversation
samxu01
force-pushed
the
fix-github-workflow
branch
from
April 26, 2025 22:34
97b9e42 to
086999e
Compare
samxu01
force-pushed
the
fix-github-workflow
branch
from
April 28, 2025 08:15
4ae736a to
711a9ed
Compare
samxu01
force-pushed
the
fix-github-workflow
branch
from
May 24, 2025 05:56
8b649fa to
171844d
Compare
samxu01
added a commit
that referenced
this pull request
Feb 2, 2026
fixing github workflow for unit testing
samxu01
pushed a commit
that referenced
this pull request
Apr 3, 2026
fixing github workflow for unit testing
lilyshen0722
added a commit
that referenced
this pull request
Apr 14, 2026
Follow-up to ADR-003 Phase 1. Production smoke test showed `byteSize: 0` in responses because the route was trusting client-supplied metadata. This patch stamps `byteSize` (from utf-8 content length) and `updatedAt` (now) server-side on every section write. Client-supplied values for these fields are discarded. Also enforces ADR-003 invariant #2 ("Private by default") at write time by defaulting missing `visibility` to `'private'`. Changes: - backend/services/agentMemoryService.ts — adds `stampSectionsForWrite`; single-object sections go through `makeSection` for consistency. Whole-array replace semantics for `daily` and `relationships` are documented inline (Phase 2's /memory/sync `mode: 'patch'` will add element-level merge keyed by `date` / `otherInstanceId`). - backend/routes/agentsRuntime.ts PUT /memory — calls the stamper before the per-key dotted-$set merge; expanded docstring spells out merge semantics for each section category, the v1 content mirror behavior (incl. that `long_term: { content: '' }` is an intentional clear), and that `byteSize` + `updatedAt` are always server-stamped. Tests (13 new; 63/63 agent-memory pass): - Unit: stampSectionsForWrite covers single-object stamping, multi-byte utf-8 byteSize, client-value override, visibility default + preserve, no-sibling-creation, daily shape (no byteSize/updatedAt per ADR), relationships shape (updatedAt stamped, no byteSize), idempotence under same `now` across object + array sections. - Integration: byteSize returned end-to-end; multi-section writes each get correct per-section byteSize; array sections are whole-array replace (lock for Phase 1 intentional semantics); `long_term` clear via empty content blanks the v1 mirror. Reviewer finding (code-reviewer subagent) that `updatedAt` on every relationship entry bumps to `now` on array replace is intentional and consistent with whole-array semantics; proper per-entry freshness lands with Phase 2's /memory/sync. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2 of 4 tasks
lilyshen0722
added a commit
that referenced
this pull request
Apr 14, 2026
…189) Follow-up to ADR-003 Phase 1. Production smoke test showed `byteSize: 0` in responses because the route was trusting client-supplied metadata. This patch stamps `byteSize` (from utf-8 content length) and `updatedAt` (now) server-side on every section write. Client-supplied values for these fields are discarded. Also enforces ADR-003 invariant #2 ("Private by default") at write time by defaulting missing `visibility` to `'private'`. Changes: - backend/services/agentMemoryService.ts — adds `stampSectionsForWrite`; single-object sections go through `makeSection` for consistency. Whole-array replace semantics for `daily` and `relationships` are documented inline (Phase 2's /memory/sync `mode: 'patch'` will add element-level merge keyed by `date` / `otherInstanceId`). - backend/routes/agentsRuntime.ts PUT /memory — calls the stamper before the per-key dotted-$set merge; expanded docstring spells out merge semantics for each section category, the v1 content mirror behavior (incl. that `long_term: { content: '' }` is an intentional clear), and that `byteSize` + `updatedAt` are always server-stamped. Tests (13 new; 63/63 agent-memory pass): - Unit: stampSectionsForWrite covers single-object stamping, multi-byte utf-8 byteSize, client-value override, visibility default + preserve, no-sibling-creation, daily shape (no byteSize/updatedAt per ADR), relationships shape (updatedAt stamped, no byteSize), idempotence under same `now` across object + array sections. - Integration: byteSize returned end-to-end; multi-section writes each get correct per-section byteSize; array sections are whole-array replace (lock for Phase 1 intentional semantics); `long_term` clear via empty content blanks the v1 mirror. Reviewer finding (code-reviewer subagent) that `updatedAt` on every relationship entry bumps to `now` on array replace is intentional and consistent with whole-array semantics; proper per-entry freshness lands with Phase 2's /memory/sync. Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2 of 4 tasks
lilyshen0722
added a commit
that referenced
this pull request
Apr 15, 2026
…hook SDK); amend ADR-003 Three new ADRs codifying the driver surface, plus a revision-history amendment to ADR-003 reflecting what actually shipped in Phases 1, 1.1, 2a, 2b and removing the OpenClaw coupling from its migration path. ## ADR-004 — Commonly Agent Protocol (CAP) Freezes the driver-facing HTTP surface at four concepts across six routes: poll (`GET /events`), ack (`POST /events/:id/ack`), post (`POST /pods/:id/messages`), memory (GET/PUT /memory + POST /memory/sync). Bearer-token auth, pull-only, at-least-once delivery, runtime-opaque kernel. Non-goals explicitly close the door on push model, gRPC, streaming, published SDK packages, per-handler rate limits. ## ADR-005 — Local CLI Wrapper Driver `commonly agent attach <cli>` + `run` pair. Adapter pattern: one file per wrapped CLI (`claude`, `codex`, `cursor`, `gemini` in v1; `openclaw` deliberately not — it stays a native driver among many). Adapters are pure argv-spawn shims (~30-60 LOC each). Session continuity via `~/.commonly/sessions.json`; memory bridge transparently reads `sections.long_term` before spawn and syncs back after. Serialized per agent; pull-only; CLI auth lives in the wrapped CLI's own home directory. ## ADR-006 — Webhook SDK + Self-Serve Install Ships a single-file Python SDK + Node SDK (~80 LOC each, no deps beyond stdlib + Node built-in fetch), a `commonly agent init --language python|node` scaffolder, and formalizes the existing `runtimeType: 'webhook'` as self-serve for authed users under the invite-only posture. `createdBy` stamps every install for audit; pod-scope only; instance and DM scope stay admin-gated. SDK is live-copy (not published) in v1 — publishing packages waits for proof via external driver authors. ## ADR-003 amendment - Revision-history block added naming Phases 1/1.1/2a/2b PRs. - 4 new load-bearing invariants capturing what shipped: cross-writer dedup invalidation; server-stamped byteSize/updatedAt/ schemaVersion; canonical-stringify for dedup keys; mode-dependent array-section merge semantics. - Runtime driver table reordered: OpenClaw moved from first row to one-of-many; native, local-CLI-wrapper (ADR-005), and webhook-SDK (ADR-006) named as peer drivers. - Phase 3 reframed driver-agnostic. Concrete Phase-3 deliverable added: two-driver cross-check (one CLI-wrapper agent + one webhook-SDK agent in one pod, each reading/writing its own memory) as end-to-end proof that memory is kernel-shaped, not OpenClaw-shaped. - Tool-surface table marks which tools are shipped (Phase 2b) vs future (Phase 4). ## Reviewer pass (subagent, pre-commit) Approve with suggestions. One Critical fixed (ADR-004 "four verbs" vs "five routes" mismatch — reframed as 4 concepts / 6 routes). All 6 Important + relevant Nits applied: - ADR-006 correctly reflects that `runtimeType: 'webhook'` already exists (formalize + drop admin-gate, not a new type introduction). - ADR-006 SDK `poll_events` arg clarified — CAP v1 has no long-poll; callers sleep between calls; revisit when ADR-004 open-question #2 resolves. - ADR-006 `--secret` / `webhookSecret` marked reserved for future push driver ADR, not dead code. - ADR-005 Phase 1 split into 1a (skeleton + run-loop) and 1b (claude adapter + memory bridge) so the memory bridge gets an isolated review pass as the first cross-driver memory consumer. - ADR-005 §Memory bridge now explicitly calls out that the wrapper supplies `content` + `visibility` only; byteSize/updatedAt/ schemaVersion are server-stamped (per ADR-003 invariant #9). - ADR-004 rate-limiting non-goal rewritten without PR reference; policy stated directly. CLAUDE.md Key Documentation Files updated with ADR-004/005/006 entries. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This was referenced Apr 18, 2026
MubaiHua
pushed a commit
that referenced
this pull request
Apr 20, 2026
fixing github workflow for unit testing
2 tasks
This was referenced May 3, 2026
samxu01
added a commit
that referenced
this pull request
May 4, 2026
Fills the human-facing UX for the agent-dm pod type shipped in PR #275. Gap #1 — Read-only banner + composer disable Humans with §3.7 read-access (sharing a pod with one of the bots) can VIEW but not POST in agent-dm rooms. Without this, the composer accepts input and silently 401s on send. Now: composer is replaced with a soft-toned banner ("Read-only — you're observing this conversation"). Bot-bot variant phrases it as "X and Y are talking directly. To engage them, @-mention either in a shared team pod." Gap #2 — System event card for "🤝 X and Y started a DM" The §3.8 announcement post commonly-bot drops in a team pod when two agents start a DM rendered as raw markdown — including a `[view](/v2/pods /<id>)` link that opened in a new tab (markdown anchors default to `target="_blank"`, which is wrong for in-app navigation). Detect by content shape (no metadata column on PG messages yet), render as a chrome-light card with router-aware `navigate(...)` button. Gap #3 — "Between agents · N" sub-section in Private filter Bot↔bot rooms (where the human is read-only) were mixed in with regular DMs in the Private filter, hiding the relationship. Override `groupPods` when filter==='private': split into Pinned, Direct messages, and Between agents · N — the count doubles as a glanceable "how much agent-to-agent activity is happening" indicator. Gap #4 — Empty state copy for fresh agent-dm rooms Generic "Talk to your team" copy isn't helpful in a 1:1 DM context. Branch on bot-bot vs human-bot to render appropriate empty-state text ("X and Y haven't talked yet — they'll DM each other when one of them needs the other's help" vs "No messages yet — this is a private 1:1 conversation"). Design review per CLAUDE.md: no gradients, borders not shadows, one accent. Token discipline (use --v2-bg-subtle not undefined --v2-surface -soft). v2-root button.X specificity prefix on the syscard CTA. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This was referenced Jul 3, 2026
samxu01
pushed a commit
that referenced
this pull request
Aug 4, 2026
Both from their review on #802. Their canViewPod finding (#2) was already fixed independently at 3336de3 — same defect, both seats, converged. 1. §Staleness named *the judge* as sole re-evaluator and keyed the outcome on *still-divergent*. Two of three feeds never produce divergence: an authority escalation means the agent finished correctly and hit a wall; a static escalation means an action is irreversible. Neither departs from intent, so the judge returns not-divergent every time and the rule routed that to `moot` — terminal, no successor, no actions. The primary trigger and the unmutable safety class retired their own escalations while the wall stood and the destructive action stayed parked. Fixed two ways. Re-evaluation is now per-feed, each feed re-running the check it already defines (authority re-queries the permission set or re-issues the call, per the Layer 1 split; judge re-runs the comparison; static re-checks pending + taxonomy). And the branch is inverted to fail closed, because naming the right re-evaluator is not sufficient: `if (!persists) moot` moots on a re-evaluator that errors or cannot answer. `moot` is the only value terminal with no successor and no human, so it must never be a default branch. Anything short of a positive "the concern is gone" goes `superseded`. 2. §Decision-authorization keyed idempotent-by-refusal to `resolved` alone, so a human could decide a `superseded` or `moot` card. Now decidable = pending | expired, refusing = resolved | superseded | moot. `expired` MUST stay decidable — it means "still parked, please look," so the naive repair (refuse on anything terminal) would turn the fails-closed promise into a fails-silent one. Third instance of the J1/J2 join: two lifecycle values were added and three separate rules kept quantifying over the case in hand. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
lilyshen0722
added a commit
that referenced
this pull request
Aug 4, 2026
* docs: ADR-016 — agent-ensemble has a kind, and it is not a label @sprint-review flagged this on #792 before it merged; the review landed after the merge, so it is fixed here on main instead. Verified each claim against origin/main @ 83bf68f rather than taking the report: - kind = 'room' omitted agent-ensemble, so the derivation was not total over the type enum — one type had no kind at all. It belongs in 'room': it is absent from NON_LISTABLE_POD_TYPES, so it is listable exactly like a team pod. - The next bullet then swept it into "presentation labels — no backend branch keys on them", which is false and load-bearing in the document Sam ratifies from. Seven endpoints in routes/agentEnsemble.ts refuse on pod.type !== 'agent-ensemble' (lines 37/52/67/82/97/114/141), and Pod.ts carries an agentEnsemble subdocument only this type populates. It is the most branch-keyed room type there is. Now an explicit exception, with the reason the two axes do not imply each other: kind says listable, not unbranched. - Named the Pod.ts type enum canonical (8 values). The two narrower VALID_POD_TYPES lists are creation allowlists, not rival definitions — they omit DM kinds because those are created by paths that establish the second member, and a generic create would birth a 1-member pod against the §3.10 guard. podController permitting agent-room while agentsRuntime does not has no stated reason; flagged, not resolved. Also un-staled the enforcement-gap section: the residual divergence it listed as open was closed by #797 (b2fc6cd). DIRECTLY_JOINABLE_QUERY now owns the joinPolicy clause and both surfaces spread it. Re-stamped the section's verification sha, and kept the urgency note with its lesson made explicit — "0 invite-only pods in production" argues about urgency and never about whether the guard is real. AX entry 6: @sprint-review independently reached the identical wrong conclusion from the same evidence, hours before the correction and with no contact. Two readers, one false model — that is what makes it an API finding rather than one agent's mistake. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> * docs(ax): entry 8 — silent truncation, and entry 6 is three agents not two @ux-lead reported both. Entry 6 gains its third independent instance and the detail that changes its shape: after the 400s they worked around them by writing cycle content into `daily`, which returned success — two days of takeaways in the wrong section with a green result confirming the wrong model. A wrong call that errors eventually teaches; a wrong call that succeeds is a trap, because success removes the pressure to look further. Entry 8 is new and generalizes entry 3 from one endpoint to a kernel-wide pattern: write paths mutate payloads and report unqualified success. A 507-char cycle append stored 500 and returned {ok: true} with no flag. Traced the cap to the storage layer — appendCycle discarded the truncation result one line after computing it, so no surface above it could report the loss. Both caps (500 chars, 40 entries) were undocumented. Both closed by #804; entry 8 marks the pattern claim untested outside this one endpoint rather than implying an audit that hasn't happened. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> * docs: ADR-016 — the creation gap is a writer-side violation, not an asymmetry Per @sprint-review's review of #802. I filed podController permitting agent-room as an unexplained asymmetry; they demonstrated it is the exact failure the same paragraph describes, live: createPod accepts type: 'agent-room' and writes members: [req.userId], producing a one-member DM-kind pod with a 200. Verified independently at 83bf68f, with one refinement — DM_POD_TYPES_GUARD has six consult sites, not four (registry/admin.ts:347 and agentIdentityService.ts:512 were missing from the review's table). The claim is unaffected and stronger for it: none of the six is creation. Pod.ts's pre-save hook enforces no DM cardinality, so there is no model-level backstop. Promoted to a row in the Enforcement-gaps table, which until now listed only readers — a per-surface enumeration that omits writers cannot see a writer-side violation, which is the table's own thesis turned on its author. Also recorded their second finding, because it changes what the fix is: VALID_POD_TYPES is used at :383 (create) and :279 (getPodsByType, a read filter), so dropping agent-room from it would silently 400 a read endpoint. The fix must split the two, or better, consult DM_POD_TYPES_GUARD — the thing that is the DM predicate — rather than a hand-maintained list that happens to agree with it. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> * docs: ADR-016 §Writers said 7, ADR-017's n=1 is now n=2 Two corrections to sentences from my seat, both found by review. ADR-016 §Writers (found by @sprint-review, narrowed by @ux-lead): the creation-presets row said "the 7 reachable states". 7 was the pre-correction total — 6 rooms + 1 DM, from the draft that called agent-admin a plain room — and the enumeration was fixed to 8 while this sentence was not. But the total was never the right quantity: presets pick a join policy on a pod that is born private, so the creation surface expresses exactly 2. That also contradicted the paragraph three lines below it, which already said the modal has one honest choice. Records the two consequences @ux-lead drew — the modal must never become a tier picker, and #770 deliverable 2 shrinks to explaining dormancy — and names the failure shape: a correction that reached the enumeration and not the sentence reading from it, which is this ADR's own fixed-here-not-there thesis applied to its prose. ADR-017 (found by @sprint-review): "n=1 incident is not a mandate for a dependency graph" is n=2. Verified at source — #797 merged 07:33:37Z closing the divergence ADR-016 documents as open, #792 merged both ADRs 07:33:49Z. Twelve seconds, two PRs reviewed in parallel by seats that couldn't see each other. The second instance is this file's own merge, and it is the second costume in its own list. Stated which way it cuts, because it isn't obvious: n=2 raises confidence in the trigger and LOWERS the case for a graph, since one line per merge catches both. Also records that the stale row is accidentally right about production (#797 merged, undeployed), so the fact worth routing is merged AND deployed — they are different events and a spot-check against the live instance today confirms a section main already contradicts. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> * docs(ax): drop this branch's entry 8 — #803 carries the consolidated one This branch and #803 each appended a `## 8.` for the same finding, with different bylines (ux-lead here, sprint-review there). merge-tree off the common base 83bf68f conflicts in exactly that file, and resolved naively main would get two entry 8s for one finding credited to two seats — an attribution artifact inside the document about attribution artifacts. #803's version supersedes this one on content, not just on ordering: it covers the second mutation dimension (CYCLE_ENTRY_CAP eviction) and the always-emit correction, both of which postdate this draft. This draft's Lesson also states the rule #804 has since reversed — "the flag must be absent when nothing happened" — so merging it would land the superseded design next to the entry arguing against it. Its one line that #803 lacked — any constant bounding an agent-facing payload is part of the interface — moves to #803 in the same pass rather than being dropped with it. The entry-6 additions on this branch (three independent readers, the adjacent-plausible-success decoy) do not collide and stay. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> * docs(ax): drop the placeholder note too — it reintroduced the conflict The note explaining the consolidation sat at the file tail, which is exactly where #803 appends. Removing entry 8 but leaving a marker in its place left merge-tree conflicting for the same structural reason as the duplicate did. The explanation belongs in b25da90's commit message and the PR, not in main. This branch now touches only entry 6, which does not collide. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> * docs: ADR-016 §Enforcement-gaps — name the deploy window, not just the merge @sprint-review's sharpest point about this section wasn't the staleness, it was the direction of the error: the pre-#797 text is wrong about main and accidentally right about production, because #797 is merged and undeployed. My earlier correction (46f91f4) fixed the first half and left the second, so a reader checking this section against the live API today still gets confirmation of the text I'd just replaced. That asymmetry is worth stating in the ADR rather than only in the reviewer checklist: a stale claim a spot-check contradicts gets corrected, and one a spot-check confirms hardens. Verified with two instruments before writing it — Deploy Dev run history and the live backend image tag both say eb05c68. Ties to ADR-017's bidirectional-channel section, which now argues the fact worth routing is merged AND deployed, two events. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> * docs: ADR-016 — give the deploy-window paragraph a retiring condition @ux-lead's point: fa39558 is anchored to a transient fact ("still eb05c68", "for as long as the dispatch is outstanding") inside a document with a multi-quarter horizon, and nothing marks when it stops being true. Adds the predicate — deployed backend tag at or past b2fc6cd — plus the kubectl one -liner that answers it. Also corrects the scale, which both of us had wrong in different directions. Definitive list of merges after the 2026-08-02T02:30:08Z deploy: #794 e13bf0f 08-02T03:49:28Z #796 2fab7df 08-04T07:33:30Z #797 b2fc6cd 08-04T07:33:37Z #798 029b8a7 08-04T07:33:43Z #792 83bf68f 08-04T07:33:49Z Five, not four. My earlier set omitted #794; @ux-lead's omitted #796 and assigned 2fab7df to #794 (it is #796; #794 is e13bf0f and merged two days earlier). The window opened ~80 minutes after the last deploy, not on 08-04, so it is ~55 hours rather than one batch waiting on one dispatch. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> * docs: ADR-017 — adopt @sprint-review's four freeze-diff findings All four land on sections this seat authors, so executing rather than relaying. From msg 52323 (D1 concern, J1, J2, J3). D1: envelope field `class` -> `escalationClass`. Two same-named sibling fields kept apart by a comment reading "never merged" is precisely the shape we spent today removing everywhere else — the separation belongs in the type, not in a sentence a simplifier can read past. J1 + J2: `expired` was carrying two opposite instructions. TTL timeout means still parked, look at it; the staleness path means a successor exists or the concern is gone, do nothing — and the stale card inherited the TTL copy, so it told a human an item awaited them for work already re-escalated at full attention. Splits into `superseded` and `moot`. That also closes J2: the old text said the moot case "resolves as re-evaluated-clean", colliding with `resolved`'s contract (decision = {deciderId, actionId, decidedAt, messageRef}, every decision an attributed pod message, no agent may decide in v1). A machine re-evaluation satisfies none of those. `resolved` is now the only lifecycle value carrying a decision and the only one a human writes. Card faces go from four to six; "expiry" in the staleness rule renamed to "retirement" so `expired` means TTL and only TTL. J3: static-feed interrupts exempt from the budget. "Its interrupt is suppressed" could only ever fire on a budget the judge feed spent, since the static feed is rare by construction and cannot exhaust its own ceiling — so the unmutable class went un-interrupted because of noise from the mutable ones. Rarity is both why the feed is kept at 0-of-15 and why exempting it is affordable. D4: the re-bind paragraph stated an absolute prescription resting on a contingent premise. Splits the permanent reason (issuers can legitimately be either) from the expiring observation (no field exists yet), so `Task.createdBy` landing cannot read as authorization to build the gate. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> * docs: ADR-017 §Layer 3 — specified is not drawn, and say which @ux-lead's finding against their own section: ":144 four faces designed from day one" vs ":149 the resolved/expired frames are committed in the re-cut", five lines apart. The attached bundle settles it — escalation-4 is the digest view, escalation-5 is the flagged face, escalation-6 is the channel decision. One card face exists as a drawing; the rest are prose. Their line numbers predate da9475a, which made the gap wider rather than narrower: I raised the count to six an hour ago and added superseded/moot, neither of which has ever had a frame. The finding survived my edit with more force than when it was written. Fixed as they proposed — "specified here" rather than "designed", with the artifact status inline instead of parked in a parenthetical below the strong claim. The guarantee that matters is unchanged: nothing gets invented at implementation time. Also names the deferral exactly: five frames in the re-cut, and the re-cut is the only thing the section defers — the specs are merged and implementable now. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> * docs: the predicate fired — retire the deploy-window paragraph, n=3 for ADR-017 651bdb9 gave the ADR-016 deploy-window paragraph a retiring condition (deployed backend tag at or past b2fc6cd). It fired ~80 minutes later, while this PR was still open, so the paragraph would otherwise have merged as a present-tense claim about a system it no longer described — the exact failure the paragraph above it describes. Breaking the freeze I announced in 52341 for the one reason I named: it is factually wrong. Deploy Dev dispatched 09:52:40Z from main @ 83bf68f; backend pod restarted 09:59:09Z on that tag. Verified by a third instrument that is functional rather than declarative — #798's message pager. The identical probe that returned the newest thirteen at 09:49Z, commonly_get_messages({ before: '2026-08-04T08:50:14.114Z' }) returned messages strictly older than the cursor fifteen minutes later, with the hasMore field the tool description names and which had been absent from every prior response. An image tag says what shipped; a behaviour change says what arrived. ADR-017 §invalidation: n=2 becomes n=3, and the third is the strongest, because the fact was the one every seat was explicitly waiting for. 09:53:22Z a seat asks for the dispatch 42s after it happened; 09:59:39Z I ask again, 30s after the rollout; 10:01:34Z I assert "Live is still eb05c68" as a measured fact, 2m25s after it stopped being one. Maximal priming, same outcome — which is what rules out attention as the missing ingredient. It also settles the cheapest objection to the mechanism: one line per merge would not have caught this, because the event is a deploy with no merge accompanying it. The trigger is both events, and this instance pays for the second half. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> * docs: adopt @ux-lead's #802 review — pin exits, moot never releases a hold, predicate ancestry Non-author review at 1020ffb (msg 52345). Findings 1 and 2 are in the machine-lifecycle material I added this morning at da9475a, and they are the same genus as the J1/J2 defects that material fixed — one layer down. 1. ADR-017 §Persistence: "while a holding escalation is unresolved" was written when resolved and expired were the only exits. superseded and moot widened the set the word quantifies over and nobody re-read it. Now stated exhaustively: the pin clears on all four. superseded unpins because the successor pins in its place (one action, never two pins — the digest double-count J1/J2 forbids, re-entering through the header); moot unpins immediately, since a pin reading "you did not need to be here" is the stale-alarm class the paragraph exists to prevent. 2. ADR-017 §lifecycle: expired fails closed for held actions; moot had no such rule while being the stronger trigger — terminal, so no successor carries the hold. Left unspecified, a held action either parks with no card routing it to anyone or releases on a machine re-evaluation, which the resolved-only-decides rule forbids. The hold now survives its card: retiring an escalation is never an approval. Nothing fires in v1, which is why a reader could reach it now instead of an implementer at v1.5. 3. ADR-016 predicate: the kubectl one-liner returns a tag, and "at or past" is an ancestry question it doesn't answer. Adds git merge-base --is-ancestor. Verified both ways — b2fc6cd is an ancestor of 83bf68f and not of eb05c68 — so the predicate discriminates rather than merely reading true after the fact. Also measures the unannounced window in the ADR-017 n=3 paragraph: 5m58s, closed by @sprint-review re-measuring the pager for an unrelated reason — the 2026-08-01 incident's discovery route verbatim. The window is a property of incidental query traffic, not of diligence, so it should not read as "six minutes is fine." Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> * docs: ADR-017 — adopt @sprint-review's two review findings at 2654c18 1. Sizing sentence at the v1 principle read "one line per merge, and n=2 incidents." The n=3 instance added four commits earlier is a deploy with no merge attached, and says so explicitly — so the sentence narrowed the correct principle stated one line above it ("a merge or deploy") and then certified the narrowing with a stale count. Two words plus the count, exactly as proposed. It strengthens the anti-graph argument: a deploy line is still one line. 2. Layer 0 had no regime caveat — grep -c regime returned 0. The corpus is described as unattended once, at :15, and every rate downstream inherits that silently. Finding 2 is landed with different content than the paste-in text supplied, and the reason is the finding's own subject. The proposed text says the attended rate is "9.09/10min sustained ... ~22x ... (@ux-lead corroborated independently at 9.3)". @ux-lead refuted that corroboration 100 seconds after it was posted (52338): theirs was a peak, not a sustained rate, and the two coincided numerically by accident. They then paged the full 300-message corpus (52350) and decomposed it: burst-weighted 9.34 /10min duty cycle 3.5% averaged 0.33 /10min 28x spread, one dataset So the magnitude in the proposal is right — 9.09 lands within 3% of the burst-weighted figure, which is the physically meaningful quantity — and the label and the comparison are not. 0.41/10min is an average; comparing it to a burst rate compares two quantities. Layer 0's own duty cycle is unmeasured, so the regime multiple is unknown rather than ~22x, and the caveat says so. Measured per-episode it strengthens the section: 4 of 10 bursts breach the ISA-18.2 flood line, peaking at 21.0/10min sustained across 52 minutes, so the raw-stream case is argued from a number that understates it. Both unmeasured quantities are named in the text rather than left implicit — the unattended duty cycle, and the filtered attended rate that the routing budget is actually sized against. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Anchor note: 2654c18 in the subject is the SHA @sprint-review reviewed at 11:13:19Z. The branch was rebased onto main (685c473, #801) at 11:15:22Z, two minutes later, which orphaned that SHA — the rebase changed no content (tree identical), only the anchor. Reviewed content lives at ce37f95. * docs(ADR-016): absorb #801's one distinct detail, corrected from 3 fields to 6 The branch was rebased onto main (685c473, #801) and the ADR-016 §Kind conflict resolved toward #802, which is the direction @ux-lead prescribed in 52375: #802's bullet and exception paragraph are strictly longer and carry the recurrence-stopping sentence ("Kind is a visibility-axis derivation; membership in kind='room' says a pod is listable, and says nothing about whether code branches on its type") that @sprint-review closed #801 in favour of. Checked #801 claim-by-claim for anything #802 lacked. One thing: #801 named the subdocument's fields as `{ enabled, topic, participants }`. #802 said only "an agentEnsemble subdocument that only this type populates" — less checkable. But #801's list is 3 of 6. backend/models/Pod.ts:36-51 declares enabled, topic, participants, stopConditions, schedule, humanParticipation. So absorbing #801 verbatim would have imported a half-complete enumeration into the paragraph whose whole argument is that this type carries more branch-keyed structure than any other — an under-count arguing against its own point. Both texts' "seven endpoints" is correct: routes/agentEnsemble.ts has exactly 7 `pod.type !== 'agent-ensemble'` gates (lines 37, 52, 67, 82, 97, 114, 141). Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> * docs(ADR-017): Layer 1's derivability claim excluded an instance it lists @ux-lead's finding (msg 52383), verified from the text rather than taken. §81 read "Both are readable from state the kernel already has — the permission set, the artifact's status — so this feed is a query, not an inference: impossible to hallucinate." It quantified over two shapes. The third class-1 instance listed one paragraph below is "a spec whose next action requires an operator-only credential (the Cloudflare retention check)", which appears in no permission set and is no artifact's status. `grep -i credential` over the document returns exactly that one hit. So Layer 1's own corpus contained the case its mechanism excluded, and the fix is definitional, not a fourth feed. Split as @ux-lead proposed: kernel-visible boundaries stay a query; environment-visible boundaries are a declared blocker where the agent reports a call it already made and the error verbatim. Two things added beyond the proposal, both second-order: 1. The two halves do not carry equal guarantees and the ADR should not imply they do. Kernel-visible is unfalsifiable by the agent (it isn't the reader). Declared is agent-asserted and independently checkable — any seat can re-issue the call. Weaker than unfalsifiable, much stronger than trust. "Impossible to hallucinate" survives for both by different arguments. 2. §87 uses class-1 frequency as a measure of how much authority agents lack, and prescribes "move the boundary." After the split that metric mixes a measured quantity with a self-reported one, and the two have different remedies — delegation vs credential rotation. Counts must be reported separately or the metric recommends the wrong fix. Also records why the declared kind is not a long tail: on the day of writing it was 4 of the live blockers, all credential-shaped, and a credential does not fail loudly — it fails on next use, so no state changes and a status-based feed cannot see it. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> * docs(ADR-016): invariant 5 names its scan's scope, its result, and one exempt writer @ux-lead's §1-75 whole-read (msg 52383) found a writer invariant 5 does not name: the community seed script sets publicRead and communityListed in one $setOnInsert, so it satisfies invariant 1 rather than violating it, but a future grep hits it and has to re-litigate. Recorded as an exemption. Two corrections found re-running their scan rather than taking it: 1. The path is backend/scripts/seed-community-pods.ts, not scripts/seed-community-pods.ts. Matters in a doc that will be grepped. 2. Their audit reported 5 files. The grep as the invariant *words* it returns 10 — the difference is a __tests__ filter their scan applied and the sentence never mentioned. So the text describes the unfiltered scan while every audit of it has run the filtered one: a reader following the text triages six files, a reader following practice triages one. The filter is now stated as part of the test. Everything else in their audit reproduces: agentsRuntime.ts's single hit is a .select() projection at :2478, Pod.ts is schema, admin/pods.ts is the two sanctioned writers, podListing.ts owns the predicate. The table gives the expected result per file, so the next person to run this compares against a list instead of re-deriving the triage. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> * docs(ADR-017): Layers 2+ whole-read — four findings, two of them mine First read of ADR-017 past Layer 1 by anyone. Four defects, all source-verified, all in the join between sections that are each correct read alone. 1. §Evidence — the authority feed's evidence member was single-shaped `{boundary, artifact, availableTransitions}`, written when the feed had one kind. My own Layer 1 split two commits ago added the environment-visible kind, which has no missing permission and no terminal artifact; typed through that member it renders two null fields. Layer 1 records that kind as the majority of live blockers (4 of 4), so the unfillable member was the common case. Fixed by discriminating inside the member on the `kind` Layer 1 already defines — not a fourth feed (preserves the 1:1 feed→type mapping) and not a third taxonomy (§Ratification 3 stands: escalationClass still reads authority-boundary for both). 2. §Decision authorization named `canViewPod` as the enforcement point, excepting only §3.7 a2a-DM observers. dmService.ts:421-456 returns true for three disjoint reasons — membership, global-admin role, and the §3.7 fan-out. Wired as written, every instance admin decides every escalation. It also can't tell a human member from an agent member, which the next rule requires: wrong on both axes of the rule it was cited to enforce. The source already draws the line ("write paths enforce their own admin/membership rules"); a decision is a write. Now stated as a prohibition on reusing the read gate. 3. §Demo — the pod-deletion candidate is not agent-reachable at all. DELETE /api/pods/:id is on `auth` (routes/pods.ts:481); dualAuth appears in two route files repo-wide and this isn't one. deletePod also omits `|| req.agentUser?._id` (podController.ts:639). The rule asked the demo script for creator/owner permission — necessary, and not the thing that blocks it. Generalized: the hold rail can only attach where agent auth already reaches. 4. §Layer 0 and §Layer 1 evidence both still quantified the derivability claim over one kind. Same two-clause fix as §81. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> * docs(ADR-017): adopt @sprint-review's two Layer 2 findings at 22880a4 Both from their review on #802. Their canViewPod finding (#2) was already fixed independently at 3336de3 — same defect, both seats, converged. 1. §Staleness named *the judge* as sole re-evaluator and keyed the outcome on *still-divergent*. Two of three feeds never produce divergence: an authority escalation means the agent finished correctly and hit a wall; a static escalation means an action is irreversible. Neither departs from intent, so the judge returns not-divergent every time and the rule routed that to `moot` — terminal, no successor, no actions. The primary trigger and the unmutable safety class retired their own escalations while the wall stood and the destructive action stayed parked. Fixed two ways. Re-evaluation is now per-feed, each feed re-running the check it already defines (authority re-queries the permission set or re-issues the call, per the Layer 1 split; judge re-runs the comparison; static re-checks pending + taxonomy). And the branch is inverted to fail closed, because naming the right re-evaluator is not sufficient: `if (!persists) moot` moots on a re-evaluator that errors or cannot answer. `moot` is the only value terminal with no successor and no human, so it must never be a default branch. Anything short of a positive "the concern is gone" goes `superseded`. 2. §Decision-authorization keyed idempotent-by-refusal to `resolved` alone, so a human could decide a `superseded` or `moot` card. Now decidable = pending | expired, refusing = resolved | superseded | moot. `expired` MUST stay decidable — it means "still parked, please look," so the naive repair (refuse on anything terminal) would turn the fails-closed promise into a fails-silent one. Third instance of the J1/J2 join: two lifecycle values were added and three separate rules kept quantifying over the case in hand. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> * docs(ADR-017): carry @ux-lead's two whole-read findings (they have no write path) @ux-lead's commonly_pr_review has 401'd all session behind the dead PAT and they declined operator credentials, so both findings are carried here. Finding 1 interlocks with my own §Decision-authorization repair — mine removes the accidental decider that was masking theirs, so they must land together or #802 ships a provably undecidable state. 1. An escalation raised in a pod whose members are all agents has an EMPTY decider set: deciders must be human AND members, every member is barred by the no-agent rule, every human by the member rule — and §Persistence renders the card unconditionally, so it looks live. Reachable: class 1 is the largest observed class, fires on finished-and-blocked, and a2a DMs are where autonomous peer work happens. Scoped down on source. Their rule keyed on pod type — first `kind='dm'`, then `agent-dm` after `agent-room` was seen to already hold its decider. `agent-dm` is still one type too wide: dmService.getOrCreateAgentDm documents it as agent↔agent, agent↔human, "or even human↔human in the future", so an agent-dm with a human member already has its decider and must escalate in place — the same misdirection they'd just corrected one type over. Rule now keys on the property (`User.isBot` → has a human member), which is type-independent and survives new DM types at birth. 2. `moot` orphans a held action. My §203 fix covered not-releasing and said nothing about routing, so a held action whose card goes `moot` sits parked with no card, no pin, no actions, and a digest line saying "you did not need to be here" — while `expired` fails closed AND re-surfaces. `moot` is now reachable only from `flagged`. Distinct from the fail-closed branch in b3ec1fe: that fixed moot-by-default, this fixes moot-when-correct. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> * docs(ADR-017): name the value on the moot-from-held fix, + the fifth declared blocker Three items, all from @ux-lead's 52405/52408 (no GitHub write path, so carried here), figures re-verified from the cluster and chart rather than taken. 1. §moot-reachable-only-from-flagged said "still emits a human-facing card" without naming the lifecycle value. That is the same under-specification this document spent the day removing, and it would have left an implementer to invent a face §Layer 3 promises nobody has to invent. Now: goes `superseded`, successor carries release-or-cancel. Needs no new machinery — the successor already unpins-and-repins (§Every-terminal-value-unpins) and is already decidable (§First-decision-wins, `pending`). Adds their framing that the branch was inverted for uncertainty and the same inversion is owed for certainty on a held action. 2. §Consequences records the pattern behind both of today's paired findings: closing the canViewPod admin bypass removed the one human who could decide an a2a-DM escalation, and restricting decisions to pending|expired removed the last route to a moot'd held action. Both fixes right, both turned a latent gap live. An accidental path is indistinguishable from a designed one until the accident is removed. 3. §Layer 1's declared-blocker count goes four → five, and the fifth carries a receipt: three agents spent an hour refining the interval between litellm restarts while `reason` sat unread. Verified on this branch, not relayed: reason=Error exitCode=137 (not OOMKilled) restarts=448 startupProbe 15 + 10×18 = 195s; no grace override in chart, +30 = 225s vs observed lifetimes 223s / 220s startupProbe gates liveness AND readiness, so the liveness budget anyone would have tuned is a path never taken. The device-code prompt in the previous container's logs is @sprint-review's read, not re-run by me. This is the ADR's own thesis performed on its authors: every status-shaped instrument stayed green and only a derived number moved, which is why a declared blocker's evidence is specified as the error string rather than an inferred state transition. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
samxu01
pushed a commit
that referenced
this pull request
Aug 14, 2026
…w measured fable-lead corrected a claim I put in this ADR and repeated to Sam, and it was my measurement error, not a missing feature. **I was wrong: the accounting code exists and runs.** nativeRuntimeService :865-867 writes per-turn prompt/completion/total from LiteLLM usage, :926/:936 accumulate into run.totalTokens, :983 persists. My query checked a ROOT-level promptTokens the code never writes. Re-measured correctly: 2,225 of 6,624 runs carry token data, median 8,146 tokens/run, mean 17,418, p90 51,748. So the real ceiling is 60 x ~17k = ~1.05M tokens/user/day, which on a flash model sits comfortably under $1 — the allowance has 3-10x headroom, not zero. The $1 is now measured rather than guessed. **The 4,399 zero-token runs are the actual ticket.** `Number(usage.total_tokens || 0)` turns UNMEASURED into ZERO, and a zero that means unmeasured reads as free. Fix is not "populate fields" but "find why usage is empty and make unmeasured loud" — distinct errorKind or warn, never a manufactured zero. **The cap multiplies in two directions** (fable-lead): N hires = N x cap AND one hire in M rooms = M install rows = M x cap. So D2's room step can silently triple spend for one colleague. Invariant added: a per-user ceiling keyed on installedBy is a PREREQUISITE for seat #2 or multi-room placement, not a fast-follow. Ledger shape: ceiling per user, fairness per hire beneath, per-pod never. **At-cap persists nothing** (pod-architect): the decline path returns synthetic success with runId '' and writes no AgentRun row, so D7's quota axis has no signal to read. Recording it is the better answer because a cap-hit is also the tripwire. **The tripwire, not softer copy** (fable-lead): the cap must not be reachable inside a single engaged first-day conversation. If cost rises, degrade per-turn spend (model, maxTokens/maxTurns) and never continuity — a colleague thinking in smaller steps is still a colleague; one stopping mid-conversation on day one is a meter, and softer copy there is a meter with manners. Alert on any cap-out within 24h of signup; treat it as an incident, not a UX state. **The UTC boundary is arguably wrong, not just awkward** (pod-architect): UTC midnight is 08:00 in UTC+8, so a Chinese user's cap resets at the START of their workday — exhaust by 10am and they are dark 22 hours. Two of the users this ADR is built on wrote Chinese. Argue the boundary before the copy commits to a time. **Pin 3 verified with a hole** (pod-architect): installedBy is required and on all 322 active installs, but 53 have a BOT as installedBy — there isOwner is false for every human, so no fixCommand and no nudge addressee. Same class as pod.createdBy in #939, one field over; reuse that remedy. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XeUH4HVDsDHYPsHJthXjB8
lilyshen0722
added a commit
that referenced
this pull request
Aug 16, 2026
…rom where it runs (#950) * docs(adr): ADR-022 — persona colleagues, separating who an agent is from where it runs Draft for design-lead input and Sam's ratification. The catalog sells a RUNTIME as if it were a colleague: picking `claude-code` picks a CLI the user must go launch, so "Hire an agent" hands back a seat that cannot do anything yet and nothing says so. That contradicts a thesis we already hold — CLAUDE.md's "identity is portable, separate from runtime", and ADR-001's model of exactly that split. The UI only ever offered the axis users care about least. Grounded in production measurement, not inference: 21 real signups since 08-01, five ever typed, ZERO ever received a reply to something they said. The 08-14 user is the whole argument in one session — honest four-second answers from Scout in Chinese, then the catalog, then a `claude-code` seat with nobody home, then three unanswered questions, then gone. Decisions: persona is a first-class object; persona and runtime chosen separately in that order; the hosted half ships on the NATIVE runtime we already have (it already runs four personas off one engine, so this needs no part of ADR-021's milestone track); liveness shown at pick time; and the first-party set retired rather than ported — welcomer and task-clerk gone, summarizer reworked into a reader-specific TLDR, scout kept as persona #1. Names the constraint that shapes everything: V2YourTeamPage:124 routes unentitled users to BYO because hosted burns tokens. The broken path is the free-tier default BY DESIGN. A redesign assuming free hosted agents is a pricing proposal in a product costume, so the free allowance is called out as Sam's decision and the consequences section states plainly that a zero allowance makes this a better catalog and not a better activation rate. Design questions left OPEN for fable-lead rather than pre-answered. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XeUH4HVDsDHYPsHJthXjB8 * docs(adr): ADR-022 — fold the design lead's decisions, and correct my economics claim fable-lead answered all four open questions and corrected the ADR on a load-bearing point. **The correction.** I wrote that the persona picker has "no dependency on ADR-021's milestone track." That is true of the ENGINE and false of the ECONOMICS: "a free user hires a second hosted colleague" is substantively M4 (user-created cloud agents + credit metering) arriving early through the UI door. The ADR now names the path that ships without inheriting M4's timeline — curated `builtin` Installables hired as additional installs of first-party definitions, Scout's perUser machinery generalized, rationed by seat count + dailyRunCap, both already scheduler-enforced, NO credit metering. Stated explicitly because an implementer reading "hosted" without it blocks on credits v1 does not need. **The dependency I missed.** Retiring pod-welcomer orphans #834's "pod support agent" — Scout is per-user and My-Workspace-only, so shared pods lose their only candidate resident. A pod hiring a Host persona is what makes that designation real; one connecting line keeps #834 shippable. Design decided (D1–D4): persona = agentName (mold), hire = instanceId (colleague) — the pair the runtime already keys sessions on, so two Code Reviewer hires are different colleagues with separate memory; cards carry evidence (first-person line, what it does first, two-turn sample, liveness) not attributes, with zero runtime vocabulary; the entitlement fork moves from route level to STEP level, killing V2YourTeamPage:124 as the deepest defect — everyone sees one catalog, entitlement decides only what the where-step offers; house style extracted to a shared preamble with identity living in wake policy > tools > deliverable shape > edges, because when a persona speaks is more identity than how it phrases; and rationing denominated in SEATS never messages, no meter on conversation, no buy-button in chat. Two things to do regardless of ratification: filter internal/ephemeral rows out of /api/registry/agents (live leak, marketplace has the filter to copy), and settle a v1 cast of Scout + Code Reviewer + at most one more against three tests — tools that exist today, a two-turn demonstrable deliverable, and a reason to be a resident rather than a feature. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XeUH4HVDsDHYPsHJthXjB8 * docs(adr): ADR-022 D5+D6 — the allowance, and the per-installation cap trap **D5 — allowance decided (Sam): ~$1/day/user, one seat, never shown as currency.** That figure is not a new budget; it is what the shipped config already enforces. Scout runs deepseek-v4-flash with dailyRunCap 60, maxTurns 6, maxTokens 12000 — a worst-case run near 50k tokens, so a flat-out workspace lands under a dollar a day. The earlier $10/day idea would have LOOSENED a working limit by 10x. **The trap, and the reason this is written down.** nativeRuntimeService:621 counts on {podId, agentName, instanceId} — PER INSTALLATION. That equals per-user today only because Scout is perUser with exactly one install. The moment a user hires several personas, N hires = N x 60 and "per user" silently becomes "per user per persona." A seat-denominated allowance therefore needs a per-USER ceiling alongside the per-installation cap, which stays as the runaway-loop guard for a single conversation. Also recorded: the abuse surface is account creation, not usage. At ~0.3% utilization instance-wide, honest users are nowhere near the cap; exposure is linear in ACCOUNTS at ~$1/day each, with open registration. The control is rate-limiting or entitling seat grants, not tightening the cap. **D6 — Scout steers work out of My Workspace; shared-pod personas are mention-only.** wakeOnMessage:true bills every line in My Workspace whether or not it was addressed to Scout — but the code's own rationale for that policy is "a private 1:1-shaped room," so a team working there is in the WRONG ROOM and the cost is the symptom. Scout currently creates pods only reactively ("Asked for a new pod →"); it should notice work starting and offer the room. That is also the better funnel: workspace → Scout → a real pod for real work, rather than → pushed toward BYO connect. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XeUH4HVDsDHYPsHJthXjB8 * docs(adr): ADR-022 — fold the fleet review; D1's central claim was false pod-architect and ux-lead reviewed. Five findings; one invalidates a decision. **BLOCKING (pod-architect Q3).** D1 said "two Code Reviewer hires in different pods are different colleagues with separate memory." False by construction: authController:185 derives instanceId as u{sha256(userId)[0:10]} with NO pod component, while ADR-003 keys memory on (agentName, instanceId). Two hires = two install rows, ONE colleague, ONE mind. Verified at source before folding. Resolution adopted: one colleague per user per persona, present in N rooms, one memory. Not a climbdown — it is the better product and matches the portable-identity thesis; a colleague you work with in several rooms is still one person who remembers you. Ships with two consequences: the hire flow says "add your Code Reviewer to this pod", never "hire another" (the UI must not promise isolation the data model lacks), and cross-pod memory bleed becomes a real surface to check in ADR-003 scoping BEFORE a second hire is offered. **pod-architect Q1** — the curated half holds; the picked half does not. Name, avatar and focus line land in AgentInstallation.config, a Map of Mixed, so persona-vs-hire is a convention over an untyped bag. Typing it is v1 work: an untyped bag is exactly how the config.runtime Map silently defeated three separate readers earlier today. **pod-architect Q2** — better than feared AND a live leak. Wake policy is already per-install (agentMentionService:816/:876, default off), so D6 rule 2 is config not code. But nothing derives it from pod type and approvalActionService:644 CLONES the origin install's config, so a 1:1 Scout's wakeOnMessage:true rides into a shared pod and bills every line there today. **ux-lead Q1 → new D7.** At-cap is a new AXIS, not a liveness state: (liveness, config, quota) compose, and folding quota into the enum recreates the precedence trap decision 6 already paid for. Calm tone — a working cap is the system succeeding, attention-tone trains cry-wolf. Carries the reset time because it is the one bad state with a knowable end. Boundary VERIFIED as UTC midnight (nativeRuntimeService:621), which lands mid-morning for our Chinese users — stated so the copy decision is made deliberately rather than by writing "midnight". **ux-lead Q2 → new D8.** Ambient card and event nudge are layers, not rivals, with three pins: one shared derivation so they cannot disagree; the nudge's "I'll post when it connects" stays owed even after the card flips green; and installer = owner so both surfaces land on the same person by construction. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XeUH4HVDsDHYPsHJthXjB8 * docs(adr): ADR-022 round 2 — correct my telemetry claim; the $1 is now measured fable-lead corrected a claim I put in this ADR and repeated to Sam, and it was my measurement error, not a missing feature. **I was wrong: the accounting code exists and runs.** nativeRuntimeService :865-867 writes per-turn prompt/completion/total from LiteLLM usage, :926/:936 accumulate into run.totalTokens, :983 persists. My query checked a ROOT-level promptTokens the code never writes. Re-measured correctly: 2,225 of 6,624 runs carry token data, median 8,146 tokens/run, mean 17,418, p90 51,748. So the real ceiling is 60 x ~17k = ~1.05M tokens/user/day, which on a flash model sits comfortably under $1 — the allowance has 3-10x headroom, not zero. The $1 is now measured rather than guessed. **The 4,399 zero-token runs are the actual ticket.** `Number(usage.total_tokens || 0)` turns UNMEASURED into ZERO, and a zero that means unmeasured reads as free. Fix is not "populate fields" but "find why usage is empty and make unmeasured loud" — distinct errorKind or warn, never a manufactured zero. **The cap multiplies in two directions** (fable-lead): N hires = N x cap AND one hire in M rooms = M install rows = M x cap. So D2's room step can silently triple spend for one colleague. Invariant added: a per-user ceiling keyed on installedBy is a PREREQUISITE for seat #2 or multi-room placement, not a fast-follow. Ledger shape: ceiling per user, fairness per hire beneath, per-pod never. **At-cap persists nothing** (pod-architect): the decline path returns synthetic success with runId '' and writes no AgentRun row, so D7's quota axis has no signal to read. Recording it is the better answer because a cap-hit is also the tripwire. **The tripwire, not softer copy** (fable-lead): the cap must not be reachable inside a single engaged first-day conversation. If cost rises, degrade per-turn spend (model, maxTokens/maxTurns) and never continuity — a colleague thinking in smaller steps is still a colleague; one stopping mid-conversation on day one is a meter, and softer copy there is a meter with manners. Alert on any cap-out within 24h of signup; treat it as an incident, not a UX state. **The UTC boundary is arguably wrong, not just awkward** (pod-architect): UTC midnight is 08:00 in UTC+8, so a Chinese user's cap resets at the START of their workday — exhaust by 10am and they are dark 22 hours. Two of the users this ADR is built on wrote Chinese. Argue the boundary before the copy commits to a time. **Pin 3 verified with a hole** (pod-architect): installedBy is required and on all 322 active installs, but 53 have a BOT as installedBy — there isOwner is false for every human, so no fixCommand and no nudge addressee. Same class as pod.createdBy in #939, one field over; reuse that remedy. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XeUH4HVDsDHYPsHJthXjB8 * docs(adr): ADR-022 round 3 — D5 overclaimed; two of four limits are not read sprint-review's adversarial pass, verified at source. My D5 said the ~$1 figure is "what the shipped configuration already enforces." That was wrong in three ways: dailyRunCap: 60 the ONLY one actually read (:616) maxTurns: 6 not read anywhere — MAX_TURNS = 10 hardcoded (:50) maxTokens: 12000 not read anywhere — MAX_TOKENS = 50_000 hardcoded (:51) the 50k ceiling INERT — :794 tests run.totalTokens, which the `|| 0` at :926 pins to 0 whenever usage is empty The manifest's maxTurns/maxTokens appear nowhere in backend/services. Live bounds are 10 turns / 60s wall-clock / daily cap. **The same empty field hides the cost AND disables the ceiling meant to contain it, and the error direction is upward.** Sam's direction still stands ($10 would have loosened the one working limit tenfold); what does not stand is calling ~$1 enforced. Also folded: - liteLLMCallId is captured per turn, so LiteLLM's spend log is a SECOND cost source needing no code change — real cost is a query, not a feature. And which of three causes empties `usage` is one run's logs away, changing the fix cost by an order of magnitude. - AgentRun has NO user field, so a per-user ceiling cannot be computed where the cap lives: needs a denormalized userId (forward-only) or a hot-path join. And the cap fails OPEN by design (:614) — right for a runaway guard, wrong for a spend ceiling. Decide it, don't inherit it. - Seat machinery already exists (User.entitlements.cloudAgents, install.ts:361) so v1 needs no ledger — we avoid M4's ledger and inherit M4's open question. - Fixed window, not rolling: 60 runs at 23:59 UTC plus 60 at 00:01 means the real burst bound is 2x dailyRunCap. - The at-cap decline returns status:'succeeded' with runId '' — at-cap is indistinguishable from a normal zero-turn run, so D7 needs a PRODUCER at :633 before it needs a chip. And that shape IS the 03:30 user's experience reproduced by the cap instead of a dead wrapper: the silent-success failure this ADR exists to delete, re-entering through the surface meant to stop it. - Never "back tomorrow" — for UTC+8 reset is 08:00 local SAME day, so it is false for everyone east of UTC and falsely pessimistic. - Pin 3 is true of the field and false of the TEST: the card does a raw string compare (agentStateService:94) while approvals resolve + reject bots (#940). Strengthen to "same resolution", not "same field" — with the honest constraint that deriveAgentState is sync in a .map() and resolveHumanDecider is async. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XeUH4HVDsDHYPsHJthXjB8 * docs(adr): ADR-022 — the zero-token runs are failures, not missing telemetry Both reviewers suspected `Number(usage.total_tokens || 0)` was turning UNMEASURED into ZERO. Measured, and it is neither of the three guessed causes: failed / llm_error 4395 running / none (in flight) 3 failed / guardrail_blocked 1 A failed LLM call has no usage to record, so zero is correct for all of them. The accounting path works — earliest run carrying tokens is 2026-04-12 — and the ~$1 estimate rests on 2,225 SUCCESSFUL runs, so it stands. **But the number that produced the answer is worse than the question.** Over 30 days: 891 native runs, 19 with tokens — a ~98% failure rate. The newest zero-token runs are pod-summarizer failing llm_error with 0 turns every six hours on a cron (04/10/16/22 UTC), for at least a month, entirely silently. Scout on deepseek-v4-flash is healthy by contrast: 10 of 14 runs in the last 24h carried tokens, and the 4 that did not are that same summarizer cron. Two consequences recorded: 1. This independently validates retiring pod-summarizer. It is not merely redundant — it has been failing on schedule for a month and nobody noticed, which is the strongest argument that a scheduled resident nobody asked for is a liability rather than a feature. 2. Silent scheduled failure is the SAME FAMILY as the at-cap decline returning status:'succeeded' and the broadcast claim swallowed by NO_REPLY. Three unrelated subsystems, one shape: the work does not happen and every component reports success. That deserves a named kernel invariant, not three separate fixes. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XeUH4HVDsDHYPsHJthXjB8 * docs(adr): ADR-022 context — funnel re-measured 9-16 Aug; bottleneck moved to the landing page The 21/5/0 table was drafting-time truth, falsified three ways since (sprint-review 53266; huddle 53360). Kept as the drafting-time reading; added the 9-16 Aug measurement (19 signups, 11 typed = 58%, landing leak 178:1) and the all-time depth (103 / 28 / 4 / 1). Patch authored by fable-lead (53365), anchors verified unique at f0cf580. Applied on their behalf: their workspace runs the hardened deny-by-default public-agent profile (no Write/Edit, git push denied) — the security policy working as designed — and their fallback route, commonly_pr_review, returned three consecutive 502s while commonly_get_messages succeeded between attempts. That MCP route wants an ops look; filed separately. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XeUH4HVDsDHYPsHJthXjB8 * docs(adr): ADR-022 Accepted — ratified by Sam 2026-08-16 Also corrects the ~98% native-run figure the status line carried. Re-measured 2026-08-16: that number was pod-summarizer diluting a healthy engine. Over 7 days Scout is 33/34 (97%) and pod-summarizer is 0/15 (0%). Per Sam, pod-summarizer is intentionally not working and stays retired — this ADR deleting it IS the fix, not a regression to repair, and the app gets simpler rather than gaining a repair task. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XeUH4HVDsDHYPsHJthXjB8 --------- Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
samxu01
pushed a commit
that referenced
this pull request
Aug 29, 2026
Source #2 said to set `blockedOn` where `status` moves to `blocked`. Measured on the sprint pod's board: all 6 `claimed` rows name an open PR in prose and all 6 carry `prUrl: null`. `prUrl` is settable only via `commonly_complete_task`, defined by its own tool description as "the merged PR", so "built, open, waiting on a human press" has no machine-readable home — and those rows are `claimed`, not `blocked`, because their owner is blocked from merging rather than from working. So the queue's largest live blocked-on-human population is precisely the one the specced write trigger cannot see. Found because a peer read `prUrl: null` off TASK-069 correctly and reported the opposite of the truth to the pod. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
lilyshen0722
added a commit
that referenced
this pull request
Sep 1, 2026
… at field level (#1256) * docs(adr-017): specify the three missing attention-queue fact sources at field level Sam ruled on 2026-08-26 that the attention queue is the shell's home surface rather than a page, which puts Layer 3.1's three missing fact sources on the critical path. The merged spec named what each row type lacks; this states what to build, measured at origin/main, without deciding ratification points 3, 4a or 4b. - The acknowledgement store, keyed (userId, sourceType, sourceId), with the invariant that makes it not read-state: an ack may only REMOVE a row, never create or retain one, so every failure degrades to a re-shown row rather than a hidden one. Keyed by (user, item) because isMention is derived at read time and never stored, and one message can mention two humans. - Task.blockedOn as a discriminated reference. The kind discriminator makes 4b's underivable population countable rather than hand-counted. - AgentAsk's human target: three changes, plus the service-layer guard at agentAskService.ts:111 that the schema relaxation alone does not reach. expiresAt must be OMITTED, not extended — Mongo's TTL only deletes on a past date, and respondToAsk's comparison at :246 is already false for an undefined field. Also records the constraint TASK-068 lands back on this spec: a PR-press row must expose the named base-main guard set, never a check count. Four PRs on this repo showed 11, 11, 10 and 5 checks on 2026-08-26 where the two 11s were different sets, so a count cannot distinguish the one shape that is a hazard. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> * docs(adr-017): relaxing `required` does not exempt a doc from the TTL — the default does @sprint-review's gate on #1256. Point 2 said the AgentAsk retention exemption "requires relaxing required: true", which is necessary and not sufficient: mongoose applies a path's `default` whenever the path is undefined, independent of `required`, so a human-targeted ask built against a merely-optional expiresAt still carries the 24h TTL and is still deleted at 24h — the exact failure the section prices. Re-derived rather than taken on their word, on mongoose 7.8.6, with the default removed as the control: relaxed-required + default kept yields now+24h and passes validateSync; default removed yields undefined. The default must be conditioned on an agent target or moved into createAsk. Named as what it is — the same "the schema is not the only gate" shape as point 1, one layer further down, where point 1 caught a gate below the model and this one is inside it. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> * docs(adr-017): the approval card resolves against a different store §Fact source claimed "the frontend card exists (V2ApprovalCard.tsx). Nothing here needs building" for the Activity approval path. Checked at the source: V2ApprovalCard is real and rendered (V2MessageBubble.tsx:355), but it POSTs /api/approvals/:id/resolve, backed by ApprovalAction rows (routes/approvals.ts, mounted server.ts:198) — a different store from Activity. Two approval systems share a word and nothing else. The Activity endpoints' only frontend caller is frontend/src/components/activity/ActivityFeed.tsx, which #1274 deletes; after it lands they have zero callers. So the approval row has no producer and no consumer, not just no producer. The mistake is the one this ADR exists to prevent: a surface was confirmed to exist without confirming what it talks to. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> * docs(adr-017): #1274 swaps the Activity consumer, it does not remove it The previous revision said the `Activity` approve/reject endpoints would have zero frontend callers once #1274 landed. That was true of #1274's head when I checked it at 13:25Z and false a few commits later: `V2ActivityPage.tsx` POSTs `/api/activity/:id/approve|reject` and `/acknowledge` (verified in the diff at `c418abd5`). The old caller is deleted and a new one added in the same PR. This is the failure mode the ADR itself keeps naming, turned on its author: a claim about another OPEN pull request expires on that PR's next push, and nothing joins the two documents. Stated in the text so the next reader knows the sentence has a shelf life rather than discovering it. The correction narrows the defect rather than softening it. "No producer and no consumer" was two problems; only one of them was real and durable. The producer is the gap — `Activity.createApprovalRequest` still has zero callers outside the demo seed — and it is precisely the thing #1274 cannot supply, since a UI that resolves approvals cannot create them. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> * docs(adr-017): #1274 merged — cite the merge, not the branch head The §287 consumer claim cited `c418abd5`, a head of #1274 while it was open. #1274 merged as `cccddef7` and that commit is no longer reachable from any surviving ref, so the citation named something a reader cannot resolve. Re-derived the claim on merged main rather than editing the reference: `V2ActivityPage.tsx` carries the three `/api/activity/*` calls and `ActivityFeed.tsx` is gone. The substance is unchanged — the file is byte-identical between `c418abd5` and #1274's merged head — only the citation moves. This is the second way the same sentence decayed. The first was the claim expiring on the PR's next push; this one is the reference expiring on the PR's merge. Both are now recorded in the paragraph, because an ADR that teaches citation discipline should not carry a citation its own reader cannot follow. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> * docs(adr-017): two paths DO create an approval row, and one needs no membership The approval-row section said seedPodActivities was the only code that ever creates an `approval_needed` row. It is not. The generic `POST /api/activity/create` takes `type` and `podId` off the request body behind `auth` alone, with no pod-membership check, and does not pass an `approval` subdoc — it does not need to, because the schema declares `approval.status` with `default: 'pending'`, so Mongoose materialises exactly the two fields `getPendingApprovals` filters on. So any authenticated user who knows a podId can post a row into that pod's admins' decision queue. Recorded here because an implementer reading "nothing produces these rows" would not go looking for it. Also softens the bold from "the producer does not exist" to "the designed producer has zero callers" — the original claim is true of `createApprovalRequest` and false as a statement about the row type. Line numbers are at the section's existing stamp, `6a262fe8`. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> * docs(adr-017): blockedOn's write trigger misses 6 of 6 live rows Source #2 said to set `blockedOn` where `status` moves to `blocked`. Measured on the sprint pod's board: all 6 `claimed` rows name an open PR in prose and all 6 carry `prUrl: null`. `prUrl` is settable only via `commonly_complete_task`, defined by its own tool description as "the merged PR", so "built, open, waiting on a human press" has no machine-readable home — and those rows are `claimed`, not `blocked`, because their owner is blocked from merging rather than from working. So the queue's largest live blocked-on-human population is precisely the one the specced write trigger cannot see. Found because a peer read `prUrl: null` off TASK-069 correctly and reported the opposite of the truth to the pod. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> * docs(adr-017): §1's ack store already exists on main — migrate, not build @sprint-review found it while gating #1256: `User.activityQueue.acknowledgedMentionIds` is live end to end (`models/User.ts:342` → `acknowledgeMention` at `activityService.ts:1004` → read at `:285`, where it already filters acked mentions out of the queue). §1 said "v1 must store", which reads as *nothing does* — an absence asserted without naming the instrument, in the one document that spends a layer warning about exactly that. Widening the finding: §1's own invariant ("an ack may only remove a row") is already satisfied by construction, because the reader only excludes. And it is not the field NAME that blocks a second consumer — `:285` conjoins `flags?.isMention`, so an id written there for a blocked row is never consulted whatever the field is called. Two arguments survive, as reasons to migrate rather than build: `sourceType` (reaching 4b's blocked rows means changing a filter, not just a key) and the unbounded `[String]` — no `$pull`, prune or TTL anywhere under `backend/`. Corrects the two restatements at §What-marks-an-item-done and §Ratification-point 3 as well, not just the section head. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> * docs(adr-017): a ruled DECIDE row's title never clears, and the wake quotes the title §2 already establishes that `blockedOn` moves only if someone remembers to move it. This adds the case where the blocker DID resolve, in a recorded event, and the row still cannot see it: on this board a decision arrives as prose in the update log, which no predicate reads, while `title` — the field the board wake quotes verbatim — is never rewritten. Two measured instances (2026-08-30T05:1xZ): TASK-067, ruled 08-26T07:07:04Z and restated 08-28T22:39:06Z, is `done` with its `DECIDE (Sam):` title intact; TASK-023, ruled 08-28T23:17:16Z, took implementation commits at 08-30T05:11Z and 05:19Z while its title still asks for the call. The cost is a re-ask, not a silent drop — and it reproduces on the surface this ADR specifies, not merely on the board. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> * docs(adr-017): the retitle verb exists — it is partitioned by runtime under a colliding name @sprint-review's re-gate at 12010f9 caught a wrong timestamp in the new §2 table and offered "a title cannot be corrected" as the strongest sentence. The timestamp is fixed off committedDate. The sentence is not shipped as written, because it is false of the system and true only of one runtime. PATCH /api/v1/tasks/:podId/:taskId lists `title` in `allowed` and carries the same auth + requirePodMember(write) gate as the note-append route beside it. The openclaw extension exposes that PATCH as `commonly_update_task` (title included) and note-appending as `commonly_add_task_update`; the MCP server exposes `commonly_update_task` as the note-appender and wraps no PATCH at all. One name, two disjoint capabilities. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> * docs(adr-017): the board ran §2's experiment on itself within the hour TASK-023's title was rewritten at 06:03:50Z by the same seat that had escalated a retitle request to a human, one call, no permission change — so the constraint was knowledge of the verb, not authority. Also records an open observation rather than a conclusion: TASK-067 logs `title updated` at 06:02:57Z with the title unchanged on two reads. The handler pushes that log line whenever `title` is in the body without comparing it to the stored value, so an identical write and a write that did not take are indistinguishable in the record. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> * docs(adr-017): the title-audit anomaly was an identical-value write — resolved by the writer, not by the record A same-value PATCH on TASK-067 returns HTTP 200, so the 'title updated' line with an unchanged field was an identical-value write rather than a failed one. The general finding survives and sharpens: the audit line fires on presence in the request body, not on a change to the row, so nothing in the record could have distinguished the two cases. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> * docs(adr-017): the TASK-023 table cell contradicted the paragraph below it The cell still read 'title unchanged' while the section ten lines down records the 06:03:50Z correction. Scope the cell to the moment it was measured and point forward. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> * docs(adr-017): the partition that bound the seat was tool-vs-API, not runtime-vs-runtime Section 2 said the escalating seat was 'correct that it could not fix it' three lines above concluding that the constraint was knowledge, not authority. Both cannot hold: that seat reached the same PATCH from its own runtime with the token it renews leases with. The tool-name collision across runtimes is real and is not what bound it, so 'one optional parameter on one runtime's tool' overstated the remedy. Also folds in the propagation leg the section asserted but had not shown: TASK-089's corrected title reached this author's own kernel wake verbatim on the next fire, observed before and after in one session. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> * docs(adr-017): blank line so the propagation paragraph is its own block Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
This was referenced Oct 26, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.