Skip to content

feat(sentry-monitor): tenant identity tag + hook allow-list - #194

Merged
holywend merged 2 commits into
boonfrom
wheng/eng-19463/trial-sentry
Sep 4, 2026
Merged

holywend merged 2 commits into
boonfrom
wheng/eng-19463/trial-sentry

Conversation

@holywend

@holywend holywend commented Sep 4, 2026 •

Copy link
Copy Markdown

Summary

Two additions to sentry-monitor, both no-ops unless configured — paid hosts are byte-identical.

  • BOON_TENANT_ACCOUNT_ID → a trial_account_id tag. Follows the existing BOON_SKILLS_REF / DEPLOY_WAVE env-to-tag idiom already in register.ts.
  • config.hooks — an optional allow-list of hook names. Unset registers all eight (current behaviour); an empty array registers none.

Why

Groundwork for ENG-19463 — enabling Sentry on trial containers, which today report nothing from inside the agent.

The identity problem

Trial tenants share one host and are spawned with no --hostname, so os.hostname() is an opaque container id that changes on every respawn, and environment is the same string for every tenant on the box. The tenant id is the only stable identity a trial container has — and it's already a required, validated parameter of the spawn script.

A tag, not environment. Tags are the dimension built for cardinality, and they do not affect grouping (fingerprint does), so a per-tenant value cannot fragment issues. environment is designed for a small fixed set — one per trial account would abuse it.

The noise problem

Measured against production Sentry (14d, openclaw-fleet):

hook events
after_tool_call 4,850 88% of all plugin volume
cron_changed 532
agent_end 92
everything else ~105

The top after_tool_call issues are dominated by the agent's own exploratory failures — 1,620× a python script printing its header, 718× a tool called without a required property, 528× a traceback from a script the agent wrote, 85× ls: cannot access …. The agent sees those and adapts; an operator cannot act on them.

The allow-list lets a noisy or quota-constrained tenant class report only customer-visible outcomes — did the turn finish (agent_end), did the reply get delivered (message_sent, delivery_recovery_exhausted) — without changing what the paid fleet reports.

Notes for review

  • Empty array ≠ unset. [] is a real operator intent ("report nothing") and is deliberately distinguishable from an absent config. A ?? or truthiness check would silently re-enable every hook on exactly the tenant class that needs the filter.
  • Checked per call site rather than via a generic wrapper, so api.on keeps its per-hook payload typing.
  • An unknown hook name in the list never matches and is ignored rather than throwing.

Test plan

  • node scripts/run-vitest.mjs extensions/sentry-monitor/src → 92 passed (6 new).
  • New cases: tag set from env; tag absent when env unset (the paid-unchanged guard); allow-list narrows registration; absent config registers all eight; empty array registers none; unknown name ignored.
  • npx oxlint extensions/sentry-monitor/src → clean.
  • npx oxfmt --check on both changed files → clean.

Committed with --no-verify: this worktree has no node_modules of its own so the hook could not resolve oxfmt. The hook's only action is oxfmt --write + restage, which was run manually and verified with --check.


Summary by cubic

Adds two opt-in features to sentry-monitor to prepare for enabling Sentry on trial containers (ENG-19463): a trial_account_id tag read from BOON_TENANT_ACCOUNT_ID, and an optional config.hooks allow-list. Both are no-ops unless configured, so paid hosts are unchanged.

Key decisions

  • Tags are used instead of environment because they handle cardinality and don't affect issue grouping.
  • An empty hooks array registers no hooks and is deliberately distinct from an unset config, which keeps the current behavior of registering all eight.
  • Unknown hook names in the allow-list are ignored rather than throwing.
  • The allow-list is checked at each call site so api.on keeps its per-hook payload typing.
  • The manifest schema declares hooks; without it, additionalProperties:false rejected the option before the plugin code ran.

Written for commit 83bc247. Summary will update on new commits.

Review in cubic

Two additions, both no-ops unless configured, so paid hosts are untouched.

BOON_TENANT_ACCOUNT_ID -> a trial_account_id tag, following the existing
BOON_SKILLS_REF/DEPLOY_WAVE env-to-tag idiom. Trial tenants share one host and
are spawned with no --hostname, so os.hostname() is an opaque container id that
changes on every respawn and `environment` is identical for every tenant on the
box. The tenant id is the only stable identity a trial container has.

A tag rather than `environment`: tags are the dimension built for cardinality
and do not affect grouping (fingerprint does), so a per-tenant value cannot
fragment issues. `environment` is designed for a small fixed set.

config.hooks is an optional allow-list. Unset registers every hook, so existing
behaviour is byte-identical; an empty array registers none, which is a real
operator intent and is deliberately distinguishable from unset. Measured
against production Sentry: after_tool_call is ~88% of fleet plugin volume
(4,850 of 5,500 events in 14d), dominated by the agent's own exploratory
failures — a script it wrote raising a traceback, an `ls` on a path that does
not exist, a tool called with the wrong arguments. The agent sees those and
adapts; an operator cannot act on them. This lets a noisy or quota-constrained
tenant class report only customer-visible outcomes.

Checked per call site rather than through a generic wrapper so api.on keeps its
per-hook payload typing.

92 tests pass, oxlint clean, oxfmt --check clean. Committed --no-verify: this
worktree has no node_modules of its own, so the hook could not resolve oxfmt.
The hook's only action is `oxfmt --write` + restage, which was run manually and
verified with --check above.
@holywend
holywend requested a review from a team September 4, 2026 04:35
@claude

claude Bot commented Sep 4, 2026 •

Copy link
Copy Markdown

Claude encountered an error —— View job


I'll analyze this and get back to you.

@gandalfboon gandalfboon 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.

Approved. Clean, well-argued change.

Substance checks out:

  • Tag, not environment — right call. Tags are the indexed, high-cardinality dimension; grouping is fingerprint's job. A per-tenant environment would abuse the field's fixed-set contract and fragment nothing useful.
  • Empty-array-vs-unset discrimination — the Array.isArray check plus the comment calling out the ??/truthiness footgun is exactly the correct guard. [] is a real operator intent ("report nothing") and must survive.
  • Per-callsite gating over a generic wrapper — preserves api.on's per-hook payload typing. A wrapper would have erased it.
  • Paid-fleet no-op — no env, no config → byte-identical registration. The "tag absent when env unset" test locks this in.
  • Unknown hook name → ignored, not thrown — right posture for operator config; Set.has handles it naturally.

Test plan is real: 92 passed, 6 new cases cover every branch (tag set / tag absent / allow-list narrows / absent registers all eight / [] registers none / unknown ignored). oxlint and oxfmt --check clean. The --no-verify note is honest — worktree has no node_modules, formatter ran manually and verified.

Ship it.

@cubic-dev-ai cubic-dev-ai 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.

All reported issues were addressed across 2 files

Reply with feedback, questions, or to request a fix.

Fix all with cubic | Re-trigger cubic

The manifest configSchema sets additionalProperties:false, so a config
carrying `hooks` was rejected before the plugin code ever ran — the option was
dead on arrival. The unit tests missed it because they pass pluginConfig
directly and never exercise manifest validation.

Proved with ajv against both schema shapes:
  BEFORE (no hooks in schema): REJECTED
  AFTER  (hooks in schema):    VALID
and that additionalProperties:false still rejects an unknown key, and a
non-array `hooks` still fails on the items type.

Also trims the new source comments to the repo's convention: no ticket ids, no
PR narrative, 1-3 lines stating the invariant and what breaks without it.

Addresses PR review feedback.
@holywend
holywend merged commit 04d7ae1 into boon Sep 4, 2026
352 of 357 checks passed
@holywend
holywend deleted the wheng/eng-19463/trial-sentry branch September 4, 2026 05:08
insomnius added a commit that referenced this pull request Sep 4, 2026
…200)

Ships #198 (ENG-19115) — the gateway-audience OBO finally reaches the wire:
agent-runner-utils builds the primary-turn sender context from run.oboToken
and run.ts copies it into the attempt params, verified end to end on a local
stack (gateway fetched the org signing key and verified the token). Also
#197 browser-handoff recheck, #194 sentry-monitor tenant tag + hook
allow-list, #195/#196 CI dependency-audit hardening. Lockstep bump via
release:prep; CHANGELOG.md gains the 2026.6.11-boon.37 section the prepack
requires.
orswn added a commit that referenced this pull request Sep 8, 2026
…206)

## Release 2026.6.11-boon.38

Ships channel-owned sub-agent completion replies for Boon web chat.

### Contents (merged onto `boon` since boon.37)
- **#205 (ENG-19421)** — a plugin can register a completion owner for its channel; the announce flow hands the sub-agent completion to the owner and falls back to the existing delivery path when none is registered, so other channels are unchanged. `sessions_yield` runs its tool batch sequentially so a `message` send in the same turn is no longer aborted. Carries upstream openclaw#97657 and openclaw#98835 (`reply session initialization conflicted`). Smoke-tested on a local stack; evidence in #205.
- **#202** — plugin-sdk read of the gateway live run count.
- **#201** — internal identifiers removed from the public tree.

### Release prep
- Root version boon.37 → boon.38; `pnpm release:prep` regenerated the lockstep set (211 files) → `[release-preflight] OK`.
- `CHANGELOG.md` `## 2026.6.11-boon.38` section added; `scripts/package-changelog.mjs` extractor returns 2496 packaged bytes.

### After merge
Tag `v2026.6.11-boon.38` → `boon-release.yml`. The fleet is pinned to `boon.36`, so the roll also picks up boon.37 (#189, #194–#198). Gateway roll first (gated `fleet-roll`), then the anychat-boon-web release that pins this tarball.
william-antoline-boon added a commit that referenced this pull request Sep 9, 2026
…211)

## Release 2026.6.11-boon.39

Surfaces a swallowed before_tool_call hook failure to Sentry + the durable
audit trace so the ENG-19492 incident class is diagnosable after the fact.

### Contents (merged onto `boon` since boon.38)
- **#209 (ENG-19492)** — emit a `before_tool_call_hook_failed` observability
  hook (genuine handler exception only, never a policy veto), paged by
  sentry-monitor, and thread the real error text into boon-core's audit_trace
  as an optional `detail` field. Requires boon-core companion getboon/boon#14629
  (merged + live) which accepts the new field. Non-hook pipeline failures are
  classified separately.
- **#208** — derive legacy tool counts from surfaced failures.

### Release prep
- Root version boon.38 -> boon.39; lockstep regenerated (211 files:
  135 plugin package.json + 70 npm-shrinkwrap.json + SDK/config baselines).
  All release-preflight --check steps pass.
- CHANGELOG.md `## 2026.6.11-boon.39` section added.

### After merge
Tag `v2026.6.11-boon.39` -> `boon-release.yml`. Fleet is pinned to boon.36, so
a roll also picks up boon.37 (#194-#198) and boon.38 (#201, #202, #205).


Claude-Session: https://claude.ai/code/session_01AMjtZJAWLVBwa5Dtc4oNog

Co-authored-by: Claude Opus 4.8 (1M context) <[email protected]>
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