Skip to content

fix(sparc-service): WatsonX reasoning-model support + Dockerfile fix + SPARC_SKIP_TOOLS - #739

Open
vz-ibm wants to merge 2 commits into
rossoctl:mainfrom
vz-ibm:fix/watsonx-and-sparc-skip-tools
Open

fix(sparc-service): WatsonX reasoning-model support + Dockerfile fix + SPARC_SKIP_TOOLS#739
vz-ibm wants to merge 2 commits into
rossoctl:mainfrom
vz-ibm:fix/watsonx-and-sparc-skip-tools

Conversation

@vz-ibm

@vz-ibm vz-ibm commented Aug 5, 2026

Copy link
Copy Markdown
Collaborator

What this bundles

Three related sparc-service fixes ported from the old kagenti-sparc
codebase, needed to run SPARC on a rossoctl cluster:

1. WatsonX reasoning-model patches

  • _patch_watsonx_for_reasoning_models — injects the response schema via
    system prompt instead of response_format for WatsonX reasoning models
    and the IBM LiteLLM proxy, which don't support response_format.
  • _patch_empty_response_retry — retries on ValueError: No content or tool calls found (an upstream ALTK bug not yet fixed there), with
    exponential backoff.
  • Optional debug logging behind SPARC_DEBUG_LLM=true.

2. Dockerfile chown fix

Without this the pod crashes on startup — found live while deploying to a
rossoctl cluster (non-root user can't access files owned by root in the
image layer).

3. SPARC_SKIP_TOOLS

SPARC_SKIP_TOOLS=<comma-separated tool names> — auto-approves the named
tools without SPARC evaluation. Needed for infrastructure tools
(message, calculate, create_session, etc.) and READ-only domain
tools that have no policy risk and would otherwise cause false-positive
rejects. Only WRITE tools should go through SPARC's actual reasoning.

Verification

All three were run live on a rossoctl Kind cluster: SPARC deployed and
serving /reflect successfully with a WatsonX-compatible LiteLLM
backend, pod stable across restarts, and SPARC_SKIP_TOOLS confirmed via
startup log (the following tools will be auto-approved without evaluation: [...]) plus a full 50-task Tau2 airline benchmark run
completing cleanly with the skip list active.

vz-ibm and others added 2 commits August 5, 2026 08:24
Cherry-picked from vz-ibm/kagenti-extensions branch
fix/sparc-watsonx-reasoning-patch (a real GitHub fork of this repo,
just carrying its pre-rename display name), isolated to providers.py
and the Makefile only — that branch as a whole is 400+ files behind
current main (missing tlsbridge, contextguru, cpex, and other
subsystems merged since it diverged), so checking it out directly
would have regressed main rather than just adding the fix.

Three patches to providers.py:
- _patch_watsonx_for_reasoning_models: WatsonX + IBM LiteLLM proxy
  return reasoning_content, not content; without this all semantic
  SPARC calls fail with decision=error
- _patch_empty_response_retry: retries on ValueError from empty
  responses (ISSUE-019), which the IBM LiteLLM proxy returns
  intermittently under load
- _patch_debug_logging: optional SPARC_DEBUG_LLM=true logging

Makefile: kind-load target falls back to `podman save | kind load
image-archive` when `kind load docker-image` fails (always fails on
Linux with rootful Podman).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
…IP_TOOLS, logging)

Continuing the cherry-pick from vz-ibm/kagenti-extensions
fix/sparc-watsonx-reasoning-patch — the first commit only covered
providers.py and the deploy Makefile; this one picks up the rest of
what that branch touched under authbridge/sparc-service/:

- Dockerfile: chown -R sparc:sparc /app before USER sparc — without
  this, the container crashes on startup with PermissionError since
  files copied as root are unreadable by the non-root user
- api.py: adds SPARC_SKIP_TOOLS (auto-approve named tools without
  evaluation — required by Step 24 of the VPC guide, which sets this
  env var directly and would silently no-op without this patch),
  SPARC_LOG_REQUESTS, and SPARC_STRIP_TOOL_ARG_KEYS
- engine.py: reflect log line now includes tool name/args/timestamp
  for correlation; splits INFO (clean) vs DEBUG (verbose) detail
- settings.py, __main__.py: litellm.watsonx provider alias, INFO/DEBUG
  log level split, SPARC_DEBUG_LLM flag

Deliberately NOT ported: the Go-side strip_tool_args patch to
authbridge/authlib/plugins/sparc/ (collect.go, plugin.go) — that
requires a separate authbridge-proxy image rebuild and isn't needed
for the retail/airline benchmarks; the VPC guide's Step 19 already
notes it's unusable without a custom AuthBridge build.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@vz-ibm
vz-ibm requested a review from a team as a code owner August 5, 2026 08:25
@coderabbitai

coderabbitai Bot commented Aug 5, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@vz-ibm, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 58 minutes

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 6d9b8dce-1138-44ad-abcd-44138537b542

📥 Commits

Reviewing files that changed from the base of the PR and between fe449ae and e2ab362.

📒 Files selected for processing (8)
  • authbridge/sparc-service/Dockerfile
  • authbridge/sparc-service/deploy/Makefile
  • authbridge/sparc-service/sparc_service/__main__.py
  • authbridge/sparc-service/sparc_service/api.py
  • authbridge/sparc-service/sparc_service/engine.py
  • authbridge/sparc-service/sparc_service/providers.py
  • authbridge/sparc-service/sparc_service/settings.py
  • authbridge/sparc-service/tests/test_haiku_empty_response.py

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

tool_name = request.tool_calls[0].get("function", {}).get("name", "")
if tool_name in _SKIP_TOOLS:
# DEBUG: per-call skip entry — visible only at DEBUG level
log.debug("reflect tool=%s skipped (SPARC_SKIP_TOOLS)", tool_name)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: New/ToDo

Development

Successfully merging this pull request may close these issues.

3 participants