Repository navigation
feat(usage): forward gateway-audience OBO as x-boon-gateway-obo-token (ENG-19115) - #173
Merged
insomnius merged 2 commits intoSep 1, 2026
Conversation
…115) Thread the gateway-audience OBO from MsgContext.OboToken (set by anychat-boon-web, ENG-19116) through the runner param chain into the model-call diagnostic context, and emit it as the x-boon-obo-token header in withBoonUsageHeaders -- mirroring senderId -> x-boon-user-id. The gateway (ENG-19117) verifies the signed token fail-closed to skip metering internal-test traffic. Security-neutral plumbing: this only carries the opaque token (never logged); all verification is at the gateway. Optional/omit-when-absent, so non-web surfaces and older boon-core builds are unaffected.
|
Claude encountered an error —— View job I'll analyze this and get back to you. |
There was a problem hiding this comment.
Approved — the header threads through exactly like x-boon-user-id, sanitized + omit-when-absent, and never logged.
Verified locally:
grep -rn oboToken src/— only the 6 documented touchpoints; zero logging/serialization contextsnode scripts/run-vitest.mjs run src/agents/embedded-agent-runner/run/attempt.model-diagnostic-events.test.ts→ 21/21 pass (including the new emitted/omitted case)pnpm tsgo:allclean- CI checks in progress; every completed check is SUCCESS (mergeStateStatus=UNSTABLE only because checks are still running)
Ship the OBO chain.
The gateway verifier reads exactly X-Boon-Gateway-Obo-Token (boon-llm-gateway middleware/obo.go `OboHeader`, ENG-19117). The first commit emitted the old plan name x-boon-obo-token, which the gateway would ignore -> fail-open (internal-test traffic still metered). Align the emitted header, comments, and test with the pinned name.
insomnius
deleted the
ariefrahman/eng-19115-openclaw-forward-obo-token-x-boon-obo-token
branch
September 1, 2026 13:57
This was referenced Sep 1, 2026
insomnius
added a commit
that referenced
this pull request
Sep 4, 2026
…the attempt (ENG-19115) (#198) Local end-to-end run (boon-core -> anychat-boon-web -> openclaw -> local boon-llm-gateway) on boon.36 reproduced the production failure: boon-core minted the gateway-audience OBO, the plugin set MsgContext.OboToken, and x-boon-gateway-obo-token still never reached the gateway. Presence-only tracing at each hop showed the token alive through get-reply-run (#185) and into agent-runner-execution, then gone at withBoonUsageHeaders. Two more explicit-field-list hops dropped it: - agent-runner-utils buildTemplateSenderContext built the primary-turn sender identity from the persisted sessionCtx only. The OBO is a fresh per-turn token that lives on run.oboToken, never on sessionCtx, so the first turn never carried it. (#190 fixed followup-runner, which only serves queued mid-turn followups.) - embedded-agent-runner/run.ts copies RunEmbeddedAgentParams into the attempt params field by field and never copied oboToken, so attempt.ts's params.oboToken was undefined on every turn. #173 declared the field on the outer type and read it on the inner one without threading run.ts. Both are required: with the builder fixed alone the wire log still read obo=absent; with run.ts fixed as well the header attached and the local gateway fetched the org's signing key from boon-core (200) for the first time. Also adds a names-only debug log of the Boon headers attached to each model call (never values) - this hop had no observability, which is how three fixes shipped without moving the gateway. Regression tests: buildEmbeddedRunExecutionParams carries run.oboToken (red before the builder edit) and never sources it from sessionCtx; runEmbeddedAgent forwards oboToken into the embedded attempt (red before the run.ts edit) and leaves it undefined when absent. Compaction-recovery attempts intentionally untouched: compaction carries no identity today (separate follow-up). .design/ records the trace and red->green ledger.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Forward the gateway-audience OBO from
MsgContext.OboToken(set by anychat-boon-web, ENG-19116) to the LLM-gateway call as theX-Boon-Gateway-Obo-Tokenheader, so the gateway (ENG-19117) can verify it fail-closed and skip metering internal-test traffic against the customer's token meter (parent ENG-18998).Mirrors the existing
senderId → x-boon-user-idseam exactly.Changes (6 files, all additive/optional)
auto-reply/templating.ts— addOboToken?toMsgContext.embedded-agent-runner/run/params.ts— addoboToken?toRunEmbeddedAgentParams(propagates toEmbeddedRunAttemptParamsvia the existingOmit).auto-reply/reply/get-reply-run.ts— readsessionCtx.OboTokeninto the run params.embedded-agent-runner/run/attempt.ts— threadoboTokeninto the model-call diagnostic context (omit-when-absent).embedded-agent-runner/run/attempt.model-diagnostic-events.ts—oboTokenonModelCallDiagnosticContext,BOON_OBO_HEADER_NAME = "x-boon-gateway-obo-token", and the entry inwithBoonUsageHeaders.x-boon-gateway-obo-tokenemitted / omitted case.Header name (pinned)
Emits
x-boon-gateway-obo-token(lowercase; Go net/http canonicalizes toX-Boon-Gateway-Obo-Token). Pinned by the gateway verifier —boon-llm-gateway middleware/obo.goconst OboHeader = "X-Boon-Gateway-Obo-Token"(ENG-19117, boon-llm-gateway#96). A mismatch would fail-open (traffic metered), so this stays in lockstep with that constant. (First commit used the old plan namex-boon-obo-token; second commit corrects it.)Security / scope
Closes the OBO runtime chain: 19112 mint + 19113 stamp + 19116 MsgContext + 19115 header + 19117 verify + 19110 skip.
Test
node scripts/run-vitest.mjs run src/agents/embedded-agent-runner/run/attempt.model-diagnostic-events.test.ts→ 21 passed.pnpm tsgo:all(full monorepo typecheck) → clean.Closes ENG-19115.