Skip to content

[NA] [BE] Reclassify system_tools/system_tools_deferred into the built_in_tools lane#7555

Draft
petrotiurin wants to merge 3 commits into
mainfrom
move-built-in-tool-schema-cost
Draft

[NA] [BE] Reclassify system_tools/system_tools_deferred into the built_in_tools lane#7555
petrotiurin wants to merge 3 commits into
mainfrom
move-built-in-tool-schema-cost

Conversation

@petrotiurin

@petrotiurin petrotiurin commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

Details

Built-in tool schema (definition) cost — system_tools/system_tools_deferred — was tagged bd_lane='static_overhead' at ingestion, so it showed up under "Static overhead" in the AI-Spend breakdown instead of "Built-in tools". MCP's equivalent (mcp_tools_active) already shares bd_lane='mcp_servers' with its usage rows (tool_io), needing zero special-case reporting code downstream. This mirrors that: lane()/bdLane() now route these two categories to built_in_tools, and label() keys them by tool_name (falling back to "(unattributed)" for the blank-tool_name deferred-tools reminder block) instead of the bare category string — same as tool_io. isDefinition() is unchanged (both categories stay 1).

Also dedupes lane()/bdLane()'s near-identical category dispatch tables per review feedback: bdLane() now delegates to lane() and only overrides the two intentional differences (mcp_tools_deferred/mcp_server_instructions excluded from the breakdown; "unattributed" collapses to ""), so a future category addition can't update one table and forget the other.

Companion PRs: ai-cost-backend (comet-ml/ai-cost-backend#33) removes the now-redundant display-only overlay that this made obsolete; opik-plugin-ai-spend (comet-ml/opik-plugin-ai-spend#42) updates the matching lane description text.

Note: this only affects newly-ingested rows going forward. Existing cipx_spend_blocks rows keep their historical bd_lane='static_overhead' tag (no backfill included in this change).

Change checklist

  • User facing
  • Documentation update

Issues

  • Resolves #
  • OPIK-

AI-WATERMARK

AI-WATERMARK: yes

  • Tools: Claude Code
  • Model(s): Claude Sonnet 5
  • Scope: full implementation (ingestion reclassification, test coverage, dedup refactor) plus responses to automated review feedback
  • Human verification: diff reviewed and CI results checked; not exercised against a live opik-backend deployment

Testing

  • CostIntelligenceIngestionTest.systemToolsLandInBuiltInToolsLane covers a named-tool schema block, the blank-tool_name deferred-tools reminder block, and (regression guard) that system_prompt/env_info still resolve to static_overhead after the dispatch-table dedup.
  • No local Gradle/Docker access from this environment to run the suite directly; this PR's own CI run (Backend Tests: Unit Tests + all 16 Integration Groups) passed.

Documentation

No documentation changes needed — this is an internal cost-attribution fix with no user-facing API/behavior change beyond which AI-Spend card the cost appears under.

… lane

These categories carry built-in tool schema (definition) cost, but were
tagged bd_lane='static_overhead' at ingestion, landing under the "Static
overhead" card in the AI-Spend breakdown instead of "Built-in tools". MCP's
equivalent (mcp_tools_active) already shares bd_lane='mcp_servers' with its
usage rows (tool_io), so mirror that: route these two categories to
built_in_tools in lane()/bdLane(), keyed by tool_name (falling back to
"(unattributed)" for the blank-tool_name deferred-tools reminder block)
instead of the bare category string.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@github-actions github-actions Bot added java Pull requests that update Java code Backend tests Including test files, or tests related like configuration. labels Jul 21, 2026
@github-actions

github-actions Bot commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

⏱️ pre-commit per-hook timing

Hook Description Result Duration
☕ spotless — java backend Format Java code 5.47s
Total (1 ran) 5.47s
⏭️ 40 skipped (no matching files changed)
Hook Description Result
🐍 trim trailing whitespace — python sdk Strip trailing whitespace ⏭️
🐍 fix end of files — python sdk Ensure files end in a newline ⏭️
🐍 ruff — python sdk Lint + autofix Python (ruff) ⏭️
🐍 ruff-format — python sdk Format Python code (ruff) ⏭️
🐍 mypy — python sdk Static type check ⏭️
🤖 trim trailing whitespace — optimizer Strip trailing whitespace ⏭️
🤖 fix end of files — optimizer Ensure files end in a newline ⏭️
🤖 check yaml — optimizer Validate YAML syntax ⏭️
🤖 check json — optimizer Validate JSON syntax ⏭️
🤖 check toml — optimizer Validate TOML syntax ⏭️
🤖 check for added large files — optimizer Block large files (>1MB) ⏭️
🔐 detect private key — optimizer Block committed private keys ⏭️
🤖 check for merge conflicts — optimizer Block merge-conflict markers ⏭️
🤖 check for case conflicts — optimizer Block case-only name clashes ⏭️
🤖 pyupgrade — optimizer Modernize Python syntax ⏭️
🤖 ruff — optimizer Lint + autofix Python (ruff) ⏭️
🤖 ruff-format — optimizer Format Python code (ruff) ⏭️
🤖 mypy — optimizer Static type check ⏭️
📓 nbstripout — optimizer notebooks Strip notebook output ⏭️
📝 markdownlint — optimizer Lint Markdown ⏭️
🔤 codespell — optimizer Fix common misspellings ⏭️
📊 radon cc — optimizer Cyclomatic-complexity gate ⏭️
📊 radon raw — optimizer Raw size metrics gate ⏭️
📊 xenon — optimizer Fail on complexity thresholds ⏭️
📊 lizard — optimizer Cyclomatic-complexity gate ⏭️
🧹 vulture — optimizer Find dead code ⏭️
🛡️ trim trailing whitespace — guardrails Strip trailing whitespace ⏭️
🛡️ fix end of files — guardrails Ensure files end in a newline ⏭️
🛡️ ruff — guardrails Lint + autofix Python (ruff) ⏭️
🛡️ ruff-format — guardrails Format Python code (ruff) ⏭️
🛡️ mypy — guardrails Static type check ⏭️
⚓ helm-docs Regenerate Helm chart README ⏭️
block non-public FE plugins Block non-public FE plugins ⏭️
🧪 pre-commit wrapper smoke tests Self-test the wrapper scripts ⏭️
🌐 eslint — frontend Lint + autofix JS/TS ⏭️
🌐 typecheck — frontend Whole-project tsc type check ⏭️
📘 eslint — typescript sdk Lint + autofix JS/TS ⏭️
📘 typecheck — typescript sdk Whole-project tsc type check ⏭️
⚙️ actionlint — github workflows Lint GitHub Actions workflows ⏭️
🐳 hadolint — dockerfiles Lint Dockerfiles ⏭️

… regression

- bdLane() now delegates to lane() for the shared dispatch table and only
  overrides the two intentional differences (mcp_tools_deferred/
  mcp_server_instructions excluded; "unattributed" collapses to ""), so a
  future category addition can't update one table and forget the other.
- Extend the new ingestion test with system_prompt/env_info blocks, asserting
  their lane()/bdLane() still resolve to static_overhead — a regression guard
  for the dispatch-table refactor, since the prior test only covered the two
  reclassified categories.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@petrotiurin petrotiurin changed the title Reclassify system_tools/system_tools_deferred into the built_in_tools lane [NA] [BE] Reclassify system_tools/system_tools_deferred into the built_in_tools lane Jul 21, 2026
@github-actions

github-actions Bot commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

Backend Tests - Integration Group 15

 37 files   -  1   37 suites   - 1   2m 10s ⏱️ +10s
310 tests  - 20  310 ✅  - 20  0 💤 ±0  0 ❌ ±0 
213 runs   - 20  213 ✅  - 20  0 💤 ±0  0 ❌ ±0 

Results for commit 9207790. ± Comparison against base commit f570882.

This pull request removes 64 and adds 44 tests. Note that renamed tests count towards both.
com.comet.opik.api.resources.v1.jobs.ProjectLastUpdatedFlushJobTest ‑ jobFlushesBufferedMarkerToProject
com.comet.opik.api.resources.v1.priv.AuthenticationResourceTest$ApiKey ‑ checkAccessForDefaultWorkspace__whenApiKeyIsPresent__thenReturnProperResponse(String, int, String)[1]
com.comet.opik.api.resources.v1.priv.AuthenticationResourceTest$ApiKey ‑ checkAccessForDefaultWorkspace__whenApiKeyIsPresent__thenReturnProperResponse(String, int, String)[2]
com.comet.opik.api.resources.v1.priv.AuthenticationResourceTest$ApiKey ‑ checkAccessForDefaultWorkspace__whenApiKeyIsPresent__thenReturnProperResponse(String, int, String)[3]
com.comet.opik.api.resources.v1.priv.AuthenticationResourceTest$ApiKey ‑ checkAccess__whenApiKeyIsPresent__thenReturnProperResponse(String, int, String)[1]
com.comet.opik.api.resources.v1.priv.AuthenticationResourceTest$ApiKey ‑ checkAccess__whenApiKeyIsPresent__thenReturnProperResponse(String, int, String)[2]
com.comet.opik.api.resources.v1.priv.AuthenticationResourceTest$ApiKey ‑ checkAccess__whenApiKeyIsPresent__thenReturnProperResponse(String, int, String)[3]
com.comet.opik.api.resources.v1.priv.AuthenticationResourceTest$ApiKey ‑ getWorkspaceName(String, int, String)[1]
com.comet.opik.api.resources.v1.priv.AuthenticationResourceTest$ApiKey ‑ getWorkspaceName(String, int, String)[2]
com.comet.opik.api.resources.v1.priv.AuthenticationResourceTest$ApiKey ‑ getWorkspaceName(String, int, String)[3]
…
com.comet.opik.api.resources.v1.priv.GuardrailsResourceTest ‑ getTraceStats_containsGuardrails
com.comet.opik.api.resources.v1.priv.GuardrailsResourceTest ‑ testCreateGuardrails_findTraces
com.comet.opik.api.resources.v1.priv.GuardrailsResourceTest ‑ testCreateGuardrails_getTraceById
com.comet.opik.api.resources.v1.priv.PairingResourceRateLimitTest ‑ createSessionReturns429WhenLimitExceeded
com.comet.opik.infrastructure.auth.AuthCredentialsCacheServiceTest ‑ multiplePermissionsWithSharedWorkspaceMetadataReturnsCachedCredentials
com.comet.opik.infrastructure.auth.AuthCredentialsCacheServiceTest ‑ permissionsRequireBothV3AndV2CachePresent
com.comet.opik.infrastructure.auth.AuthCredentialsCacheServiceTest ‑ testCacheAndRetrieveOpikVersion(OpikVersion)[1]
com.comet.opik.infrastructure.auth.AuthCredentialsCacheServiceTest ‑ testCacheAndRetrieveOpikVersion(OpikVersion)[2]
com.comet.opik.infrastructure.auth.AuthCredentialsCacheServiceTest ‑ testCacheAndRetrieveOpikVersion(OpikVersion)[3]
com.comet.opik.infrastructure.auth.AuthCredentialsCacheServiceTest ‑ testCacheAndRetrieveQuotas(List)[1]
…

♻️ This comment has been updated with latest results.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Backend baz: pending java Pull requests that update Java code 🟡 size/M tests Including test files, or tests related like configuration.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant