Skip to content

External-system observability: unified PM + queue + quota attribution (webhooks, hot list, session IDs, projections) #2072

Open

Description

@dezren39

Problem (owner direction, 2026-10-28)

Work is steadily moving off the main agent onto other systems that spend their own tokens under direction — the OpenCode fleet, OpenClaw-originated sessions, Codex/ChatGPT, Jules and other external agents. Direction stays centralized (adjust cadences, add/remove scheduled tasks, tell a persistent agent what it is doing right or wrong and let it fix itself), which saves main-agent tokens. The cost: the main agent no longer directly knows what those systems did. Today the record is scattered across GitHub, the queue DB, session stores and quota files, with no single place to answer "what happened, who did it, what did it cost, and was it any good."

This issue is the design + build tracker for closing that gap.

Requirements

1. The PM stack and the queue must be available TO the external systems

Not just readable by the owner: the delegated systems themselves need to read queue state and report outcomes into the PM stack, so their work lands in the shared record as it happens instead of being reconstructed later.

2. Detect what happened OUTSIDE the system

Anything a delegated system does that bypasses the queue/PM record is currently invisible. Close this with webhooks: for every system/repo that can emit them (GitHub first), deliver events into an ingestion point that maintains a hot list of everything created or changed since the last check — issues, PRs, comments, edits, commits. The checking/triage systems then sweep the hot list and flag anything that was not expected (not traceable to a queue item, a schedule, or a directed task).

3. PM stack + queue: one integrated view

Merge or closely integrate the two so the owner can see, in one place:

  • what is queued, and in what order;
  • what has been picked up, and by which system;
  • stats, metrics, graphs and trends over token usage, model selection, plan quotas, and all scheduled jobs.

4. Per-job / per-model outcome attribution

For each job (and model) the system should be able to say: "this job with this model made 2 PRs, closed 1 issue, created 3 issues, commented on these issues" — counting at least: issues/PRs created, commented on, descriptions edited, commits to branches — with every aggregate linking back to the exact issues, PRs and comments behind it.

5. Universal session identity

Every unit of delegated work carries a traceable ID:

  • OpenCode already has session + parent-session IDs — use them as-is (session uploads/digests already preserve child-session lists and model switches).
  • OpenClaw origination of an OpenCode session needs a recorded mapping (which OpenClaw context started which session).
  • Systems whose internals we do not control (ChatGPT/Codex and similar): pull actual IDs from a weekly ChatGPT export; where no native ID exists, workers get an assigned ID when they pick up a queue job and reuse it across subsequent items.
  • The same applies to the main agent itself: when it takes an item from the system it is told its session ID (or presents one it already holds), so its work is attributed the same way.
    Sessions tie to: exact model(s), the system of origin, token usage where measurable (exact where the platform records it, absent where it cannot), and the quota series (item 7) — so a change to a job can be followed to its effects on quotas and outcomes.

6. Quality linkage

  • PRs can be marked reverted or had to be redone, with links to the redo.
  • A bug can be tied to the multiple PRs that contributed to it existing.
    Together with item 4, this is how we find out what is actually causing bugs — which jobs/models/systems produce work that sticks vs work that gets reverted — and the UI should make that analysis easy.

7. Quotas in the same picture, with projections

  • The assistant's own subscription quota joins the PM pool list as a first-class entry: current percentage, total tokens per week, position in the window. (Data source exists: a 5-minute recorder landed 2026-10-28 — ~/tools/quota-recorder.py + the runtime token DB's per-message records; the laptop quota-gatherer already records the other pools every 15 minutes.)
  • For every quota: a few days of percentage history against its reset, and a projection — either "projected to end the window at X%" or "projected to hit quota on at ".
  • Projections are stored, and later compared with what actually happened, so modifiers/rules can be learned over time to make the predictions better.

Persistence principle

Not everything has to land in the database immediately — but everything must be written down somewhere persistent, with a system that gets it into a central location where it can be queried regularly.

Pieces that already exist (build on these)

  • PM aggregator + projector (laptop) with per-source health, comments/actions stores, quota-current and the monthly usage-snapshot JSONL.
  • The queue system (Supabase agent.tasks: packets, dedupe keys, lane claims, completions — completions currently record queue-level worker identity, not per-lane; see the 2026-10-28 token check-in findings).
  • The runtime token DB (agent.agent_message_token_usage + spawn metadata) — exact per-message tokens with cron attribution for everything on this platform.
  • OpenCode session digests (full session/child-session/model-switch records).
  • The 5-minute Muse subscription quota recorder + the laptop's 15-minute pool gatherer.
  • GitHub webhooks are available on all owned repos; the fleet-feed collector pattern is a working ingestion precedent.

Shape of the work (to be refined in design)

  1. Design note first: identity scheme (session/job/system), the attribution event model, webhook ingestion + hot-list store, and the integrated PM/queue/quota views. Record the design on this issue before building.
  2. Then implementation issues, one per piece, linked here: webhook ingestion + hot list; queue↔PM integration views; attribution rollups (per job/model/session); session-ID assignment at queue pickup + OpenClaw/Codex mapping; projection engine + accuracy tracking; Muse pool on the PM list.

Acceptance criteria

  • A design note is recorded on this issue covering: the identity scheme (session/job/system), the attribution event model, webhook ingestion + hot-list store, and the integrated PM/queue/quota views.
  • Implementation issues are filed, one per piece, and linked here (webhook ingestion + hot list; queue↔PM integration views; attribution rollups; session-ID assignment at queue pickup + OpenClaw/Codex mapping; projection engine + accuracy tracking; Muse pool on the PM list).
  • GitHub webhooks (first source) deliver issue/PR/comment/commit events into the ingestion point, and the hot list reflects everything created or changed since the last check.
  • The integrated view can answer, for a given window: what happened, which system/agent did it, what it cost, and its outcome — without hand-reconciling GitHub, the queue DB, and quota files.

Activity

  1. developing-today commented on Oct 29, 2026

    @developing-today
    Contributor
  2. added
    source/human
    status/needs-triage
    priority/high
    effort/l
    meta/enriched
    on Oct 29, 2026
  3. dezren39 commented on Oct 29, 2026

    @dezren39
    MemberAuthor

    Intake review

    Related: owner-direction tracker filed 2026-10-29 by dezren39; the fleet's existing queue signal/PM stack and the repo-queue helper are the integration substrate; the stewardship/orchestrator hot-list pattern named in the body is the ingestion precedent.

    Notes: this is a design-first tracker — step 1 in the body (design note recorded here before building) is the gate; the six implementation pieces should be filed as linked issues only after the design lands, per the fleet's nothing-sits-silently rule.

    Risks: scope is fleet-wide (multiple external systems); webhook delivery needs a reachable ingestion endpoint, which may gate the first piece.

    Suggested approach: design note first (identity + event model), then file the six linked implementation issues in the order listed in the body.

    — Fleet monitor intake pass (protocol §5): issue verified still live this run (filed within the last hour; no merged PR or duplicate resolves it), labels normalized, meta/enriched applied.

  4. dezren39 commented on Oct 29, 2026

    @dezren39
    MemberAuthor

    DREW DIRECTION (2026-10-29) — the OpenCode usage exporter: PULL from OpenCode's own history database. We have direct query access to that database and it is backed up on a routine basis; the exporter reads sessions/messages (model, tokens, cost, parentage) out of it on a cadence, the same pull pattern as the Muse runtime-db export — do NOT build push instrumentation into OpenCode/OpenChamber for this. One implementation fact from tonight's lane work: the live session data is in OpenChamber's MANAGED OpenCode instance store — the default-path opencode.db is stale (newest activity ~Oct 6) — so the exporter must target the live instance's database (and ideally notice if the instance's store ever moves). Aster's design (2026-10-29) makes this exporter the precondition for any measured OpenCode baseline: mirror_* tables cover Muse's runtime only.

  5. dezren39 commented on Oct 31, 2026

    @dezren39
    MemberAuthor

    Status — owner order 2026-10-28, stalled, re-queued 2026-10-31.

    This observability direction was given by Drew on 2026-10-28 (issue priority/high), but the issue never got a queue presence — no task row, no queue labels, no execution evidence in 3 days.

    Remediation (2026-10-31, Oct-28 left-on-the-ground audit): enqueued into repo-health-code-pilot as task 4722 (triage/design, priority 70, queued, attempts 0/3), verified by direct queue read; queue signal refreshed.

    The packet scopes the triage to what this issue needs first: sequence the seven requirements into landable slices, fully specify the first slice, and route it — not an attempt at the whole build in one task.

  6. added
    work/assigned
    queue/claimed
    status/in-progress
    and removed
    status/needs-triage
    on Nov 2, 2026
  7. 104 remaining items

  8. developing-today-fleet commented on Nov 29, 2026

    @developing-today-fleet
    Contributor

    Census 2026-11-29 (Felix): full re-read (body, labels, all comments, native edges) in the CODE-6 recovery pass.

    STRENGTHS: complete tracker with child states maintained in-thread.
    GAPS: none material.
    FIXES I APPLIED: none needed — status/in-review reflects the tracker's review state; note this issue is also the recorded wake-gate for parked queue work on #15339 (task 23871 wakes when #2072 closes), so its close-out should be deliberate when the last child lands.
    REMAINS: close when its remaining children land; no Drewry decision needed.

  9. developing-today-fleet commented on Nov 29, 2026

    @developing-today-fleet
    Contributor

    Issue census — 2026-11-29

    Wave-2 census pass (group code-01409-03205): rechecked live state, body, labels and recent comments firsthand via fleet gh immediately before editing.

    Strengths: detailed body (7049 chars) with context a picker-up can start from; acceptance criteria present in the body; single taxonomy priority band (priority/high) — verified against live labels; kind label present (kind/enhancement).

    Gaps found: none material.

    Actions taken this pass: labels: +['status/needs-review'] -['status:in-review'].

    Priority: priority/high — checked against content, unchanged (no reprioritization). No closing keywords used; issue left open.

  10. developing-today-fleet commented on Nov 29, 2026

    @developing-today-fleet
    Contributor

    agent-note:v1
    event: picked_up
    by: agent felix (kind muse, lane 0640-BB)
    at: 2026-11-29
    task: #2072 next slice per the 2026-11-26 recheck + 2026-11-29 census: file the slice-5 child issue (queue-pickup session identity + OpenClaw/Codex mapping, requirement 5) with its queue packet, grounded in what already exists on main (#9075/#9073 session-state work), and link it here.
    Found via: fleet agent next (priority rung; queue rung down, #16762 flap — claim rests on this comment).

  11. developing-today-fleet commented on Nov 29, 2026

    @developing-today-fleet
    Contributor

    agent-note:v1
    event: progress
    by: agent felix (kind muse, lane 0640-BB)
    at: 2026-11-29

    Slice 5 filed and routed. Per the 2026-11-26 recheck (task 24355) and the 2026-11-29 census, the next slice of this tracker is now a child issue: #16909 — universal session identity: queue-pickup assignment + OpenClaw/Codex mapping (req 5), following the slices 2–4 pattern (#5204/#7078/#10910). Its triage is enqueued as queue task 26456 (repo-health-code-pilot): record the design spec on #16909 reconciling #9075/#9073 and the slice-1 exporter, scope the req-5 remainder, and route the first landable piece.

    Slices 1–4 stand delivered (slice 4 #10910 closed; PRs #13022/#13065). Remaining after slice 5, per the body's shape-of-work list: quality linkage (req 6) and projection engine + accuracy tracking / Muse pool on the PM list (req 7) — each gets its own child when slice 5 routes. This tracker stays open. Priority validation 2026-11-29 (Felix): priority/high confirmed correct — owner-direction tracker, and the recorded wake-gate for parked queue work on #15339 (task 23871); no change.

  12. developing-today-fleet commented on Nov 29, 2026

    @developing-today-fleet
    Contributor

    agent-note:v1 — slice 5 routing progress (lane 0640-AZ, triage task 26456, 2026-11-29).

    Slice 5 (universal session identity, req 5) now has its design spec recorded on its child issue #16909 (comment 7259918258). Headline of the reconciliation: most of req 5 already exists — the #9075 session substrate (FLEET_SESSION_ID + .fleet-session-id pwd-file), the slice-1 exporter (PR #4680), the claim path's session binding into repo_task_lane_ledger.session_id, and the slice-4 session-keyed rollups (#10910). The exact remainder is three pieces: (R1) pickup assignment for session-less workers, whose claims leave ledger.session_id NULL today; (R2) the OpenClaw → OpenCode origination mapping; (R3) the ChatGPT/Codex weekly-export ID pull.

    First piece routed: queue task 26459 (repo-health-code-pilot, small_fix) implements R1 — a worker_session_assignments record in the queue DB, minted once per worker and reused across its claims, written by the claim path when no native session is bound. R2/R3 follow as separate packets after R1 lands. #16909 stays open as the slice's home until the routed implementation lands.

  13. developing-today-fleet commented on Nov 29, 2026

    @developing-today-fleet
    Contributor

    🤖 Lane 0640-V (Felix) — draw disposition. Premise check: #2072 is the external-system observability design+build tracker (five requirement areas: PM/queue availability to external systems, webhook hot-list ingestion, integrated view, per-job/per-model attribution, universal session identity), status/needs-review, effort/l. Its remaining work is programme-sized design/build slices that need the review outcome recorded on the issue, not a one-lane feature slice; it is also the standing gate for #15339 (task 23871 parked on issue_closed 2072 by lane 0640-P today). No bounded ungated slice taken; returning the draw so the ladder can surface startable work.

  14. developing-today-fleet commented on Nov 29, 2026

    @developing-today-fleet
    Contributor

    Slice 5 status update — Felix lane 0640-DX, 2026-11-29 (supersedes the 17:43Z routing-progress note as the current state):

  15. developing-today-fleet commented on Nov 29, 2026

    @developing-today-fleet
    Contributor

    agent-note:v1 — lane 0640-FM premise check (2026-11-29): drawn via fleet agent next; standing down. Slices 0–4 all landed (slice 4 = #10910, CLOSED with PR #13065 merged); the tracker is queue/parked and its parked task's wake is issue_closed #14162. No unowned bounded slice remains on this tracker itself. Priority validation 2026-11-29 (Felix): priority/high stands (epic holding the observability programme; band unchanged).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    design/executor-expansioneffort/lepic/pm-stackkind/enhancementmeta/enrichedpriority/highqueue/parkedsource/humanstatus/needs-reviewtask/triage

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions