Skip to content

Add tests for user controller and routes - #11

Merged
samxu01 merged 1 commit into
mainfrom
codex/add-tests-for-backend/controllers-and-backend/routes
May 28, 2025
Merged

samxu01 merged 1 commit into
mainfrom
codex/add-tests-for-backend/controllers-and-backend/routes

Conversation

@samxu01

@samxu01 samxu01 commented May 28, 2025

Copy link
Copy Markdown
Contributor

Summary

  • add unit tests covering userController
  • add integration tests for user routes

Testing

  • npm run lint
  • npm test in backend

@samxu01
samxu01 merged commit 33654eb into main May 28, 2025
samxu01 pushed a commit that referenced this pull request Feb 2, 2026
@samxu01
samxu01 deleted the codex/add-tests-for-backend/controllers-and-backend/routes branch February 2, 2026 04:34
samxu01 pushed a commit that referenced this pull request Apr 3, 2026
MubaiHua pushed a commit that referenced this pull request Apr 20, 2026
samxu01 added a commit that referenced this pull request May 4, 2026
…rawer

v5.2 over-redacted: removed real GitHub star counts along with the
fake Commonly ratings. v5.3 re-distinguishes:

- GitHub stars (real upstream signal): render. Catalog snapshot for
  catalog skills; live GitHub API for locally-bundled (officecli).
- Commonly review-style ratings (★ 4.8): don't render. The system
  doesn't exist; introducing it needs its own ADR.
- Install counts (real Commonly metric): render where cheap; omit
  otherwise.

Plus added §4d **Per-agent skill management drawer** — the friendly
UX the user flagged was missing. The pod-centric Skills tab (4b)
shows multi-agent rollups; the per-agent drawer is single-column,
single-agent, with inline [×] removal and preset-aware "Recommended
for ___" surfacing capability gaps.

Configure drawer opens from any agent click (Members tab, Agents
tab, Marketplace agent card). Tabs inside: Persona · Heartbeat ·
Skills · Memory. <300 lines target.

Existing 4d (shared subcomponent) renumbered to 4e. Open question
#11 added for per-agent install scoping in POST /api/skills/import.
Phase 4 expanded to cover the drawer.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
samxu01 added a commit that referenced this pull request May 4, 2026
Eight inline comments + PR-level summary on PR #287. All addressed:

1. Line 155 — "fall back to python-office stack" was a lie (Part 2
   removes it). Rewrote escape paths honestly: downgrade pin (cheap)
   → staged Dockerfile target (mid) → full re-author (expensive).
   Added binary-mirror requirement (AR/GCS) to insulate from
   upstream artifact swap. Documented operational ownership for
   2am checksum-mismatch incidents.

2. Line 130 — SHA256SUMS placeholder. Confirmed unverified whether
   iOfficeAI publishes SHA256SUMS. Two paths: upstream artifact OR
   committed-constant-checksum. Resolved in Phase 0a (i).
   Open question #13 added.

3. Line 516 — Open question #11 escalated to Phase 0a (ii). If
   syncOpenClawSkills is keyed only on accountId and multiple
   agents share that, per-agent install scoping is a real backend
   change, not a parameter add. Phase 4 may split into 4a/4b.

4. Line 461 — Phase 0b verification rewritten to be skill-free
   (uses acpx_run to invoke pandoc directly) since pandic-office
   doesn't ship until Phase 1. Full skill-loop verification moves
   to end of Phase 1.

5. Line 348 — Inline [×] UX. Committed to per-agent reprovision
   endpoint as the target with "Queued — applies on next
   reprovision" wording as acceptable v1. Eliminated misleading
   "removing on next sync" copy.

6. Line 373 — Configure drawer permissions. Flipped default to
   admin-only after review feedback. Per-field "visible to
   members" is explicit opt-in; Memory tab is never member-
   readable in v1 (ADR-003 §Visibility). Added Invariant 7.

7. Line 227 — Live GitHub stars. Moved from client-side direct
   fetch (60/hr unauth limit, no token in browser) to server-side
   proxy endpoint with TTL cache. Failure mode: ★ — with tooltip.

8. Line 469 — Phase 5 deletion gate. Replaced "no fallback
   complaints" with concrete <N hits/week telemetry threshold on
   redirect path. ~5 lines added to Phase 3 scope.

Plus Invariant 8 making Phase 0a prereqs non-optional, Open
question #12 on workspace-helper extractability, and PR estimate
widened from ~5 to 5–7 to reflect Phase 0a (ii) uncertainty.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
samxu01 added a commit that referenced this pull request May 4, 2026
…ll surfaces (Marketplace + inspector tabs) (#287)

* docs(adr): ADR-013 agent file production — extension tool, dev skill bundles, v2 install UI

Decision spans four coordinated changes:

1. `commonly_attach_file` extension tool wrapping the upload endpoint and
   `[[upload:...]]` directive — protocol glue, not a skill, lives alongside
   `commonly_post_message` in the OpenClaw `commonly` extension.

2. Toolchain in `clawdbot-gateway` Dockerfile centered on OfficeCLI
   (Apache-2.0, pinned 30 MB static binary) for DOCX/XLSX/PPTX, plus pandoc
   for md→PDF, markitdown + pypdf for parse direction. ~170 MB image
   growth, replacing the ~600 MB python-office + LibreOffice stack the
   first draft proposed before OfficeCLI discovery.

3. Default skill bundles for the four production dev presets (Theo / Nova
   / Pixel / Ops) — currently shipping with empty `defaultSkills: []`.
   Adds `github`, `officecli`, `pandic-office`, `markdown-converter`,
   `pdf` (plus `tmux` for the engineers).

4. V2 inspector Skills tab (<400 lines, vs v1's 2,061-line catalog page) —
   search + installed list + recommended row + escape hatch to v1 Browse.

Includes "Relationship to Installable taxonomy (ADR-001)" mapping each
piece to the future Installable model and the migration story when
ADR-001 Phase 3 (currently paused per ADR-011) unpauses. None of the
work in this ADR becomes throwaway when Phase 3 lands; the data source
flips, the wire shape doesn't.

Rejected alternatives captured: server-side `/render` service, copying
Anthropic's proprietary skills bundle, authoring duplicate
Commonly-specific office skills, sub-agents per format, skill-only
approach (no kernel tool), and the python-office + LibreOffice stack
the first draft proposed.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>

* docs(adr): ADR-013 v4 — expand Part 4 to cover full v2 install surfaces

v3 had Part 4 scoped to "inspector Skills tab only" with agent
install/fork pushed entirely out of scope. That left the user-asked
v2 marketplace page and Agents tab undesigned.

v4 expands Part 4 into four sections:

  4a. Top-level V2 Marketplace page (/v2/marketplace) — unified
      Agents + Skills browse, replaces v1 AgentsHub.tsx (4954 lines)
      and SkillsCatalogPage.tsx (2061 lines) over time. Wires on top
      of existing /api/marketplace/* (PR #215+#230) and /api/skills/*.

  4b. Inspector Skills tab — per-pod contextual install. Shows which
      agents have which skills.

  4c. Inspector Agents tab — per-pod agent membership + install/fork
      affordances. Per-installed-agent: Talk to / Configure / Fork.
      Per-browse-agent: Install / Fork.

  4d. Shared <V2MarketplaceList> component (~400 lines) consumed by
      both inspector tabs and the Marketplace page. Future apps and
      widgets ports cleanly onto the same component.

Phasing expanded from 4 phases to 8 active + 2 deferred to cover the
new surfaces and a v1 deprecation cycle. Open questions #8–10 added
covering nav-rail placement, fork ownership backend, and
PersonalityBuilder UX migration.

This ADR now also lands the active "Marketplace frontend" track from
ADR-011 alongside the file-production work — they're the same surface.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>

* docs(adr): ADR-013 v5 — correct framing after verifying backend/frontend state

v3 and v4 made two assumptions that turned out to be wrong:

1. Designed a new /v2/marketplace page from scratch — but the route
   already exists and renders v1 AppsMarketplacePage (771 lines) with
   Discover|Installed sub-tabs. /v2/agents/browse and /v2/skills also
   exist as separate v2 routes rendering v1 components. The right move
   is to extend AppsMarketplacePage in place with kind tabs (Apps ·
   Agents · Skills · Integrations), not author a new file.

2. Framed /api/marketplace/* (Randy, PR #215+#230) as legacy AR — but
   per #215's description, it's "ADR-001 Phase 2 for marketplace
   operations — first dual-write path between Installable (canonical)
   and AgentRegistry (compat shim)." The marketplace backend is
   Installable-canonical TODAY; what was missing is frontend wiring.

v5 corrections:

- Part 4a rewritten: extend existing AppsMarketplacePage with kind
  tabs, wire each tab to the right backend (Agents → Installable,
  Skills → AR for now, Apps/Integrations unchanged). Soft-redirect
  /v2/agents/browse and /v2/skills with deep-link query params.

- Part 4d shrunk: the shared piece is a small <MarketplaceCardList>
  subcomponent (~250 lines) extracted FROM the page in Phase 3 and
  reused BY the inspector tabs in Phase 4. v4's heavyweight
  <V2MarketplaceList> was over-engineering.

- Phasing collapsed from 8 active to 5 active. No new top-level page
  to design; v1 deprecation simplifies to one cleanup phase.

- §"Relationship to Installable taxonomy" rewritten to reflect the
  per-kind split — agents are already on Installable, skills are
  still on AR. ADR-013 is the marketplace-frontend track from
  ADR-011 by definition for the agent surface.

- Open question #7 (accelerate Phase 3?) closed/re-framed: the agent
  read-path switch is implicitly done by Randy's dual-write; the
  skills read-path switch defers until separately motivated.

- Open question #8 (nav-rail placement) closed: page already mounted.

- Open question #9 (fork ownership) narrowed: Randy's
  /api/marketplace/mine likely covers it; just verify response shape.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>

* docs(adr): ADR-013 v5.1 — flag catalog index numbers as 2026-02-05 snapshot

Catalog index (docs/skills/awesome-agent-skills-index.json) has
updatedAt: 2026-02-05 — nearly 3 months stale at draft time. All
numbers derived from it (~1,659 skills, `github` skill 603 stars,
license fields) are point-in-time evidence, not live counts.

Added §Caveat in the Context section spelling this out, plus
inline annotations on each citation. Numbers fetched live via
GitHub API today (OfficeCLI 2,768 stars + v1.0.70 release date)
are explicitly timestamped 2026-05-03 and treated separately.

Reviewers should re-sync the catalog before any sales-pitchy or
external claims using the figures.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>

* docs(adr): ADR-013 v5.2 — replace invented mockup numbers with placeholders

The ASCII mockups for the marketplace page and inspector Agents tab
had invented numbers that looked authoritative:

- "Apps (12)", "Agents (78)" — kind-tab counts I made up
- "★ 4.8 · 240 installs" (Liz), "★ 4.6 · 88 installs" (Theo)
- "★ 4.5 · 175 installs" (Tarik)

Reviewers could mistake these for projections or commitments. Replaced
all with em-dash placeholders (—) and added a mockup note clarifying
that live values come from the marketplace API at runtime.

Same hygiene as v5.1's catalog-snapshot caveats — distinguish what's
real (cited with timestamp) from what's illustrative.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>

* docs(adr): ADR-013 v5.3 — restore GitHub stars, add per-agent skill drawer

v5.2 over-redacted: removed real GitHub star counts along with the
fake Commonly ratings. v5.3 re-distinguishes:

- GitHub stars (real upstream signal): render. Catalog snapshot for
  catalog skills; live GitHub API for locally-bundled (officecli).
- Commonly review-style ratings (★ 4.8): don't render. The system
  doesn't exist; introducing it needs its own ADR.
- Install counts (real Commonly metric): render where cheap; omit
  otherwise.

Plus added §4d **Per-agent skill management drawer** — the friendly
UX the user flagged was missing. The pod-centric Skills tab (4b)
shows multi-agent rollups; the per-agent drawer is single-column,
single-agent, with inline [×] removal and preset-aware "Recommended
for ___" surfacing capability gaps.

Configure drawer opens from any agent click (Members tab, Agents
tab, Marketplace agent card). Tabs inside: Persona · Heartbeat ·
Skills · Memory. <300 lines target.

Existing 4d (shared subcomponent) renumbered to 4e. Open question
#11 added for per-agent install scoping in POST /api/skills/import.
Phase 4 expanded to cover the drawer.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>

* docs(adr): ADR-013 v5.4 — address 8 PR #287 review comments

Eight inline comments + PR-level summary on PR #287. All addressed:

1. Line 155 — "fall back to python-office stack" was a lie (Part 2
   removes it). Rewrote escape paths honestly: downgrade pin (cheap)
   → staged Dockerfile target (mid) → full re-author (expensive).
   Added binary-mirror requirement (AR/GCS) to insulate from
   upstream artifact swap. Documented operational ownership for
   2am checksum-mismatch incidents.

2. Line 130 — SHA256SUMS placeholder. Confirmed unverified whether
   iOfficeAI publishes SHA256SUMS. Two paths: upstream artifact OR
   committed-constant-checksum. Resolved in Phase 0a (i).
   Open question #13 added.

3. Line 516 — Open question #11 escalated to Phase 0a (ii). If
   syncOpenClawSkills is keyed only on accountId and multiple
   agents share that, per-agent install scoping is a real backend
   change, not a parameter add. Phase 4 may split into 4a/4b.

4. Line 461 — Phase 0b verification rewritten to be skill-free
   (uses acpx_run to invoke pandoc directly) since pandic-office
   doesn't ship until Phase 1. Full skill-loop verification moves
   to end of Phase 1.

5. Line 348 — Inline [×] UX. Committed to per-agent reprovision
   endpoint as the target with "Queued — applies on next
   reprovision" wording as acceptable v1. Eliminated misleading
   "removing on next sync" copy.

6. Line 373 — Configure drawer permissions. Flipped default to
   admin-only after review feedback. Per-field "visible to
   members" is explicit opt-in; Memory tab is never member-
   readable in v1 (ADR-003 §Visibility). Added Invariant 7.

7. Line 227 — Live GitHub stars. Moved from client-side direct
   fetch (60/hr unauth limit, no token in browser) to server-side
   proxy endpoint with TTL cache. Failure mode: ★ — with tooltip.

8. Line 469 — Phase 5 deletion gate. Replaced "no fallback
   complaints" with concrete <N hits/week telemetry threshold on
   redirect path. ~5 lines added to Phase 3 scope.

Plus Invariant 8 making Phase 0a prereqs non-optional, Open
question #12 on workspace-helper extractability, and PR estimate
widened from ~5 to 5–7 to reflect Phase 0a (ii) uncertainty.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>

* docs(adr): ADR-013 v5.5 — call out acpx_run deprecation + ADR-005 composition

Per CLAUDE.md and ADR-005 Stage 3, acpx_run is being phased out in
favor of A2A-via-DM (agent-to-agent delegation through 1:1
agent-rooms) using wrapper agents like sam-local-codex.

ADR-013 doesn't block on the deprecation — it makes it easier:

- commonly_attach_file is correctly placed at the kernel layer
  (CAP verb), not in any specific runtime. Wrapper agents speaking
  CAP get file-attach for free.

- Phase 0b's acpx_run smoke test is a pragmatic bootstrap using
  the path that exists today. The shape of the test re-runs
  unchanged when ADR-005 Stage 3 completes.

- Default skill bundles in Part 3 are runtime-agnostic by
  construction — SKILL.md instructs the model to invoke binaries;
  the agent decides how to actually run them (acpx_run today,
  wrapper-agent local subprocess tomorrow).

Added §"Relationship to ADR-005" parallel to the existing ADR-001
relationship section. Listed ADR-005 in the companion header. Added
a bullet in §"What this unlocks" calling out that ADR-013 reinforces
ADR-005 Stage 3 rather than competing with it.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>

---------

Co-authored-by: Claude Opus 4.7 (1M context) <[email protected]>
samxu01 added a commit that referenced this pull request May 4, 2026
…291)

All three load-bearing prereqs ran as a research spike. Verdicts:

(i) SHA256SUMS — ✅ Available. iOfficeAI/OfficeCLI v1.0.70 publishes
    the artifact at github.com/.../releases/download/v1.0.70/SHA256SUMS
    (710 bytes). Use upstream verification path.

(ii) Per-agent skill scoping — ❌ Deeper backend change required.
     Three surfaces all need work:
       1. backend/routes/skills.ts:279-307 — store agent metadata
          but drop agentName when calling sync hook
       2. backend/services/agentProvisionerService.ts:424-549 —
          syncOpenClawSkillsLocal queries ALL pod skills, ignores
          per-agent scope. buildScopedSkillKey exists but is unused
          in the sync path
       3. ${WORKSPACE_ROOT}/${accountId}/skills/ — accountId uses
          instanceId only for openclaw (collision-prone); import
          path bypasses resolveOpenClawAccountId
     Phase 4 splits into 4a (frontend) + 4b (backend). PR estimate
     finalized at ~7.

(iii) Workspace-boundary helper — ⚠️ Helper at path-policy.ts:105
      is high quality (rejects .., resolves symlinks, cross-platform)
      but NOT exported from plugin-sdk. ~10-line export refactor
      absorbs into Phase 0b. Surprise: acpx_run has zero path
      validation today. Recommendation: defer hardening — ADR-005
      Stage 3 is retiring acpx_run anyway. Track deprecation timeline;
      revisit if it slips past 90 days.

Closes open questions #1 (yes, import does push to PVC; the per-agent
scoping inside that path is what's missing), #11, #12, #13. Adds
new question #14 (acpx_run hardening — defer).

Updated §"Relationship to ADR-005" naming note to reflect that
commonly_open_dm + agent-dm pod type both shipped (per CLAUDE.md
update). A2A-via-DM is now two shipped primitives, not just the
wrapper-agent pattern.

Co-authored-by: Claude Opus 4.7 (1M context) <[email protected]>
samxu01 added a commit that referenced this pull request May 24, 2026
…); 2 Phase-4 findings

Phase 2 restart on new branch:

- Claude (sam-local) shipped a complete docs/local-dev/credentials.md
  runbook + .env.example restructure as text-to-commit at 6:34 PM
  (before the prior close-out cron exited). Path/recipe needs minor
  adjustments before commit. Routed to Theo/Cody/Nova for paste +
  push, with 30-min claim-the-orphan timer.
- Phase-4 #10 added: monitor cron should not stop the instant a
  stop condition hits — run one more tick after delay to catch
  long-tail in-flight responses. Claude's 2.E delivery would have
  been picked up on tick T+102min if I hadn't cancelled at T+97.
- Phase-4 #11 added: Claude (CLI-wrapper) writes principles to its
  OWN claude-code memory store (~/.claude/projects/...), NOT
  Commonly's agentmemories collection. Direct mongo query confirms
  theo/nova/cody have 0 rows in agentmemories. Cross-agent memory
  continuity doesn't work for CLI wrappers — compounds with #6
  (MCP tools not loaded).

No branch commits on phase-2 yet. 12-min monitor cron 88af22d0
armed.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
samxu01 added a commit that referenced this pull request May 24, 2026
…ew findings

Phase 2 tick R2:

- Cody shipped 3fa0565 (docs(development): add local credentials
  runbook), +180 lines, all 3 triage adjustments correct. Also added
  COMMONLY_LOCAL_CLAWDBOT=0 forward-looking gate to .env.example.
- Cody actually used commonly_save_my_memory — DB row confirmed at
  agentmemories.findOne({agentName:'codex',instanceId:'cody'}),
  schemaVersion 2, captures both principles + Sam's working style in
  sections.long_term.content.
- Phase-4 #11 (memory unused) was partly wrong — codex writes to
  shared layer, claude doesn't (different runtime adapter).

Three new Phase-4 findings:

#12: commonly_save_my_memory daily-section schema mismatch — tool
input contract vs backend validator disagree on date format (must
be YYYY-MM-DD). Real bug, one-line fix + GH issue worthy.

#13: per-agent memory access asymmetry within same runtime — Theo
says he can't access shared memory, Nova says she can, both
openclaw moltbots. Either tool registry varies per agent or one is
confused.

#14: openclaw moltbot workspace isn't a git worktree — Theo couldn't
commit Claude's 2.E draft because /workspace/theo isn't a git repo.
Cloud-codex (Cody) has it via boot script; openclaw provisioner
should do the same. Explains why Cody dominates commit count.

Stop condition technically met (≥2 PR drafts) but pushing one more
tick to invite Cody to take 2.A/B/C/D — the clawdbot bundle is the
original headline pain point.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
samxu01 added a commit that referenced this pull request May 24, 2026
… all 3 agents

Cron R3 corrects two earlier mis-reads + logs major new findings:

- Theo claimed A+B+D bundle ('I'll take A+B+D as a bundle, and I'll
  coordinate C as a separate openclaw PR/submodule bump'). No code
  pushed yet; workspace-not-git-worktree blocker may still apply.
- Direct mongo query: ALL 3 agents have agentmemories rows. Theo
  (rev=undefined, 2223 chars, 06:18:28Z) and Nova (rev=2, 3148 chars,
  06:30:20Z) wrote via OpenClaw heartbeat-cycle auto-writes; Cody
  (rev=0, 602 chars) via the commonly_save_my_memory MCP tool.
  Phase-4 #11 was wrong — memory IS exercised by all 3, via
  different paths.

Two new Phase-4 findings:

#15: openclaw moltbot memory is heartbeat-only-write, stale during
interactive sessions. Theo/Nova memory contents are heartbeat-cycle
telemetry from 2026-05-20/21, not today's huddle content. Their
chat-turn tool registry doesn't include commonly_save_my_memory.
Possible Commonly improvement: heartbeat cycle should optionally
ingest conversational gravity from recent pod activity into long_term.

#16: shared agent memory may leak routing PII across agents. Nova's
memory contains SamCodexDmPodId — a 1:1 DM pod between Sam and
sam-local-codex. Today agentmemories is per-agent-private so no
leak, but if cross-agent memory ever becomes a collab feature,
routing pointers (DM pod IDs, etc.) need sanitization.

Claude refined Phase-4 #11: 'the commonly_* MCP server loads for
OpenClaw + Codex wrappers but not for Claude wrappers'. Partial
truth — moltbot heartbeat writes work, but moltbot chat-turn
doesn't have the tool either. The Claude-wrapper gap remains.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
samxu01 added a commit that referenced this pull request May 24, 2026
…e 2 ~80%

Cron R4 epilogue (stop condition firmly hit):

Cody resolved the Theo+Nova claim collision by shipping all of
Phase 2.A + 2.B + 2.D in a single comprehensive commit 3d398ab
(+812 lines, 4 files) while the others were still acknowledging.

What landed in 3d398ab:
- docker-compose.dev.yml: Dockerfile.commonly → Dockerfile default
  on both clawdbot compose services (Phase 2.B, 2-line change)
- dev.sh: +71 lines — read_env_value / is_truthy_env_value helpers
  + COMMONLY_LOCAL_CLAWDBOT=1 gating on the clawdbot profile (2.A)
- cli/src/commands/dev.js: +593 lines — new `commonly dev clawdbot`
  bootstrap subcommand: login → pod → install moltbot → harvest
  runtime token → write external/clawdbot-state/config/moltbot.json
  with controlUi flag → drop OPENCLAW_USER_TOKEN +
  OPENCLAW_RUNTIME_TOKEN into .env (Phase 2.D)
- cli/__tests__/dev.test.mjs: +148 lines NEW regression test file

Cody's session total: 5 code commits across PR #434 + phase-2.
Theo + Nova: 0 code commits between them.

The standout signal of the session: in this multi-agent setup,
cloud-codex (Cody) is the sole implementer; openclaw moltbots add
review + coordination value but can't ship code today. Captured in
Phase-4 #14 (workspace gap) + #6 + #11 + #15 (tool registry gaps).

Final Phase 2 state:
  ✅ 2.E shipped (3fa0565)
  ✅ 2.A+B+D shipped (3d398ab)
  🟡 2.C openclaw bundled-skills upstream — cross-repo, needs Sam
  📐 ADR-2.F implementation — design complete, code natural-next-sprint

Cron 88af22d0 cancelled. Phase 2 ~80% complete.

Total Phase-4 affordance findings: 17. Memory entries written: 2
(feedback-agents-collab-execute-not-handoff,
feedback-claim-the-orphan-stalled-peer-work).

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
lilyshen0722 added a commit that referenced this pull request Aug 4, 2026
* docs: ADR-016 + ADR-017 full drafts, reviewer checklist

Replaces the ADR-016/017 stubs merged in #775 with the full drafts, and
adds the incident-derived reviewer checklist assembled during milestone
#11.

ADR-016 (pod model and visibility) — kind x visibility tier x joinPolicy
over the existing flags, no schema change. 7-state reachable enumeration,
migration for the unrepresentable state, and an Enforcement gaps section
verified against origin/main: 4 of 5 read surfaces consult the visibility
tier; GET /api/agents/runtime/pods does not, and still returns
latestSummary for non-member pods.

ADR-017 (attention routing) — judge divergence + static irreversibility
feeds, escalation envelope with required typed evidence, needs-you card
with four lifecycle-visible faces, in-pod first. Budget sized against
EEMUA/ISA-18.2 rates (source-verified, with the transfer caveat stated).

docs/development/review-checklist.md — 13 reviewer rules, each carrying
the incident that earned it.

Both ADRs are Proposed, not Accepted; ratification is Sam's.

Co-Authored-By: Claude Fable 5 <[email protected]>

* docs: ADR-016 — fix agent-admin reachable states, align joinPolicy migration

Both from sprint-review's #792 pass, re-verified against origin/main:

agent-admin is in NON_LISTABLE_POD_TYPES and refused by both visibility
writers, so calling it a plain room overstated the enumeration — states
3-6 are unreachable for it. Adds a third derived kind (admin-room):
terminally private like a DM, for a different reason (listability, not
cardinality). Total reachable states 7 -> 8.

Migration step 3 normalized null joinPolicy to invite-only while the
schema and creation path default to 'open'. Corrected to 'open': the
narrowing lives in the tier (self-joinable <=> community AND open), so a
private pod with joinPolicy 'open' is still not self-joinable, and the
migration should not be the one writer that disagrees with the schema.

Co-Authored-By: Claude Fable 5 <[email protected]>

* docs: ADR-017 — authority boundary as primary trigger, per corpus labelling

sprint-review labelled this pod's own unattended run (238 messages, four
agents, four days): 15 warranted interrupting a human (6.3%), sustained
0.16/hr, peak 31/10min raw vs 5/10min filtered.

The finding that changed the design: "escalate on irreversibility" caught
zero of fifteen. The dominant class (8/15) is not misbehaviour at all —
an agent correctly finishing and hitting a wall only the human can pass.

So the primary trigger is structural, not behavioural: has this agent
reached a boundary it cannot cross? The system already knows, because the
boundary is the permission set — a query, not an inference, and it covers
the largest class with no model.

- new Layer 0 recording the corpus, the four observed classes ranked, and
  the caveat (n=15, one pod, one decision-maker)
- authority boundary promoted to primary feed, with evidence typed as
  { boundary, artifact, availableTransitions } so cards name the decision
- irreversibility kept as a safety net, with its zero-fire record stated:
  unbounded false-negative cost, bounded false-positive cost
- envelope feed/class enums updated to the observed taxonomy

Co-Authored-By: Claude Fable 5 <[email protected]>

* docs: AX audit log + sharpen ADR-017's irreversibility caveat

The zero-irreversibility caveat now states the labeller's own distinction:
this corpus had no delete/spend/send permissions in play, so the zero is
strong evidence that irreversibility is the wrong PRIMARY trigger and weak
evidence about its firing rate where agents hold destructive capability.
The zero measures the permission profile, not the mechanism's worth.

Adds docs/development/agent-experience-audit.md — the AX findings Sam
asked the sprint agents for, which were accumulating only in pod chat.
Four entries: the docstring is the interface; permitted verdicts are
undiscoverable until refused; silent success and silent failure look
identical; pod prose is not delivery.

Recurring shape: an agent's model of the system comes almost entirely from
names, docstrings and error messages. Where those lie or stay silent, it
forms a confident wrong model — with no visual channel to correct it.

Co-Authored-By: Claude Fable 5 <[email protected]>

* docs: bidirectional attention channel, #793 verified, AX entry 5

ADR-017 gains "the channel is bidirectional" — the missing inverse of
everything else in it. Routing so far is agent -> human; the 2026-08-01
incident is system -> agent: the disclosure was fixed, merged, deployed
and verified, and the pod was never told, so four agents kept planning
around an exposure closed an hour earlier.

Recorded as a principle, not a mechanism: an invalidation is not an
escalation (the trigger is "a fact you relied on changed", which is
observed class 3 pointed the other way — one mechanism, two directions),
and its cost is silent and asymmetric (a missed escalation stalls one
agent visibly; a missed invalidation leaves every agent producing
correct-looking work over a dead premise). Explicitly do NOT build a
subscription system: n=1 is not a mandate for a dependency graph. Notes
that `basis` is already this signal read from the other end.

ADR-016's enforcement-gap table updated against origin/main: #793 closed
the gap by composing COMMONLY_LISTING_QUERY with the caller's authorized
pods. Residual divergence recorded — it uses the flags-only fragment, not
communityDiscoverQuery, so invite-only listed pods appear on the agent
surface while excluded from the human one. Not a leak (all publicRead),
but the route's own comment claims it cannot drift, and it still differs.

AX audit: entry 5 (nothing tells an agent its premise expired), entry 1
marked closed by #793.

Co-Authored-By: Claude Fable 5 <[email protected]>

* docs: ADR-016 — surface parity is the rule, H5 is the exception-point

ux-lead's design call on the #793 residual, replacing the either/or I
left open. The agent discovery surface adopts communityDiscoverQuery
rather than the flags-only fragment: a comment asserting parity over a
query that diverges is a phantom-contract seedling watering itself.

The "agents should see request-access-able rooms" case is real but is the
H5 case, and the 2026-07-29 dead-end ruling applies to agents equally — a
discoverable row with no available action yields a 403 whose only use is
relaying confusion, and that 403 is not machine-readable as "requestable
later" either.

Rule recorded: divergence between the human and agent visibility surfaces
must be a decision with an affordance attached, never a side effect of
which query constant a route imported.

Co-Authored-By: Claude Fable 5 <[email protected]>

* docs: ADR-016 — parity is per-clause; "adopt the builder" was wrong

sprint-review caught a defect in the rule committed one commit earlier.
"Adopt communityDiscoverQuery on the agent route" treats three clauses as
one decision; only the joinPolicy clause belongs there.

- listing flags: shared (the visibility tier itself)
- joinPolicy $ne invite-only: adopt — a row with no available action is a
  dead end for either reader, and the 403 isn't machine-readable as
  "requestable later"
- members $ne callerId: never — the surfaces have different jobs, and it
  is subtly unsafe here: the route's second $or branch keys on
  installations, not membership, so a pod the agent is a member of
  without an active installation would be excluded by the clause and not
  restored by the branch

Shared unit is therefore a fragment (flags + joinPolicy) that both
surfaces compose, each adding its own caller clause — the same lesson as
the original fragment/builder split, one level down.

Urgency recorded as none: 3 community-listed pods, 0 invite-only, so the
divergence is theoretical and a test would pass vacuously today. Revisit
trigger is H5 landing, when joinPolicy drops from both surfaces together.

Co-Authored-By: Claude Fable 5 <[email protected]>

* docs: ADR-017 — fix seven inconsistencies from the end-to-end read

sprint-review's full pass (PR #792 review 7) found seven locally-correct
edits that had stopped agreeing with each other. All were introduced by
incremental rewrites and none were caught by incremental review.

1. Judge's class enum conflated two taxonomies. The judge cannot detect
   authority-boundary or deadlock — those come from the no-model query
   feed. Judge now emits divergenceClass (scope-expansion, target-change,
   abandonment, other); the envelope's top-level class carries the
   observed taxonomy, with a comment stating they are never merged.
2. "Both feeds" / "two feeds" -> three feeds, four routing inputs.
3. Ratification point 3 asked Sam to ratify a "four-class taxonomy" that
   no longer exists. Now names both taxonomies explicitly.
4. Override statistic appeared as both 49-96% (pre-verification) and
   46-96% (verified). Unified on the verified figure.
5. "Two-tier staleness rule:" lead-in survived the unification that
   replaced it with one rule.
6. "Latest human word wins" contradicted "re-binding is ordinary agent
   behavior". The latter is correct and verified in code; corrected to
   ordering-not-identity, with an explicit warning never to write a
   human-only gate since no issuer field exists to build it on.
7. Deadlock listed under class-1 instances; it is class 4.

Co-Authored-By: Claude Fable 5 <[email protected]>

* docs(ax): entry 6 — a documented call shape the tool cannot express

The heartbeat instruction directs agents to append cycle takeaways via
commonly_save_my_memory with a nested { append: { content } } payload.
The deployed tool schema accepts only content (string) or entries
(array) with additionalProperties: false, so no reachable argument shape
produces it; all three forms 400 with the server naming a payload the
tool cannot emit. `cycles` is also absent from the tool's own documented
section list.

Three surfaces describe the same capability differently — scheduler
instruction, tool schema, server validator — and only the last is
authoritative.

Co-Authored-By: Claude Fable 5 <[email protected]>

* docs(ax): entry 7 — directives and arguments share one identity

The orchestrating assistant posts under the operator's account, so
"take #795 next" and "here is my read of the taint path" arrive in one
voice. Agents defaulted to treating both as directives, which is correct
when they cannot be told apart — and a technical claim propagated two
review cycles unchecked, then landed misattributed in a PR approval that
is now the durable record of a design choice.

A directive should be followed; an argument should be checked. Identity
is the only signal an agent has, so where one identity carries both, the
weaker treatment wins by default. Interim protocol recorded pending
per-seat identities (#791).

Co-Authored-By: Claude Fable 5 <[email protected]>

* docs(ax): entry 7 — correct its own byline, record the cascade

The entry about misattribution-through-shared-identity was itself
misattributed: filed crediting ux-lead, who declined it. The content came
from the orchestrating assistant posting under the operator account
(52211).

sprint-review's log check found the full cascade: 52204 (operator
account) -> credited to pod-architect -> declined -> re-credited in a PR
approval because the declination never arrived -> refiled here against a
third wrong seat. Four misattributions in one incident, among
participants actively trying to attribute correctly, one inside the
document describing the problem.

Corrected, the entry is self-demonstrating rather than self-refuting: no
amount of diligence substitutes for a distinguishable identity.

Co-Authored-By: Claude Fable 5 <[email protected]>

* docs: land the four pointer edits the checklist header promised

review-checklist.md opened with a "Lands with (pointer edits, same PR)"
line naming four edits that were never in the diff — the doc introducing
rule 7 (phantom cross-layer contract) shipped as one: a header promising
that another file provides something, with nothing holding the two
together. All four now exist:

- docs/development/README.md — index rows for the checklist and the AX log
- REVIEW.md — context-loading step 6 citing §7; two-checklists note above
  the author checklist, so the name collision is broken from both sides
- CLAUDE.md — companion pointer beside the REVIEW.md required-reading line,
  plus an anchor for the AX audit
- CLAUDE.md — the NO_REPLY correction. Main read "it will be sent verbatim",
  wrong since PR #785: a bare sentinel in substantive content is stripped as
  producer leakage; backticked/fenced mentions survive; suppression stays
  total-match. Verified against sanitizeAgentContent and its test file, not
  against the prose that described it.

Also in the checklist: repair a mangled clause in rule 7, and record the
outer-transport-fence mechanic that makes the §9 tests read correctly.

AX entry 6 corrected. It concluded the cycles append was unreachable
through the tool surface; commonly_log_cycle has owned that verb since
ADR-012 Phase 4 (#308/#309), two months earlier. Re-probed both calls
today — every fact in the entry holds, the conclusion did not. The real
defect is narrower: the capability is owned by one tool and named by
another, and the 400 names the payload it wants without naming the tool
that can emit it.

Co-Authored-By: Claude Opus 5 <[email protected]>

---------

Co-authored-by: Claude Fable 5 <[email protected]>
lilyshen0722 added a commit that referenced this pull request Nov 12, 2026
…ilure path; plainer zh wording (F370 #11)

From the gate review: drift between the CLI, model and Settings lists failed
quietly, the F336 returned-failure path had no test, and the zh
model-unavailable line read as translated.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01MDs9DPXBiwPK6RMAX2e277
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant