Skip to content

feat(telemetry): schema 17 day-two activation instrumentation (Spec 126 PR-A) - #1940

Merged
Dumbris merged 7 commits into
mainfrom
claude/v0-75-activation-baseline-c15ef3
Nov 19, 2026
Merged

Dumbris merged 7 commits into
mainfrom
claude/v0-75-activation-baseline-c15ef3

Conversation

@Dumbris

@Dumbris Dumbris commented Nov 19, 2026 •

Copy link
Copy Markdown
Member

Summary

This is Spec 126 PR-A, instrumentation only: telemetry schema 17, which lets day-two activation be measured per install with anonymous, closed-enum fields. It is the Go side of the measurement. The receiver is in mcpproxy-telemetry#13, and the cohort report is in mcpproxy-dash#15. The spec is #1712.

  • Install anchor (FR-033). One UTC first-run time is written once, only when config.db was empty at open (internal/storage/install_anchor.go). An existing store never gets one.
  • day_two (FR-034, FR-038), personal edition only:
    • install_origin: fresh or existing;
    • install_age: d0_6, d7_13 or d14_plus (UTC calendar dates from the anchor);
    • success_scope_ever: none, starter_only or non_starter. It is persisted and moves forward only.
  • upstream_outcomes (FR-035, FR-036), both editions, reset on accept:
    • It counts one outcome per logical upstream call that dispatched, in succeeded, unusable and succeeded_non_starter.
    • window_age is frozen when the window opens at drain, so a window that opened in days 7–13 cannot hold week-one calls.
    • coverage is partial when a persisted undelivered-window marker shows that counts were lost (a kill before delivery). A retry of a pending snapshot is byte-identical.
  • Starter classification (FR-037). StarterClassifier is keyed by server name and incarnation. PR-A installs no starter, so the default answers false, and starter_only cannot occur until PR-B installs one.
  • One success definition. It is shared by the outcome counters and the existing activation.first_real_tool_call_ever, on every dispatch path: call_tool_*, direct routing and code_execution sub-calls. A refused call changes nothing.
    • A usable result is an answer that is not isError:true and that no output policy withheld.
    • A transport error, isError or a withheld result counts as unusable.
  • Privacy. The PII backstop (anonymity.go) rejects unknown keys and values in both new objects. There are no names and no ids; the new fields are booleans and closed enums only.

What it measures (v0.75.0 activation baseline): first success in days 0–6 and same-install repeat in days 7–13 become measured figures, not the receipt-dated bounds that schema ≤ 16 allows. Starter-only use is reported apart from both.

Test evidence

These ran at the PR head, rebased on origin/main 58a824e (head 39aaf66).

  • go build ./... and go build -tags server ./... both succeed.
  • go test -race ./internal/telemetry/... ./internal/storage/... passes.
  • go test -race ./internal/runtime/... passes (internal/runtime 420 s, plus configsvc, stateview, supervisor and supervisor/actor).
  • The CI-shaped go test -race -tags server -timeout 40m -skip "E2E|Binary|MCPProtocol|TestInfoEndpoint|TestGracefulShutdownNoPanic|TestSocketInfoEndpoint" ./internal/server/... passes (internal/server 1,588 s, internal/server/tokens).
  • ./scripts/test-api-e2e.sh passes: 77 passed, 0 failed.
  • TestNewBoltDB_StorePopulatedBeforeLockIsNotEmpty is new with the review fix below. It fails on the old pre-lock stat and passes now.
  • CI golangci-lint v2, both bare and --build-tags server, reports 0 new issues against origin/main.
  • Fixtures cover:
    • one outcome per logical call on every path (usable, isError, transport error, refused before dispatch, withheld by sanitisation or validation, starter);
    • the calendar-date boundaries of install_age;
    • window_age frozen at drain;
    • the coverage marker across kill, restart, accept and shutdown flush;
    • a byte-identical retry;
    • scope that only moves forward and survives a reopen;
    • opt-out sending nothing;
    • the server edition sending no window_age.
  • A live trace ran this build against cmd/mcpfixture over stdio, in a scratch data dir, with telemetry pointed at a local sink, so nothing was sent to production. It made one successful fixture:echo call, one call refused before dispatch (an unknown tool), and one call dispatched to a stalled upstream and cancelled. GET /api/v1/telemetry/payload then showed:
    "upstream_tool_call_count_bucket": "1-10",
    "upstream_outcomes": {"succeeded": "1-10", "unusable": "1-10", "succeeded_non_starter": "1-10", "coverage": "full", "window_age": "d0_6"},
    "day_two": {"install_origin": "fresh", "install_age": "d0_6", "success_scope_ever": "non_starter"}

Review

opencode github-copilot/gpt-6.1-sol (high) reviewed the change in three file chunks. Telemetry window and registry: CLEAN. Dispatch paths, day_two, scope and anonymity: CLEAN.

The storage and runtime chunk found one P2. NewBoltDB let an os.Stat taken before bbolt.Open override the record walk, so a store populated by another process during the 10 s lock wait could get an install anchor. It is fixed in 39aaf66, which decides only from the locked database, with a regression test. Round 2: CLEAN.

Merge order

mcpproxy-telemetry#13 must be merged, which deploys the worker, before any build that contains this PR sends telemetry. That includes release candidates. Until then the receiver does not copy upstream_outcomes into heartbeat_events, so those windows would be lost to the cohort report.

Not in this PR

  • No starter, wizard or Home changes: those are PR-B to PR-D.
  • No receiver deploy and no migration.
  • No release.

…ec 126 PR-A)

Telemetry schema 17 separates dispatch from completion and adds install
cohorts, with no onboarding, UI or API change.

- Install anchor (FR-033): storage decides at open whether config.db held
  no record; EnsureInstallAnchor writes a UTC first-run time once, in its
  own bucket, at server startup, whatever the telemetry setting.
- upstream_outcomes (FR-035, FR-036): one outcome per logical upstream
  call that dispatched, on the call_tool_* wrapper, direct routing and
  code_execution sub-calls, through a deferred recorder set up right
  after noteUpstreamDispatched. Part of the drained counter window, so a
  retry re-sends it byte-identical. coverage comes from a persisted
  undelivered-window marker; window_age is the install age when the
  window opened (fresh personal installs only).
- StarterClassifier on Runtime (FR-037), default false.
- day_two (FR-034, FR-038), personal edition only: install_origin,
  install_age (UTC calendar dates), success_scope_ever (forward-only,
  persisted).
- ScanForPII closed-object checks for both objects (FR-029).
- Schema pins moved to 17; telemetry docs and CLAUDE.md updated.
… anchor read once (Spec 126 PR-A)

- FR-036: the undelivered-window marker is set by the first outcome after
  process start or each Drain and cleared on an accepted send only when
  nothing was recorded since the accepted snapshot's drain; a late hook
  for an accepted window writes nothing (drain epochs). An absent marker
  is partial once only when install_origin is existing; every start
  writes it as cleared when absent.
- FR-035: window_age is the install age when the window opened (process
  start or the last Drain), stamped in CounterRegistry.Drain and frozen
  into the snapshot.
- FR-034/FR-035: the install anchor is read once per process and shared
  by day_two and window_age, so they cannot disagree.
- FR-037: direct routing reads the incarnation before dispatch.
- FR-033: the empty-store fixture uses a real NewBoltDB open and close.
… (Spec 126 PR-A)

- FR-036: one small mutex in the outcome window guards the increment,
  Drain's swap, the marker set (written before the first increment of a
  window) and the post-2xx clear (only when nothing was counted since the
  accepted snapshot's drain). deliveryMu is never taken on the tool-call
  path. Drain epochs and the late-hook path are gone.
- FR-035: outcome counts take part in HasPendingCounters and Reset, so an
  outcome-only window is still flushed at shutdown.
- FR-033: runtime.New records the install anchor after the Spec 080
  shutdown marker and the Spec 123 OAuth boot sweep, before telemetry is
  wired; server.go no longer does it.
- Runtime caches the reached success scope to skip the store read.
- Docs and CLAUDE.md follow.
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Nov 19, 2026 •

Copy link
Copy Markdown

Deploying mcpproxy-docs with  Cloudflare Pages  Cloudflare Pages

Latest commit: 5a3878d
Status: ✅  Deploy successful!
Preview URL: https://403bc932.mcpproxy-docs.pages.dev
Branch Preview URL: https://claude-v0-75-activation-base.mcpproxy-docs.pages.dev

View logs

…pre-lock stat (Spec 126 PR-A)

Review (gpt-6.1-sol): NewBoltDB took os.Stat before bbolt.Open and let an
absent or empty file override the record walk. Another process could
populate config.db while this one waited up to 10 s for the lock, and the
store would then read as empty and get an install anchor. Emptiness now
comes only from storeHasRecords on the opened, locked database; a file
bbolt.Open just created holds no records, so it still reads as empty.

TestNewBoltDB_StorePopulatedBeforeLockIsNotEmpty writes a record in that
window through a test-only hook; it fails with the old stat.
@Dumbris
Dumbris marked this pull request as ready for review November 19, 2026 12:33
@github-actions

github-actions Bot commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

📦 Build Artifacts

Workflow Run: View Run
Branch: claude/v0-75-activation-baseline-c15ef3

Available Artifacts

  • archive-darwin-amd64 (33 MB)
  • archive-darwin-arm64 (30 MB)
  • archive-linux-amd64 (20 MB)
  • archive-linux-arm64 (18 MB)
  • archive-windows-amd64 (33 MB)
  • archive-windows-arm64 (29 MB)
  • frontend-dist-pr (0 MB)
  • installer-dmg-darwin-amd64 (29 MB)
  • installer-dmg-darwin-arm64 (26 MB)
  • smart-mcp-proxymcpproxy-goIBGLDS.dockerbuild (0 MB)

How to Download

Option 1: GitHub Web UI (easiest)

  1. Go to the workflow run page linked above
  2. Scroll to the bottom "Artifacts" section
  3. Click on the artifact you want to download

Option 2: GitHub CLI

gh run download 44559549428 --repo smart-mcp-proxy/mcpproxy-go

Note: Artifacts expire in 14 days.

@codecov-commenter

codecov-commenter commented Nov 19, 2026 •

Copy link
Copy Markdown

TestE2E_TrayToCore_UnixSocket, TestE2E_DualListener_Concurrent and
TestE2E_SocketPermissions started a Server and deliberately never shut it
down. Each one left its runtime, upstream manager and network-recovery
watcher running, so the TestMain guard from #1936 failed the E2E job
(`-run TestE2E`) with "3 upstream.Manager network-recovery watcher(s)
still running". #1936's sweep ran with `-skip E2E` and never saw them.

stopSocketE2EServer shuts the server down, cancels its context and waits
for Start to return. It is deferred after the socketE2EMutex unlock, so it
runs while the mutex is held, before the next socket test starts.

Verified: the guard fails with the three tests on the old file and passes
with this change; the CI E2E command passes.
… merge cleanly

#1941 makes the same shutdown fix in socket_e2e_test.go. Taking its file
byte-for-byte means whichever PR lands second merges without a conflict.
The CI E2E command still passes with the leak guard.
@Dumbris
Dumbris merged commit 3623edc into main Nov 19, 2026
64 of 65 checks passed
Dumbris added a commit that referenced this pull request Nov 20, 2026
`roadmap.yaml` had no epics after Spec 117. This PR adds them and
regenerates `ROADMAP.md`.

- **Shipped:** 118 auto-rescan (#1689), 118 pin visibility boundary
(#1684, #1688, #1821), 119 (#1740), 120 (#1781), 122 (#1818) and 123
(#1886, #1887, #1888, #1891).
- **In review:** 121 install surfaces (#1711). There is no `spec:` link
yet because its folder exists only on the PR branch.
- **In progress:** 124 (PR-1 #1918 done; PR-2 CLI and PR-3 Web UI to do)
and 125 (spec plus PR-1..3 done; PR-4 Web UI to do). Merged PRs are
listed as done child tasks, so `--check-github` doesn't flag a merged PR
under an in-progress epic.
- **Spec-only PRs:** 127 (#1943), 128 (#1944) and 129 (#1945).

Merge this after #1943, #1944 and #1945. Until then, `--check-github`
reports their `spec:` links as unresolved; `--check`, the pre-commit
hook, passes.

Not covered: Spec 126 (#1940, open) and the unsynced tasks.md checkboxes
for 123 and 124.
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