fix(mcp): await PostHog flush via unit-tested stdio wrapper - #8738
Conversation
Move the await-flush chokepoint into lib wrapStdioToolHandler so codecov/patch covers success, isError, throw, and disabled paths; keep bin as ignored registration glue. Closes JSONbored#8690
|
Superagent didn't find any vulnerabilities or security issues in this PR. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #8738 +/- ##
===========================================
- Coverage 93.80% 82.34% -11.47%
===========================================
Files 797 98 -699
Lines 79480 24765 -54715
Branches 24080 4748 -19332
===========================================
- Hits 74554 20392 -54162
- Misses 3555 4195 +640
+ Partials 1371 178 -1193
Flags with carried forward coverage won't be shown. Click here to find out more.
|
|
Tip ✅ LoopOver review result - approve/merge recommendedReview updated: 2026-07-26 01:49:11 UTC
Review summary Nits — 3 non-blocking
Decision drivers
Context & advisory signals — never blocks the verdict
Linked issue satisfactionAddressed Review context
Contributor next steps
Signal definitions
🧪 Chat with LoopOverAsk LoopOver a question about this PR directly in a comment — grounded only in the same cached, public-safe facts shown above, never a new claim.
Full command reference: https://loopover.ai/docs/loopover-commands 🧪 Experimental — new and may change. 🟩 Safe / merged · 🟦 Advisory · 🟨 Held for review · 🟥 Blocked / closed 💰 Earn for open-source contributions like this. Gittensor lets GitHub contributors earn for the work they already do — register to start earning →. Checked by LoopOver, a quiet PR intelligence layer for OSS maintainers.
|
Summary
recordMcpToolCallasync andawait client.flush()before returning (mirrors remote MCP tool-call telemetry fires without waitUntil, unlike this repo's own scheduleAfterResponse pattern #7233).wrapStdioToolHandler/recordStdioToolTelemetryinlib/telemetry.tswith full unit coverage (delayed flush, isError, throw, disabled, defensive catch).bin/loopover-mcp.tsas thin/* v8 ignore */registration glue socodecov/patchis not tanked by uninstrumentable entrypoint lines (the failure mode that closed fix(mcp): await PostHog flush for local tool-call telemetry #8733 at 25% patch).Client lifetime: still constructs a fresh PostHog client per call (same as remote), not a process-long singleton.
Closes #8690
Scope
type(scope): short summaryConventional Commit format, for examplefix(api): restore profile access checks.CONTRIBUTING.mdand does not reintroduce GitHub Pages, VitePress,site/, orCNAME.Closes #123) - a linked open issue is required for every contributor PR.Validation
git diff --checknpm run actionlintnpm run typechecknpm run test:coveragelocally;codecov/patchrequires ?99% coverage of the lines AND branches you changed (aim for 100% on your diff so CI variance does not fail near the threshold). Global coverage is a non-blocking trend with a loose 90% backstop, not the gate.npm run test:workersnpm run build:mcpnpm run test:mcp-packnpm run ui:openapi:checknpm run ui:lintnpm run ui:typechecknpm run ui:buildnpm audit --audit-level=moderateIf any required check was skipped, explain why:
test/unit/mcp-local-telemetry.test.tsand will run under CI. Prior fix(mcp): await PostHog flush for local tool-call telemetry #8733 closed for uncoveredbin/awaits - those are now in unit-testedlib/.Safety
UI Evidencesection below with JPG/JPEG or PNG screenshots arranged as organized, captioned, clickable thumbnails. SVG screenshots are not used as review evidence. Review-only screenshots or recordings are not committed to the repository.UI Evidence
N/A - no visible UI changes.
Notes