Skip to content

feat(web): add bounded cockpit aggregate routes - #2793

Merged
Sinity merged 10 commits into
masterfrom
feature/fanout/web-cockpit
Jul 13, 2026
Merged

Sinity merged 10 commits into
masterfrom
feature/fanout/web-cockpit

Conversation

@Sinity

@Sinity Sinity commented Jul 12, 2026 •

Copy link
Copy Markdown
Owner

Summary

Add privacy-safe, bounded web-cockpit read contracts and switch the live reader to consume them. The landing now loads one overview aggregate; the transcript evidence strip loads one structural evidence summary; session opening fetches metadata plus a capped message page instead of a full transcript response.

Ref polylogue-bby.17
Ref polylogue-nhjs

Problem

The cockpit landing stitched broad status and session-list payloads client-side, provider-usage and archive-debt HTTP responses inherited absolute archive paths from operator DTOs, and the evidence strip downloaded the full work-event insight timeline to compute three chips. Opening a session also crossed the HTTP boundary with every message, making response size grow without a declared cap.

Solution

  • Add GET /api/overview with SQL-backed session/message/origin totals, whitelisted readiness, explicit snapshot freshness, and at most six recent summaries.
  • Add GET /api/sessions/:id/evidence-summary with tool-use-block counts, action-view ok/failed/unknown outcomes, cost projection, and at most twenty lineage refs.
  • Project /api/provider-usage and /api/archive-debt through an HTTP privacy boundary that removes archive_root and redacts configured and symlink-resolved archive paths in nested caveats/errors.
  • Add ?shape=summary for session metadata and make the live reader pair it with a server-clamped /messages?limit=100&offset=0 page.
  • Publish both route contracts in generated OpenAPI.
  • Keep pure legacy-shape render adapters only for isolated visual harnesses; the live reader fetches the new bounded routes.

Acceptance criteria

polylogue-bby.17

  • Satisfied: normal provider-usage and archive-debt responses omit configured paths, resolved symlink targets, and path-bearing caveat/error text while the underlying CLI/operator DTOs stay unchanged.
  • Satisfied: one bounded overview request returns totals, readiness with explicit unknown/stale snapshot state, origin counts, and six recent summaries without archive-wide session hydration.
  • Satisfied: one bounded evidence request returns structural tool calls and action outcomes plus cost and capped lineage refs.
  • Satisfied: the cockpit consumes overview/evidence aggregates and no longer downloads full insight events solely for header chips; existing route-failure machinery handles authenticated/degraded HTTP failures.
  • Satisfied: route catalog, OpenAPI, focused HTTP/privacy tests, full reader visual smoke, Playwright reader journey, and quick gate are covered.

polylogue-nhjs

  • Satisfied in this slice: live session payloads are bounded at the HTTP boundary; message limits are server-clamped and negative offsets normalized.
  • Deferred on the existing bead: keyset cursors, server-side non-hydrating message windows, DOM virtualization, deep-anchor page seeking, and bounded stack/compare/overlay projections remain open. This PR does not claim full polylogue-nhjs completion.

Verification

  • devtools test tests/unit/daemon/test_web_reader.py -k 'overview or evidence_summary or operational_web_payloads or session_detail'
    • 8 passed
  • devtools test tests/visual/test_evidence_cockpit_ia_smoke.py
    • 9 passed in 6.46s
  • devtools lab smoke run reader-visual-smoke --json --report-dir .local/visual/reader-smoke
    • 38 passed in 114.84s
  • npm run test:e2e -- --reporter=line
    • primary real-browser reader/auth journey passed; the auth timing case initially observed automatic credential reissue after clearCookies()
  • npm run test:e2e -- --reporter=line -g 'missing, expired, revoked'
    • exact rerun: 1 passed (11.0s)
  • devtools verify --quick
    • format, lint, mypy, generated surfaces, topology, layering, schema roundtrip, manifests, and degrade-loudly all ok

Anti-vacuity

  • The path-redaction test boots the production daemon and invokes the real provider-usage/archive-debt operations against a missing index through a symlinked configured root. Removing the HTTP projection leaks either the configured path or resolved target and fails the sentinel assertions.
  • The overview test boots the production daemon over a real split archive and exercises ArchiveStore counts and summaries through /api/overview. Removing the route, aggregate query, or fixed recent cap fails the HTTP/shape assertions.
  • The evidence test writes a real parsed tool-use/result pair, sets the structural tool_result_is_error and exit-code columns, and reads through the production actions view over HTTP. Removing the structural action query or changing failed/unknown classification makes it fail.
  • The visual smoke executes extracted production JavaScript and the real reader DOM contracts. Removing aggregate consumption or breaking isolated render dependencies fails the evidence/landing journeys.

Sinity and others added 3 commits July 12, 2026 23:05
Expose privacy-safe archive overview and per-session structural evidence summaries for the web cockpit. Load session metadata plus a capped message page so long transcripts no longer cross the reader boundary as one unbounded response.

Keep rich path-bearing diagnostics on CLI and operator models while projecting configured archive paths out of normal provider-usage and archive-debt HTTP responses.

Ref polylogue-bby.17
Ref polylogue-nhjs

Co-Authored-By: Claude <[email protected]>
Regenerate the daemon OpenAPI route catalog for the bounded cockpit overview and per-session evidence-summary endpoints.

Ref polylogue-bby.17
Ref polylogue-nhjs

Co-Authored-By: Claude <[email protected]>
Preserve isolated visual-renderer compatibility while the live cockpit continues to fetch only the bounded overview and evidence-summary contracts.

Ref polylogue-bby.17
Ref polylogue-nhjs

Co-Authored-By: Claude <[email protected]>
@coderabbitai

coderabbitai Bot commented Jul 12, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

@Sinity, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 32 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 0544c572-e435-4f92-81ed-0e7ec329c444

📥 Commits

Reviewing files that changed from the base of the PR and between 901825e and cef1768.

📒 Files selected for processing (7)
  • docs/openapi/search.yaml
  • polylogue/daemon/http.py
  • polylogue/daemon/route_contracts.py
  • polylogue/daemon/web_shell.py
  • tests/unit/daemon/test_web_reader.py
  • tests/visual/test_evidence_cockpit_ia_smoke.py
  • webui/tests/first-party-auth.spec.ts
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/fanout/web-cockpit

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 8634843e79

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread polylogue/daemon/web_shell.py Resolved
Comment thread polylogue/daemon/http.py Resolved
Comment thread polylogue/daemon/web_shell.py Resolved
@Sinity

Sinity commented Jul 12, 2026

Copy link
Copy Markdown
Owner Author

Additional verification after the interruption checkpoint: devtools test tests/unit/daemon -k 'web or shell' completed successfully with 287 passed in 51.35s. The external Actions failures remain job-initialization failures with zero executed steps/logs across every workflow.

Keep long transcripts reachable through bounded message pages, preserve the original session id for detail retries, and classify contradictory structural outcomes once with failed precedence.

Ref polylogue-bby.17
Ref polylogue-nhjs

Co-Authored-By: Claude <[email protected]>
@Sinity

Sinity commented Jul 12, 2026

Copy link
Copy Markdown
Owner Author

Adversarial review — iteration 1

Findings and fixes:

  • Real gap: reader showed only the first 100 messages. Commit 87ff9fb26 adds append-only bounded page loading, progress UI, retryable page failures, and a production-JS regression journey proving the second page is reachable without duplicate rows.
  • Real gap: the detail retry parsed ?shape=summary as part of the session id. The same commit strips query parameters before decoding the retained id; the JS journey asserts the retry target.
  • Real gap: conflicting is_error/exit_code fields could count one action as both successful and failed. The evidence SQL now derives one mutually exclusive outcome with failed precedence; a structured conflicting-field regression test exercises the production actions view.

Verification: focused daemon route tests (3 passed), production-shell JS smoke (10 passed), and devtools verify --quick all passed. The subsequent push hook repeated the quick gate successfully. Known GitHub Actions initialization failures remain external.

Problem: the cockpit could render stale overview readiness as current, while
failed bounded evidence aggregates disappeared from the session header with
no recovery path.

What changed: render non-fresh overview snapshot state, age, and refresh
errors; render evidence aggregate route failures with retry that evicts and
reloads the per-session cache. Production-shell smoke tests exercise stale
metadata and 401, 409, and 503 retry cases.

Ref polylogue-bby.17
Ref polylogue-nhjs

Co-Authored-By: Claude <[email protected]>
@Sinity

Sinity commented Jul 12, 2026 •

Copy link
Copy Markdown
Owner Author

Adversarial review — iteration 2

Findings and fixes:

  • The landing ignored overview snapshot freshness, so stale readiness could look current. Commit b75abe3 renders non-fresh state, age, and refresh error.
  • Evidence-summary failures disappeared with no retry. The same commit renders route details and retries by clearing and reloading the selected aggregate cache.
  • Production-shell regressions cover stale overview metadata and 401, 409, and 503 aggregate failures.

What survived scrutiny: full nhjs server-side non-hydrating/keyset windows and client virtualization remain explicitly deferred; this PR does not claim them.

Verification: visual production-shell suite 14 passed; focused aggregate/detail routes 3 passed; devtools verify --quick and pre-push quick gate passed.

Problem: overview snapshot errors could reveal configured or resolved archive
paths, and the evidence header ignored the aggregate's bounded lineage refs.

What changed: apply the web privacy projection to overview diagnostics across
both archive-root representations, and render a capped lineage-ref count from
the evidence summary. Route and production-shell regressions cover both
paths.

Ref polylogue-bby.17
Ref polylogue-nhjs

Co-Authored-By: Claude <[email protected]>
@Sinity

Sinity commented Jul 12, 2026 •

Copy link
Copy Markdown
Owner Author

Adversarial review — iteration 3

Findings and fixes:

  • Overview refresh_error could expose configured or resolved archive paths. Commit f6981f4 projects overview diagnostics through the privacy boundary and uses a live-server configured-root plus symlink-root sentinel.
  • Capped evidence lineage_refs were returned but not rendered. The same commit renders their count in the evidence strip, covered by production-shell JavaScript.

What survived scrutiny: full nhjs keyset/non-hydrating/virtualization work remains an explicit deferred scope outside these owned files.

Verification: overview/privacy/evidence HTTP selection 3 passed; production-shell visual suite 15 passed; devtools verify --quick and pre-push quick gate passed.

Problem: evidence-summary counts treated an error flag as stronger than a
present zero exit code, diverging from the shared action parser.

What changed: classify present exit codes first, then use is_error only when
no exit code is available. Parameterized live-route tests cover both
conflicting pairs through the production actions view.

Ref polylogue-bby.17

Co-Authored-By: Claude <[email protected]>
@Sinity

Sinity commented Jul 12, 2026 •

Copy link
Copy Markdown
Owner Author

Adversarial review — iteration 4

Finding and fix:

  • Evidence classification let is_error override a present zero exit code, unlike the canonical action parser. Commit a6f4e59 makes exit code authoritative and uses is_error only when exit code is absent. The live route regression covers both conflicting pairs: (0,2) yields failed and (1,0) yields ok.

Verification: focused aggregate/privacy selection 5 passed in 148.07s with basetemp under /realm/tmp; the pre-push devtools verify --quick gate passed.

The independent reviewer found no further actionable defects after the correction. Full nhjs keyset/non-hydrating/virtualization remains explicitly deferred.

Problem: prefix-sharing session summaries retain divergent-tail counts while
the message route recomposes the transcript, leaving reader header counts
inconsistent with displayed messages.

What changed: use the bounded message page total for the reader-facing
message count. A production-shell regression exercises the summary/page
pair and fails if the reconciliation is removed.

Ref polylogue-nhjs

Co-Authored-By: Claude <[email protected]>
@Sinity

Sinity commented Jul 12, 2026

Copy link
Copy Markdown
Owner Author

Adversarial review — iteration 5

Finding and fix:

  • Prefix-sharing child summaries can carry a divergent-tail message_count while the message page returns the composed transcript total. Commit 1b80fb6 replaces the reader-facing count with the concurrently fetched page total, so header and Info counts describe the messages actually rendered. The assembled-shell regression starts with tail count 1 and page total 3; removing that reconciliation fails it.

Verification: devtools test tests/visual/test_evidence_cockpit_ia_smoke.py — 16 passed in 11.52s, with basetemp under /realm/tmp; pre-push devtools verify --quick succeeded.

Sinity and others added 2 commits July 13, 2026 01:39
Problem: prefix-sharing readers rendered inherited tool activity while the
evidence aggregate counted only the child session tail; route coverage also
lacked a browser journey for the new cockpit contracts.

What changed: query canonical blocks and actions over composed message ids,
add a prefix-sharing route regression, and exercise overview/evidence through
the real Playwright reader journey.

Ref polylogue-bby.17

Co-Authored-By: Claude <[email protected]>
Remove unsupported parser fixture fields; the regression sets structured
outcome columns through the production index before exercising the route.

Ref polylogue-bby.17

Co-Authored-By: Claude <[email protected]>
@Sinity

Sinity commented Jul 12, 2026

Copy link
Copy Markdown
Owner Author

Adversarial review — iteration 6

Findings and fixes:

  • Prefix-sharing evidence aggregates counted only stored child-tail rows. Commits 2b4f24e and cef1768 query canonical blocks/actions over the composed message-id set and add a parent/child live-route regression; it passed (1 passed in 11.83s, basetemp under /realm/tmp).
  • The claimed real browser coverage was missing. The same change adds a Playwright cockpit journey that loads overview, enters the reader, and requests the evidence aggregate; it passed (1 passed in 18.8s).

The first pre-push quick gate caught unsupported test-fixture keywords; the follow-up typed-fixture commit fixed them. The subsequent pre-push devtools verify --quick gate passed and the branch is pushed.

@Sinity

Sinity commented Jul 12, 2026

Copy link
Copy Markdown
Owner Author

Final acceptance-criteria matrix

polylogue-bby.17

  1. Satisfied — provider-usage and archive-debt HTTP projections remove archive_root and redact configured plus resolved symlink paths; live-server sentinels exercise normal payloads and path-bearing diagnostics. Overview refresh errors now receive the same privacy projection.
  2. Satisfied — /api/overview returns bounded totals, origins, readiness/snapshot truth, and six recent summaries.
  3. Satisfied — /api/sessions/:id/evidence-summary returns canonical structural tool/action outcomes, cost, and capped lineage refs. It now counts prefix-sharing sessions over the composed message set, with live parent/child parity coverage.
  4. Satisfied — the live shell consumes overview/evidence aggregates, displays stale and aggregate failures truthfully with retry, handles tested 401/409/503 rendering, uses capped lineage refs, and no longer needs insight timelines for header chips.
  5. Satisfied — route catalog/OpenAPI are generated; focused HTTP/privacy/UI checks passed; the real Playwright cockpit journey passed; devtools verify --quick passed in pre-push.

polylogue-nhjs

  • Satisfied in this slice — HTTP detail responses are capped, limits are clamped, continuation appends pages, and prefix-sharing display metadata is reconciled.
  • Deferred to the existing open bead — server-side non-hydrating/keyset windows, client virtualization/DOM budgets, deep-anchor page seeking, and bounded stack/compare/overlay projections. This PR does not claim full nhjs closure.

Final adversarial post-fix review: zero new actionable findings. Known GitHub Actions initialization-only failures remain external.

Sinity added a commit that referenced this pull request Jul 13, 2026
## Summary

Moves `ops doctor` source filters to the public Origin vocabulary while
keeping the provider-named spellings as one-release deprecated aliases.
Regenerates the CLI reference and teaches the vocabulary census that
explicitly deprecated Click aliases are compatibility, not active
contract surface.

## Problem

Doctor advertised `--schema-provider` and `--artifact-provider` even
though user-facing archive filters are origin-based. The needed
compatibility aliases would otherwise prevent the provider-vocabulary
census from showing the active CLI contract moving toward Origin.

## Solution

- Add repeatable `--schema-origin` and `--artifact-origin` flags;
canonical validation errors and verbose help now say origin.
- Keep `--schema-provider` and `--artifact-provider` as visible
deprecated aliases. Their warnings name the actual legacy flag and merge
into the existing workflow filters.
- Preserve raw-argv command extraction for both names.
- Exclude only explicit `click.option(..., deprecated=...)` aliases from
the census literal category; its new regression fixture proves
non-deprecated provider flags remain visible.

The `daemon/http.py` scope-key portion of `polylogue-9e5.8.4` is
intentionally deferred until PR #2793 merges, per the shared-file gate.

## Verification

- Direct CLI behavior: canonical help lists both origin flags; legacy
schema filtering warns with `--schema-provider`; both canonical and
legacy invalid invocations report the canonical `--schema-origin
requires --schemas` contract.
- `devtools render cli-reference` regenerated `docs/cli-reference.md`.
- `devtools lab census provider-vocabulary --json`: literal sites 15 ->
13; unallowlisted literal candidates 12 -> 10; no doctor compatibility
alias remains in the active literal set.
- `devtools verify --quick`: completed green once before the isolated
census follow-up (15 steps). Subsequent runs passed format/lint and then
stalled in host I/O `D` state during pytest and mypy; the aborted
lane-owned pytest basetemps were removed. The mandatory pre-push quick
gate subsequently completed and accepted the push.
- Focused pytest selection was attempted single-process with
`POLYLOGUE_PYTEST_BASETEMP_ROOT=/realm/tmp/polylogue-pytest` but stalled
in the same host I/O condition before completion.

## Acceptance matrix

- `polylogue-9e5.8.4` CLI flags: satisfied.
- `polylogue-9e5.8.4` HTTP scope key: deferred until PR #2793 is merged.
- `polylogue-jnj.7` doctor help and validation wording: satisfied in
this scope; its wider CLI-help sweep remains open.

Ref polylogue-9e5.8.4.
Ref polylogue-jnj.7.

Co-authored-by: Claude <[email protected]>
@Sinity
Sinity merged commit c1f7704 into master Jul 13, 2026
3 of 15 checks passed
@Sinity
Sinity deleted the feature/fanout/web-cockpit branch July 13, 2026 00:16
Sinity added a commit that referenced this pull request Jul 13, 2026
…807,2780,2790,2791,2795,2802,2806,2809

uwk3, jph5 (rigor-contracts #2783), bby.17 (web-cockpit #2793), dmp
(terminal-note #2801), ra3w (basetemp-fix #2807), r4no/bkff/r2kb
(extension-redesign #2780) fully satisfied — closed. nhjs (#2793), peo
(daemon-forensics #2802), 4g3n (#2780), 67ac/212.11 (demo-corpus #2795),
rsad (mcp-ergonomics #2790, real gaps remain per 5-iteration adversarial
cap), 9e5.8.4/jnj.7 (provider-origin #2806), mrxt/37t.12/p5g/rxdo.4
(annotation-judgment #2791), s7ae.8/20d.2 (live-performance-2 #2809)
partially satisfied — noted with disposition, left open.

Also discovered and documented the actual root cause of this session's
recurring bead-revert incidents: bd reimports the live database from
.beads/issues.jsonl on every CLI invocation, so a write not immediately
exported is lost the moment the next bd command runs. Every mutation in
this commit was individually export-verified against that behavior.

Co-Authored-By: Claude <[email protected]>
@Sinity

Sinity commented Sep 30, 2026

Copy link
Copy Markdown
Owner Author

Historical Codex triage: evidence checked at 5ebcfe5. This records that source revision; it does not claim a fresh review of current master.

Only the rows listed above are dispositioned. Held findings remain open.

@Sinity

Sinity commented Sep 30, 2026

Copy link
Copy Markdown
Owner Author

Historical Codex triage: evidence checked at 5ebcfe5. This records that source revision; it does not claim a fresh review of current master.

Only the rows listed above are dispositioned. Held findings remain open.

@Sinity

Sinity commented Oct 1, 2026

Copy link
Copy Markdown
Owner Author

Historical Codex triage: evidence checked at 5ebcfe5. This records that source revision; it does not claim a fresh review of current master.

  • 63.F095 / P2: fixed-already at the checked revision: The evidence read model now maps each action's single result_state through an exclusive CASE at polylogue/operations/http_read_models.py:163-167 and aggregates those resulting outcomes. One action therefore contributes to only ok, failed or unknown, not both success and failure from contradictory raw fields.

Only the rows listed above are dispositioned. Held findings remain open.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant