Skip to content

feat(snapshot): cache and coalesce provider reads with diagnostics - #106

Merged
entelecheia merged 3 commits into
mainfrom
feat/105-snapshot-cache
Nov 10, 2026
Merged

entelecheia merged 3 commits into
mainfrom
feat/105-snapshot-cache

Conversation

@entelecheia

@entelecheia entelecheia commented Nov 10, 2026 •

Copy link
Copy Markdown
Member

Every viewer currently repeats the same provider work. This implements delivery 1 of #105 with a per-node, in-memory snapshot cache keyed by provider, namespace, tool and canonical input. Identical concurrent requests share a call. The default TTL is min(pollMs / 2, 2000) ms, with additive panel/inbox/Space overrides from 0 to 60000 ms. An explicitly declared panel owns its TTL; capability overrides apply only to enabled, undeclared reserved panels.

The cache serves last-good data during one extra TTL while revalidating. Provider exceptions are not retained, and producer {ok:false, error} replies pass through unchanged with status 200 and are not cached. LRU limits cover 256 retained entries and 4 MiB of serialized keys/values; pending unique loads and diagnostic histories are bounded separately. Console actions and mutating principal tools invalidate before execution and before returning, including late completion. Plugin-declared readOnly principal tools preserve entries. Reload detaches old provider entries and pending cache writes.

Freshness metadata lives only in X-Acon-Cache, X-Acon-Cache-Age-Ms and X-Acon-Sampled-At headers, exposed to configured CORS origins. Producer bodies, including any producer-owned stale or sampledAt, remain intact. Existing cursor and changed:false handling remain unchanged. System shows totals, hit/miss/stale counts and rolling provider p50/p95 by tool and panel. The timing script measures registered providers directly and was smoke-tested only against a synthetic registration.

Principal snapshots use a separate namespace including authenticated principal identity. The current MCP tools/call route still invokes the principal action port. This adds no exposed snapshot method or tool-to-panel mapping.

Validation at 68c8af73c59d9813d63e04c0c1a3838081f2654c:

  • Focused cache/manifest/lineage/historical 0.1.8 compatibility suite: 50 tests passed. Regression tests reproduced the old failures before the fix, then verified producer fields in console/principal/panel delivery, verbatim status-200 error replies without retention, and explicit-panel TTL precedence.
  • Focused server snapshot/action/reload/meta checks: 15 passed. Authenticated MCP readOnly/mutating/console invalidation and CORS exposure regression: 1 passed.
  • Main and N-1 TypeScript checks, boundary, JavaScript syntax and diff checks passed.
  • Earlier synthetic fake-home timing-script smoke passed; no personal plugin measurements are committed. Documentation freshness stamps are unchanged.
  • Current-head full checks are left to hosted CI. Shell changed, so reviewer browser/OCR verification is pending; earlier-head results do not validate this head.

Related to #105. Delivery 2 (versions/known replies and adaptive/progressive polling), push transport and producer changes remain separate.

Copilot AI balanced review requested due to automatic review settings November 10, 2026 12:31

Copilot AI 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.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 10, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-10T12:34:57.729081Z 135c0f3 PR opened
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@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: 135c0f39e5

ℹ️ 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 src/server.ts Resolved
Comment thread src/server.ts Resolved
@entelecheia
entelecheia merged commit 5fb367f into main Nov 10, 2026
3 checks passed
@entelecheia
entelecheia deleted the feat/105-snapshot-cache branch November 10, 2026 13:05
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.

2 participants