Repository navigation
feat(sentry-monitor): tag captures with session_id (ENG-20876) - #256
Conversation
Reliability Metric #5 tracks per-customer/day error rate (account_id tag, already live) but has no per-session dimension: session_id was only ever in contexts, which Sentry does not index, so a session's errors could not be searched for or grouped. Promotes the session correlation value each builder already had available into an indexed tag, for model_call_ended, before_tool_call_hook_failed, message_sent, cron_changed, session_end, and after_tool_call (whose ctx carries sessionId even though the event itself doesn't — threaded through register.ts the same way agent_end already does). delivery_recovery_exhausted and subagent_ended are left untouched: neither has an existing session_id-shaped value to promote, and inventing one (which of two session keys subagent_ended's ctx exposes; conflating sessionKey into session_id with no prior precedent for either hook) is a bigger call than this ticket asks for. 103 tests pass (60 in captures.test.ts, 8 new), oxlint clean, oxfmt --check clean.
…-qhr7-859c-m2p7 / GHSA-6j4f-fj2g-mc7p Two HIGH advisories published after the 5.0.9 pin (itself a fix for two older brace-expansion DoS advisories) cover 5.0.9 too: unbounded recursion on nested brace groups (<5.0.11) and in parseCommaParts (<5.0.10). Moves the pnpm-workspace.yaml override to 5.0.12 and regenerates pnpm-lock.yaml + the root npm-shrinkwrap.json. pnpm-audit-prod (security-fast's gate) now reports no high-or-higher advisories in production dependencies. Unrelated to this branch's actual change (session_id tagging) — this was failing on any current PR against boon, caught while getting CI green.
Dependency GuardThis PR changes dependency-related files. Maintainers should confirm these changes are intentional. Changed files:
Maintainer follow-up:
|
Dependency graph changes notedThis PR includes dependency graph changes. The dependency guard is informational because the PR author is a repository admin or a member of
Security review is still recommended before merge when the dependency graph change is intentional. |
There was a problem hiding this comment.
Approve — covers d8e57f2f specifically
Verified end-to-end at head d8e57f2f58. All claims in the body hold against the code; local test run, typecheck, and CI are green.
Numbered verifications (evidence-backed)
- Every claimed builder change is present, nothing more.
captures.tsat head:session_idtag added tomodel_call_ended(event.sessionId),before_tool_call_hook_failed(event.sessionId),message_sent(event.sessionKey),cron_changed(event.sessionId),session_end(event.sessionId);after_tool_callgets it via the new optionalctx?: Pick<PluginHookToolContext, "sessionId">.agent_endalready had the tag (line 131) — "no change needed" is true. - Deliberately-untouched claims hold.
buildDeliveryRecoveryExhaustedCaptureandbuildSubagentEndedCaptureare byte-identical to base;subagent_ended's ctx (PluginHookSubagentContext) indeed carries bothchildSessionKeyandrequesterSessionKey, so declining to tag one as "the" session is correct, not lazy. - The ctx contract is real at every layer.
PluginHookToolContext.sessionIdexists (hook-types.ts:633). The handler map already typedafter_tool_call: (event, ctx: PluginHookToolContext). Both core call sites populate it:embedded-agent-subscribe.handlers.tools.ts:1678passessessionId: ctx.params.sessionId, andharness/hook-helpers.ts:40passessessionIdwhen present. Theregister.tsthreading mirrorsagent_endline-for-line. message_sent'ssessionKey-as-session_idis consistent, not a conflation.contexts.runfor that hook was alreadyrunContext(event.runId, event.sessionKey)on base — the tag mirrors the existing session identity slot rather than inventing one. The code comment says exactly this.- No empty-tag facets.
pruneTagsdropsundefined/"", so events without a session emit nosession_idtag. Tags don't touch fingerprints, so existing issue grouping cannot fragment. - Ticket AC (ENG-20876) met with the right mechanism. The ticket asks for a searchable
session_idtag "wherever the gateway/agent process initializes Sentry". Per-event tagging on the sentry-monitor builders is the only correct mechanism for a multi-session gateway process (a global init-time tag is impossible), and it unblocks the per-session/per-day dashboard. The out-of-scope claim for the JWT-ENOENT example is verified:loadBoonWebAuthEnvlives in anychat-boon-web (src/transport/boon-web/jwt-verify.ts), a different process with its own Sentry init. - Tests green locally:
node scripts/test-projects.mjs extensions/sentry-monitor→ 103 passed (4 files) at head, matching the body's count exactly. - RED-GREEN proof: with
captures.ts/register.tsswapped to base, exactly the 6 newitblocks fail (6 failed / 54 passed); restoring head returns 103/103. The new tests genuinely pin the new tags. - Typecheck clean:
pnpm tsgo:extensionsexits 0 in a fresh worktree at head. - Dependency bump verified, not trusted:
brace-expansionoverride5.0.9 -> 5.0.12is consistent acrosspnpm-workspace.yaml,pnpm-lock.yaml, andnpm-shrinkwrap.json; the shipped integrity hash matches the npm registry for 5.0.12. 5.0.12 covers both new advisories (fixes landed in 5.0.10 and 5.0.11). - CI green at the exact reviewed head:
CI,Dependency Guard,Security Sensitive Guard,OpenGrep — PR Diff,CodeQL Critical Qualityallsuccessatd8e57f2f(verified via actions/runs). Zero open review threads. - Boundary rules respected: the plugin imports only
openclaw/plugin-sdk/typesperextensions/AGENTS.md; no core internals, no config-surface changes, no merge-risk surface from the ClawSweeper policy list.
Non-blocking nit
- Body says "8 new cases"; the diff adds 6 new
itblocks plus tag assertions on 2 existingbefore_tool_call_hook_failedtests (6 new + 2 augmented = 8 touched). Explained drift, wording only.
Reviews from this host post as augusteo, not the Slack bot name.
…session-id-tag # Conflicts: # npm-shrinkwrap.json # pnpm-lock.yaml # pnpm-workspace.yaml
|
@boon-hermes-bot Thanks for the verification pass. Re the non-blocking nit: you're right, the PR description's "8 new cases" was imprecise — it's 6 new Separately: this PR just went through a merge-conflict round with |
…w R generic axios 1.20.0's request/get/post/... methods gained a new R generic (R = AxiosResponseDefault, an unexported sentinel) so callers can override the response type. createTimeoutHttpInstance's wrapper methods assign plain arrow functions against Lark.HttpInstance's own generic method signature (request<T=any, R=T, D=any>(...): Promise<R>) with no explicit type arguments on either side. Under contextual inference the two same-named R type parameters collide, and axios's conditional response type (R extends AxiosResponseDefault ? AxiosResponse<...> : R) never reduces, so TS2322 fires on all 8 wrapper methods (check-prod-types, check-test-types, check-additional-extension-package-boundary). Pinning each wrapper's return type to `Promise<any>` (Lark's own default when its R is left unspecified) breaks the collision without changing behavior — these are pure pass-through wrappers, runtime shape is unaffected either way. Verified: pnpm tsgo:core, tsgo:extensions, tsgo:core:test, tsgo:extensions:test, and test:extensions:package-boundary:compile (117 extensions) all clean. Feishu's own suite (72 files / 962 tests) and sentry-monitor's (103 tests) still green.
check-lint (both the plain and bundled-extension shard) flagged the previous fix's 8 inline `Promise<any>` return annotations against no-explicit-any. Consolidated to one local `WrapperResponse` type alias with a single oxlint-disable, so the literal `any` token appears once instead of eight times. Separately, checks-node-bundle-infra-small-4 failed because src/infra/npm-managed-root.test.ts asserts the real pnpm-workspace.yaml override value for axios via toMatchObject — it had "1.18.1" hardcoded from before this branch's security bump; updated to "1.20.0". Verified: pnpm lint --threads=8, run-bundled-extension-oxlint.mjs, tsgo:extensions, test:extensions:package-boundary:compile, the specific npm-managed-root.test.ts (27/27), and feishu's + sentry-monitor's full suites all green.
…llowlist test/scripts/lint-suppressions.test.ts inventories every production oxlint-disable via an explicit allowlist (both an overall list and a no-explicit-any-specific one) so a new suppression can't slip in unnoticed. The previous commit's WrapperResponse suppression in extensions/feishu/src/client.ts was real and intentional but wasn't on either list yet. Added in the position `git grep` actually returns it (extensions/ sorts before src/, and bitable.ts before client.ts). Verified: test/scripts/lint-suppressions.test.ts passes (3/3) against the real git-tracked suppression set.
…263) Root version, 135 plugin manifests synced via scripts/sync-plugin-versions.ts (pnpm plugins:sync), root + 68 extension npm-shrinkwrap.json version fields and openclaw peerDependency ranges bumped, CHANGELOG section for boon.49. Shipping: #246 (tool-result aggregate budget scales with context window instead of a fixed 256k-char cap, so long tool-heavy sessions stop reading their own successful calls as failures and compaction actually fires on real pressure), #253/ENG-20866 (Chrome MCP handshake/navigate timeouts raised for real npx cold-start cost, unblocking browser-handoff live attach), #256/ ENG-20876 (session_id promoted to a real Sentry tag for the per-session reliability dashboard), #260/ENG-20968 (msteams SharePoint/OneDrive download failures surfaced through MediaFailures instead of silently dropped), #261/ ENG-21009 (Sentry node 8.49 -> 10.75.3, clearing ~12 medium Vanta/Inspector findings from its pinned otel/Prisma instrumentation chain), plus undici/ brace-expansion/axios security bumps and markdown-it/dompurify/golang.org/x/net dependency bumps. Base = 2026.6.11-boon.48. Gateway plus @openclaw/slack, @openclaw/msteams and @openclaw/diagnostics-prometheus bumped in lockstep; only @openclaw/msteams source changed in this train (#260), so a fleet-msteams.sh pass is needed on Teams hosts alongside the gateway roll. Co-authored-by: Claude Sonnet 5 <[email protected]>
Summary
Reliability Metric #5 (Sentry error rate, target <5/customer/session/day) has per-customer/day tracking live (
account_idtag), but no per-session dimension —session_idwas never an indexed tag, only ever landing incontexts.run, which Sentry does not search on. This is the prerequisite for the per-session/per-day dashboard.session_idtag (not justcontexts), for:model_call_ended,before_tool_call_hook_failed,message_sent(falls back tosessionKey, its only session identity),cron_changed,session_end.after_tool_call: the event itself carries no session field, but the hook'sctx(PluginHookToolContext) does — threadedctxthroughregister.tsthe same wayagent_endalready does, and added it as an optional 3rd param tobuildAfterToolCallCapture.agent_endalready taggedsession_id— no change needed there.delivery_recovery_exhaustedandsubagent_ended. Neither has an existingsession_id-shaped value to promote (only asessionKey/targetSessionKey), and there's no prior precedent in this file for conflating those intosession_idthe waymessage_sentalready does.subagent_endedis additionally ambiguous — its ctx exposes both a child and a requester session key, so tagging one as "the" session would be a guess. Flagging this here rather than silently expanding scope.Test plan
node scripts/test-projects.mjs extensions/sentry-monitor— 103 tests pass (4 files), including 8 new cases covering every touched builder plus the ctx-threading path forafter_tool_calloxlintclean,oxfmt --checkclean (via the repo's pre-commit hook)after_tool_call/invalid-inputexample matchesbuildAfterToolCallCapture's current output exactly (this codebase); confirmed the other example (JWT ENOENT, hasaccount_id) is emitted by a different process (anychat-boon-web'sloadBoonWebAuthEnv), so it's out of scope for "the gateway/agent process"🤖 Generated with Claude Code
Summary by cubic
Adds the
session_idtag to Sentry captures so errors group per-session, the prerequisite for the per-session/per-day dashboard behind Reliability Metric #5.session_idonmodel_call_ended,before_tool_call_hook_failed,message_sent(falls back tosessionKey),cron_changed, andsession_end; threads the hookctxthroughregister.tssoafter_tool_calltags it the same wayagent_endalready does.delivery_recovery_exhaustedandsubagent_endedare left untouched — neither has a cleansession_id-shaped value to promote.Dependencies
axiosoverride to 1.20.0 (lockfiles regenerated) for five advisories; pins the feishu timeout-wrapper return types toPromise<any>to clear a type-parameter collision introduced by axios's newRgeneric.brace-expansionoverride to 5.0.12 (lockfiles regenerated) for two advisories.Written for commit 269b10f. Summary will update on new commits.