Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

[MISC] Surface LLMWhisperer adapter env knobs in workers sample.env#2113

Merged
chandrasekharan-zipstack merged 1 commit into
mainZipstack/unstract:mainfrom
feat/llmw-worker-envsZipstack/unstract:feat/llmw-worker-envsCopy head branch name to clipboard
Jun 25, 2026
Merged

[MISC] Surface LLMWhisperer adapter env knobs in workers sample.env#2113
chandrasekharan-zipstack merged 1 commit into
mainZipstack/unstract:mainfrom
feat/llmw-worker-envsZipstack/unstract:feat/llmw-worker-envsCopy head branch name to clipboard

Conversation

@chandrasekharan-zipstack

Copy link
Copy Markdown
Contributor

What

  • Add the ADAPTER_LLMW_* control knobs to workers/sample.env so the in-process LLMWhisperer extraction running inside the file-processing workers can actually be tuned.

Why

  • Text extraction no longer runs in a separate tool container — the SDK x2text adapter runs in-process inside the file-processing workers (workers/executor/executors/legacy_executor.py:_handle_extract).
  • These knobs are read via os.getenv in the SDK (unstract/sdk1/.../x2text/llm_whisperer_v2/src/constants.py) at import time, from the worker process env.
  • Previously they were only documented/set on the backend & prompt-service envs, so the worker fell back to SDK defaults. A customer hit Whisper client operation timed out and there was no surfaced way to raise the wait in the worker.

How

  • Added to workers/sample.env:
    • ADAPTER_LLMW_WAIT_TIMEOUT=900 (V2 — overall wait-for-completion; the timeout knob)
    • ADAPTER_LLMW_MAX_RETRIES=3, ADAPTER_LLMW_RETRY_MIN_WAIT=1.0, ADAPTER_LLMW_RETRY_MAX_WAIT=60.0 (V2 — per-HTTP-call transient retry backoff)
    • ADAPTER_LLMW_POLL_INTERVAL=30, ADAPTER_LLMW_MAX_POLLS=1000 (V1 deprecated — status polling)

Can this PR break any existing features. If yes, please list possible items. If no, please explain why. (PS: Admins do not merge the PR without this section filled)

  • No. Only adds entries to a sample env template. Values equal the existing SDK defaults, so behaviour is unchanged unless an operator overrides them.

Database Migrations

  • None

Env Config

  • New (documented) worker envs: ADAPTER_LLMW_WAIT_TIMEOUT, ADAPTER_LLMW_MAX_RETRIES, ADAPTER_LLMW_RETRY_MIN_WAIT, ADAPTER_LLMW_RETRY_MAX_WAIT, ADAPTER_LLMW_POLL_INTERVAL, ADAPTER_LLMW_MAX_POLLS.

Relevant Docs

  • These knobs are currently undocumented in public docs — separate docs PR recommended.

Related Issues or PRs

  • Cloud helm counterpart: Zipstack/unstract-cloud feat/llmw-worker-envs (wires the same knobs into the worker configMap).

Dependencies Versions

  • None

Notes on Testing

  • Set ADAPTER_LLMW_WAIT_TIMEOUT to a low value on a file-processing worker and confirm a slow LLMWhisperer V2 extraction times out at that bound; raise it and confirm the extraction completes.

Screenshots

Checklist

I have read and understood the Contribution Guidelines.

🤖 Generated with Claude Code

Text extraction now runs in-process inside the file-processing workers
(via the SDK x2text adapter), not in a separate tool container. The
ADAPTER_LLMW_* knobs are read with os.getenv from the worker process, so
they must be present in the worker env; previously they were only set on
the backend/prompt envs and silently fell back to SDK defaults.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SBT1USHvaBLqEi9Xd8NoBP
@coderabbitai

coderabbitai Bot commented Jun 25, 2026

Copy link
Copy Markdown
Contributor

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 4d54cb01-db59-470d-86e6-2732766bf586

📥 Commits

Reviewing files that changed from the base of the PR and between 069a177 and 44091ad.

📒 Files selected for processing (1)
  • workers/sample.env

Summary by CodeRabbit

  • Chores
    • Added new configuration options for adapter LLM worker operations, including timeout, retry, polling interval, and poll limit settings.

Walkthrough

Added adapter LLM environment variable examples for wait timeout, retry behavior, polling interval, and maximum poll count.

Changes

Adapter LLM Configuration

Layer / File(s) Summary
Adapter LLM environment variables
workers/sample.env
Adapter LLM wait timeout, retry bounds, polling interval, and maximum poll count entries were added to the sample environment file.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~2 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly states the PR's main change: exposing LLMWhisperer adapter env knobs in workers/sample.env.
Description check ✅ Passed The description follows the template and fills the required sections with relevant details about what, why, how, risks, testing, and config.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/llmw-worker-envs

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.

@chandrasekharan-zipstack chandrasekharan-zipstack changed the title [FIX] Surface LLMWhisperer adapter env knobs in workers sample.env [MISC] Surface LLMWhisperer adapter env knobs in workers sample.env Jun 25, 2026
@greptile-apps

greptile-apps Bot commented Jun 25, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR surfaces the ADAPTER_LLMW_* environment knobs in workers/sample.env so operators can tune the in-process LLMWhisperer extraction running inside the file-processing worker without having to know the SDK internals.

  • Six env variables are added (WAIT_TIMEOUT, MAX_RETRIES, RETRY_MIN_WAIT, RETRY_MAX_WAIT, POLL_INTERVAL, MAX_POLLS); all values match the existing SDK defaults, so no runtime behaviour changes unless an operator overrides them.
  • The V1 polling knobs (POLL_INTERVAL, MAX_POLLS) are correctly annotated as deprecated in the PR description, and the V2 retry knobs are the primary actionable addition addressing the reported Whisper client operation timed out issue.

Confidence Score: 5/5

Safe to merge — the change only adds entries to a sample env template and does not touch any executable code.

The only file touched is workers/sample.env. All added values match the SDK defaults, so deploying the unchanged sample produces identical behaviour to before. The sole suggestions are cosmetic: adding section comments and the STATUS_RETRIES knob for parity with the other service env files.

No files require special attention; the suggestion on workers/sample.env is purely about adding documentation-style comments for operator clarity.

Important Files Changed

Filename Overview
workers/sample.env Adds 6 ADAPTER_LLMW_* env knobs for the in-process LLMWhisperer adapter running inside file-processing workers; values match SDK V2 defaults. Missing ADAPTER_LLMW_STATUS_RETRIES and inline comments present in the other service sample.env files.

Sequence Diagram

%%{init: {'theme': 'neutral'}}%%
sequenceDiagram
    participant Ops as Operator
    participant Env as workers/sample.env
    participant Worker as File-Processing Worker
    participant SDK as SDK x2text Adapter (llm_whisperer_v2)
    participant LLMW as LLMWhisperer API

    Ops->>Env: Set ADAPTER_LLMW_WAIT_TIMEOUT, MAX_RETRIES, RETRY_MIN/MAX_WAIT
    Env->>Worker: Env vars injected at startup
    Worker->>SDK: _handle_extract() calls adapter in-process
    Note over SDK: os.getenv reads ADAPTER_LLMW_* at import time (WhispererDefaults)
    SDK->>LLMW: POST /whisper (extraction request)
    LLMW-->>SDK: Processing...
    loop Poll until WAIT_TIMEOUT
        SDK->>LLMW: GET /whisper-status
        LLMW-->>SDK: "status=processing"
    end
    LLMW-->>SDK: "status=processed"
    SDK-->>Worker: Extracted text
    Worker-->>Ops: Result
Loading
%%{init: {'theme': 'base', 'themeVariables': {"darkMode": true, "background": "#0d1117", "primaryColor": "#21262d", "primaryTextColor": "#e6edf3", "primaryBorderColor": "#8b949e", "lineColor": "#8b949e", "textColor": "#e6edf3", "edgeLabelBackground": "#161b22", "actorBkg": "#21262d", "actorBorder": "#8b949e", "actorTextColor": "#e6edf3", "actorLineColor": "#8b949e", "signalColor": "#8b949e", "signalTextColor": "#e6edf3", "noteBkgColor": "#373320", "noteBorderColor": "#d4a72c", "noteTextColor": "#f0e6c0", "labelBoxBkgColor": "#21262d", "labelBoxBorderColor": "#8b949e", "labelTextColor": "#e6edf3", "loopTextColor": "#e6edf3", "activationBkgColor": "#30363d", "activationBorderColor": "#8b949e"}}}%%
sequenceDiagram
    participant Ops as Operator
    participant Env as workers/sample.env
    participant Worker as File-Processing Worker
    participant SDK as SDK x2text Adapter (llm_whisperer_v2)
    participant LLMW as LLMWhisperer API

    Ops->>Env: Set ADAPTER_LLMW_WAIT_TIMEOUT, MAX_RETRIES, RETRY_MIN/MAX_WAIT
    Env->>Worker: Env vars injected at startup
    Worker->>SDK: _handle_extract() calls adapter in-process
    Note over SDK: os.getenv reads ADAPTER_LLMW_* at import time (WhispererDefaults)
    SDK->>LLMW: POST /whisper (extraction request)
    LLMW-->>SDK: Processing...
    loop Poll until WAIT_TIMEOUT
        SDK->>LLMW: GET /whisper-status
        LLMW-->>SDK: "status=processing"
    end
    LLMW-->>SDK: "status=processed"
    SDK-->>Worker: Extracted text
    Worker-->>Ops: Result
Loading

Fix All in Claude Code

Prompt To Fix All With AI
Fix the following 1 code review issue. Work through them one at a time, proposing concise fixes.

---

### Issue 1 of 1
workers/sample.env:304-309
The new LLMW entries have no section header or per-variable comments. Both `prompt-service/sample.env` and `backend/sample.env` wrap these knobs in a descriptive block with comments explaining units and acceptable ranges (e.g. the 500-min justification for `MAX_POLLS`). An operator tuning the worker without that context may misread the semantics of, say, `RETRY_MIN_WAIT` (seconds, not milliseconds) or `WAIT_TIMEOUT` (overall extraction wait, not per-HTTP-call). Additionally, `ADAPTER_LLMW_STATUS_RETRIES=5` (present in both other service sample files) is absent here — while the variable has no Python reader today, omitting it creates an inconsistency that could confuse operators aligning configs across services.

```suggestion
# LLMWhisperer Adapter Tuning
# Timeout for LLMW (v2) overall extraction wait in seconds
ADAPTER_LLMW_WAIT_TIMEOUT=900  # 15 mins
# Retry backoff for LLMWhisperer client (v2)
# Max retry attempts for transient HTTP errors (429, 5xx). Set 0 to disable.
ADAPTER_LLMW_MAX_RETRIES=3
# Min backoff wait in seconds between retries
ADAPTER_LLMW_RETRY_MIN_WAIT=1.0
# Max backoff wait in seconds between retries
ADAPTER_LLMW_RETRY_MAX_WAIT=60.0
# Control async extraction of LLMWhisperer (v1, deprecated)
# Time in seconds to wait before polling LLMWhisperer's status API
ADAPTER_LLMW_POLL_INTERVAL=30
# Total number of times to poll the status API
# 500 mins to allow 1500 (max pages limit) * 20 (approx time in sec to process a page)
ADAPTER_LLMW_MAX_POLLS=1000
# Number of times to retry the /whisper-status API before failing the extraction
ADAPTER_LLMW_STATUS_RETRIES=5
```

Reviews (1): Last reviewed commit: "[FIX] Surface LLMWhisperer adapter env k..." | Re-trigger Greptile

Comment thread workers/sample.env
@github-actions

Copy link
Copy Markdown
Contributor

Unstract test results

Per-group results

Status Group Tier Passed Failed Errors Skipped Duration (s)
unit-connectors unit 64 12 0 3 17.0
unit-core unit 0 0 4 0 1.2
unit-platform-service unit 9 0 1 0 1.4
unit-prompt-service unit 15 0 0 0 20.3
unit-rig unit 53 0 0 0 3.4
unit-runner unit 11 0 0 0 3.2
unit-sdk1 unit 390 0 0 0 20.7
unit-tool-registry unit 0 0 1 0 1.4
unit-workers unit 0 0 0 0 17.5
TOTAL 542 12 6 3 86.0

Critical paths

⚠️ Critical paths not yet covered

  • auth-login — User can log in and obtain a session cookie. (entry: POST /api/v1/auth/login; declared coverage: no groups declared)
  • adapter-register-llm — Register and validate an LLM adapter. (entry: POST /api/v1/adapter/; declared coverage: no groups declared)
  • workflow-create-execute — Create a workflow, configure source+destination, execute, poll, fetch result. (entry: POST /api/v1/workflow/{id}/execute/; declared coverage: e2e-workflow)
  • api-deployment-run — Deploy a workflow as an API, POST a document, receive structured JSON. (entry: POST /deployment/api/{org}/{name}/; declared coverage: e2e-api-deployment)
  • prompt-studio-fetch-response — Prompt Studio: create project, add prompt, run single-pass, get response. (entry: POST /api/v1/prompt-studio/prompt-studio-tool/{id}/fetch_response/; declared coverage: e2e-prompt-studio)
  • pipeline-etl-execute — Run an ETL pipeline from source connector to destination. (entry: POST /api/v1/pipeline/{id}/execute/; declared coverage: no groups declared)
  • usage-token-tracking — Per-execution token usage is recorded and retrievable. (entry: GET /api/v1/usage/get_token_usage/; declared coverage: no groups declared)
  • workflow-execution-fan-out — Multi-file workflow execution fans out to file-processing workers and rejoins. (entry: internal: backend → rabbitmq → workers/file_processing; declared coverage: no groups declared)
  • callback-result-delivery — Async results are posted back via the callback worker. (entry: internal: workers/callback → backend /internal endpoints; declared coverage: no groups declared)
✅ Covered critical paths
  • tool-sandbox-exec — covered by unit-runner

@chandrasekharan-zipstack chandrasekharan-zipstack merged commit 4f2bb8d into main Jun 25, 2026
8 checks passed
@chandrasekharan-zipstack chandrasekharan-zipstack deleted the feat/llmw-worker-envs branch June 25, 2026 08:18
@sonarqubecloud

Copy link
Copy Markdown

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

Morty Proxy This is a proxified and sanitized view of the page, visit original site.