[MISC] Fix blank LLM profile edit form and settings menu bold style#1896
Conversation
- Replace form.resetFields() with form.setFieldsValue() to fix blank edit form caused by Ant Design's initialValues being a one-time snapshot - Remove Strict Mode-incompatible cleanup that cleared editLlmProfileId - Clear editLlmProfileId in parent when adding new profile - Remove unconditional bold on first settings popover menu item Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Summary by CodeRabbitRelease Notes
WalkthroughThe changes modify the LLM profile management flow by removing automatic cleanup of edit context on component unmount, replacing form reset behavior with field population, and ensuring edit state is cleared when transitioning to add-new mode. Additionally, a CSS style override is removed from the first settings menu item. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes 🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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. Comment |
|
|
| Filename | Overview |
|---|---|
| frontend/src/components/custom-tools/add-llm-profile/AddLlmProfile.jsx | Replaces form.resetFields() with form.setFieldsValue(formDetails) to fix blank edit form; removes Strict-Mode-unsafe unmount cleanup; leaves setEditLlmProfileId as a now-unused required prop. |
| frontend/src/components/custom-tools/manage-llm-profiles/ManageLlmProfiles.jsx | Clears editLlmProfileId in the Add New handler before mounting AddLlmProfile, preventing stale edit ID from leaking into the add flow. |
| frontend/src/components/settings/settings/Settings.css | Removes unintended font-weight: 600 from .settings-menu-item:first-child, aligning with the base font-weight: 400 style. |
Sequence Diagram
sequenceDiagram
participant User
participant ManageLlmProfiles
participant AddLlmProfile
participant AntForm
participant API
User->>ManageLlmProfiles: Click Edit on profile
ManageLlmProfiles->>ManageLlmProfiles: setEditLlmProfileId(profileId)
ManageLlmProfiles->>ManageLlmProfiles: setIsAddLlm(true)
ManageLlmProfiles->>AddLlmProfile: mount(editLlmProfileId=profileId)
AddLlmProfile->>API: GET /adapter
API-->>AddLlmProfile: adapter list
AddLlmProfile->>AddLlmProfile: setAreAdaptersReady(true)
AddLlmProfile->>AddLlmProfile: useEffect[editLlmProfileId, areAdaptersReady] fires
AddLlmProfile->>AddLlmProfile: setResetForm(true) + setFormDetails(profileValues)
AddLlmProfile->>AntForm: form.setFieldsValue(formDetails)
Note over AntForm: Form populated correctly ✓
User->>AddLlmProfile: Click Back
AddLlmProfile->>ManageLlmProfiles: setIsAddLlm(false)
Note over ManageLlmProfiles: editLlmProfileId remains set (stale)
User->>ManageLlmProfiles: Click Add New LLM Profile
ManageLlmProfiles->>ManageLlmProfiles: setEditLlmProfileId(null) ← fix
ManageLlmProfiles->>ManageLlmProfiles: setIsAddLlm(true)
ManageLlmProfiles->>AddLlmProfile: mount(editLlmProfileId=null)
AddLlmProfile->>AddLlmProfile: useEffect[] fires (add mode)
AddLlmProfile->>AddLlmProfile: setFormDetails(emptyValues)
AddLlmProfile->>AntForm: form.setFieldsValue(emptyValues)
Note over AntForm: Form correctly blank for new entry ✓
Comments Outside Diff (1)
-
frontend/src/components/custom-tools/add-llm-profile/AddLlmProfile.jsx, line 37 (link)Unused
setEditLlmProfileIdpropAfter removing the
useEffectunmount cleanup,setEditLlmProfileIdis no longer called anywhere inside this component —editLlmProfileId(the read value) is still used, but its setter is now dead. The PropTypes declaration also marks it as.isRequired, which misleads future readers into thinking the component depends on it.Consider removing it from the destructured props and the PropTypes block (line 658):
Prompt To Fix With AI
This is a comment left during a code review. Path: frontend/src/components/custom-tools/add-llm-profile/AddLlmProfile.jsx Line: 37 Comment: **Unused `setEditLlmProfileId` prop** After removing the `useEffect` unmount cleanup, `setEditLlmProfileId` is no longer called anywhere inside this component — `editLlmProfileId` (the read value) is still used, but its setter is now dead. The PropTypes declaration also marks it as `.isRequired`, which misleads future readers into thinking the component depends on it. Consider removing it from the destructured props and the PropTypes block (line 658): How can I resolve this? If you propose a fix, please make it concise.
Prompt To Fix All With AI
This is a comment left during a code review.
Path: frontend/src/components/custom-tools/add-llm-profile/AddLlmProfile.jsx
Line: 37
Comment:
**Unused `setEditLlmProfileId` prop**
After removing the `useEffect` unmount cleanup, `setEditLlmProfileId` is no longer called anywhere inside this component — `editLlmProfileId` (the read value) is still used, but its setter is now dead. The PropTypes declaration also marks it as `.isRequired`, which misleads future readers into thinking the component depends on it.
Consider removing it from the destructured props and the PropTypes block (line 658):
```suggestion
editLlmProfileId,
setIsAddLlm,
handleDefaultLlm,
```
How can I resolve this? If you propose a fix, please make it concise.Reviews (1): Last reviewed commit: "[MISC] Fix blank LLM profile edit form a..." | Re-trigger Greptile
Frontend Lint Report (Biome)✅ All checks passed! No linting or formatting issues found. |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
frontend/src/components/custom-tools/add-llm-profile/AddLlmProfile.jsx (1)
92-114: Consider addingeditLlmProfileIdto the dependency array for correctness.This effect references
editLlmProfileIdbut has an empty dependency array. While this works correctly in practice because the component always unmounts between edit/add transitions (due toisAddLlmtoggling), adding the dependency would make the code more robust and satisfy the exhaustive-deps lint rule.Suggested fix
setModalTitle("Add New LLM Profile"); setActiveKey(false); - }, []); + }, [editLlmProfileId, details?.tool_id]);🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@frontend/src/components/custom-tools/add-llm-profile/AddLlmProfile.jsx` around lines 92 - 114, The useEffect in AddLlmProfile.jsx that initializes the form on mount currently has an empty dependency array but reads editLlmProfileId; update the dependency array for that useEffect to include editLlmProfileId so the effect re-evaluates when the edit id changes (keep the guard if (editLlmProfileId) return; and the existing calls to setResetForm, setFormDetails, setModalTitle, and setActiveKey unchanged) to satisfy exhaustive-deps and make the component robust.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@frontend/src/components/custom-tools/add-llm-profile/AddLlmProfile.jsx`:
- Around line 92-114: The useEffect in AddLlmProfile.jsx that initializes the
form on mount currently has an empty dependency array but reads
editLlmProfileId; update the dependency array for that useEffect to include
editLlmProfileId so the effect re-evaluates when the edit id changes (keep the
guard if (editLlmProfileId) return; and the existing calls to setResetForm,
setFormDetails, setModalTitle, and setActiveKey unchanged) to satisfy
exhaustive-deps and make the component robust.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: d36b0407-fa78-43bc-966c-a91643743392
📒 Files selected for processing (3)
frontend/src/components/custom-tools/add-llm-profile/AddLlmProfile.jsxfrontend/src/components/custom-tools/manage-llm-profiles/ManageLlmProfiles.jsxfrontend/src/components/settings/settings/Settings.css
💤 Files with no reviewable changes (1)
- frontend/src/components/settings/settings/Settings.css
* [FIX] Executor Queue for Agentic extraction (#1893) * Execution backend - revamp * async flow * Streaming progress to FE * Removing multi hop in Prompt studio ide and structure tool * UN-3234 [FIX] Add beta tag to agentic prompt studio navigation item * Added executors for agentic prompt studio * Added executors for agentic prompt studio * Removed redundant envs * Removed redundant envs * Removed redundant envs * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Removed redundant envs * Removed redundant envs * Removed redundant envs * Removed redundant envs * Removed redundant envs * Removed redundant envs * Removed redundant envs * Removed redundant envs * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Removed redundant envs * adding worker for callbacks * adding worker for callbacks * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * adding worker for callbacks * adding worker for callbacks * adding worker for callbacks * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Pluggable apps and plugins to fit the new async prompt execution architecture * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Pluggable apps and plugins to fit the new async prompt execution architecture * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Pluggable apps and plugins to fit the new async prompt execution architecture * adding worker for callbacks * adding worker for callbacks * adding worker for callbacks * adding worker for callbacks * adding worker for callbacks * adding worker for callbacks * adding worker for callbacks * adding worker for callbacks * fix: write output files in agentic extraction pipeline Agentic extraction returned early without writing INFILE (JSON) or METADATA.json, causing destination connectors to read the original PDF and fail with "Expected tool output type: TXT, got: application/pdf". Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * UN-3266 fix: replace hardcoded /tmp paths with secure temp dirs in tests (#1850) * UN-3266 fix: replace hardcoded /tmp paths with secure temp dirs in tests Replace hardcoded /tmp/ paths (SonarCloud S5443 security hotspots) with pytest's tmp_path fixture or module-level tempfile.mkdtemp() constants in all affected test files to avoid world-writable directory vulnerabilities. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --------- Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Update docs * UN-3266 fix: remove dead code with undefined names in fetch_response Remove unreachable code block after the async callback return in fetch_response that still referenced output_count_before and response from the old synchronous implementation, causing ruff F821 errors. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * Un 3266 fix security hotspot tmp paths (#1851) * UN-3266 fix: replace hardcoded /tmp paths with secure temp dirs in tests Replace hardcoded /tmp/ paths (SonarCloud S5443 security hotspots) with pytest's tmp_path fixture or module-level tempfile.mkdtemp() constants in all affected test files to avoid world-writable directory vulnerabilities. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * UN-3266 fix: resolve ruff linting failures across multiple files - B026: pass url positionally in worker_celery.py to avoid star-arg after keyword - N803: rename MockAsyncResult to mock_async_result in test_tasks.py - E501/I001: fix long line and import sort in llm_whisperer helper - ANN401: replace Any with object|None in dispatcher.py; add noqa in test helpers - F841: remove unused workflow_id and result assignments Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --------- Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> * UN-3266 fix: resolve SonarCloud bugs S2259 and S1244 in PR #1849 - S2259: guard against None after _discover_plugins() in loader.py to satisfy static analysis on the dict[str,type]|None field type - S1244: replace float equality checks with pytest.approx() in test_answer_prompt.py and test_phase2h.py Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * UN-3266 fix: resolve SonarCloud code smells in PR #1849 - S5799: Merge all implicit string concatenations in log messages (legacy_executor.py, tasks.py, dispatcher.py, orchestrator.py, registry.py, variable_replacement.py, structure_tool_task.py) - S1192: Extract duplicate literal to _NO_CELERY_APP_MSG constant in dispatcher.py - S1871: Merge identical elif/else branches in tasks.py and test_sanity_phase6j.py - S1186: Add comment to empty stub method in test_sanity_phase6a.py - S1481: Remove unused local variables in test_sanity_phase6d/e/f/g/h/j and test_phase5d.py - S117: Rename PascalCase local variables to snake_case in test_sanity_phase3/5/6i.py - S5655: Broaden tool type annotation to StreamMixin in IndexingUtils.generate_index_key and PlatformHelper.get_adapter_config - docker:S7031: Merge consecutive RUN instructions in worker-unified.Dockerfile - javascript:S1128: Remove unused pollForCompletion import in usePromptRun.js Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * UN-3266 fix: wrap long log message in dispatcher.py to fix E501 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * UN-3266 fix: resolve remaining SonarCloud S117 naming violations Rename PascalCase local variables to snake_case to comply with S117: - legacy_executor.py: rename tuple-unpacked _get_prompt_deps() results (AnswerPromptService→answer_prompt_svc, RetrievalService→retrieval_svc, VariableReplacementService→variable_replacement_svc, LLM→llm_cls, EmbeddingCompat→embedding_compat_cls, VectorDB→vector_db_cls) and update all downstream usages including _apply_type_conversion and _handle_summarize - test_phase1_log_streaming.py: rename Mock* local variables to mock_* snake_case equivalents - test_sanity_phase3.py: rename MockDispatcher→mock_dispatcher_cls and MockShim→mock_shim_cls across all 10 test methods - test_sanity_phase5.py: rename MockShim→mock_shim, MockX2Text→mock_x2text in 6 test methods; MockDispatcher→mock_dispatcher_cls in dispatch test; fix LLM_cls→llm_cls, EmbeddingCompat→embedding_compat_cls, VectorDB→vector_db_cls in _mock_prompt_deps helper Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * UN-3266 fix: resolve remaining SonarCloud code smells in PR #1849 - test_sanity_phase2/4.py, test_answer_prompt.py: rename PascalCase local variables in _mock_prompt_deps/_mock_deps to snake_case (RetrievalService→retrieval_svc, VariableReplacementService→ variable_replacement_svc, Index→index_cls, LLM_cls→llm_cls, EmbeddingCompat→embedding_compat_cls, VectorDB→vector_db_cls, AnswerPromptService→answer_prompt_svc_cls) — fixes S117 - test_sanity_phase3.py: remove unused local variable "result" — fixes S1481 - structure_tool_task.py: remove redundant json.JSONDecodeError from except clause (subclass of ValueError) — fixes S5713 - shared/workflow/execution/service.py: replace generic Exception with RuntimeError for structure tool failure — fixes S112 - run-worker-docker.sh: define EXECUTOR_WORKER_TYPE constant and replace 10 literal "executor" occurrences — fixes S1192 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * UN-3266 fix: resolve SonarCloud cognitive complexity and code smell violations - Reduce cognitive complexity in answer_prompt.py: - Extract _build_grammar_notes, _run_webhook_postprocess helpers - _is_safe_public_url: extracted _resolve_host_addresses helper - handle_json: early-return pattern eliminates nesting - construct_prompt: delegates grammar loop to _build_grammar_notes - Reduce cognitive complexity in legacy_executor.py: - Extract _execute_single_prompt, _run_table_extraction helpers - Extract _run_challenge_if_enabled, _run_evaluation_if_enabled - Extract _inject_table_settings, _finalize_pipeline_result - Extract _convert_number_answer, _convert_scalar_answer - Extract _sanitize_dict_values helper - _handle_answer_prompt CC reduced from 50 to ~7 - Reduce CC in structure_tool_task.py: guard-clause refactor - Reduce CC in backend: dto.py, deployment_helper.py, api_deployment_views.py, prompt_studio_helper.py - Fix S117: rename PascalCase local vars in test_answer_prompt.py - Fix S1192: extract EXECUTOR_WORKER_TYPE constant in run-worker.sh - Fix S1172: remove unused params from structure_tool_task.py - Fix S5713: remove redundant JSONDecodeError in json_repair_helper.py - Fix S112/S5727 in test_execution.py Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * UN-3266 fix: remove unused RetrievalStrategy import from _handle_answer_prompt Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * UN-3266 fix: rename UsageHelper params to lowercase (N803) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * UN-3266 fix: resolve remaining SonarCloud issues from check run 66691002192 - Add @staticmethod to _sanitize_null_values (fixes S2325 missing self) - Reduce _execute_single_prompt params from 25 to 11 (S107) by grouping services as deps tuple and extracting exec params from context.executor_params - Add NOSONAR suppression for raise exc in test helper (S112) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * UN-3266 fix: remove unused locals in _handle_answer_prompt (F841) execution_id, file_hash, log_events_id, custom_data are now extracted inside _execute_single_prompt from context.executor_params. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * fix: resolve Biome linting errors in frontend source files Auto-fixed 48 lint errors across 56 files: import ordering, block statements, unused variable prefixing, and formatting issues. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: replace dynamic import of SharePermission with static import in Workflows Resolves vite build warning about SharePermission.jsx being both dynamically and statically imported across the codebase. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: resolve SonarCloud warnings in frontend components - Remove unnecessary try-catch around PostHog event calls - Flip negated condition in PromptOutput.handleTable for clarity Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Address PR #1849 review comments: fix null guards, dead code, and test drift - Remove redundant inline `import uuid as _uuid` in views.py (use module-level uuid) - URL-encode DB_USER in worker_celery.py result backend connection string - Remove misleading task_queues=[Queue("executor")] from dispatch-only Celery app - Remove dead `if not tool:` guards after objects.get() (already raises DoesNotExist) - Move profile_manager/default_profile null checks before first dereference - Reorder ProfileManager.objects.get before mark_document_indexed in tasks.py - Handle ProfileManager.DoesNotExist as warning, not hard failure - Wrap PostHog analytics in try/catch so failures don't block prompt execution - Handle pending-indexing 200 response in usePromptRun.js (clear RUNNING status) - Reset formData when metadata is missing in ConfigureDs.jsx - Fix test_should_skip_extraction tests: function now takes 1 arg (outputs only) - Fix agentic routing tests: mock X2Text.process, remove stale platform_helper kwarg Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Fix missing llm_usage_reason for summarize LLM usage tracking Add PSKeys.LLM_USAGE_REASON to usage_kwargs in _handle_summarize() so summarization costs appear under summarize_llm in API response metadata. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * UN-3266 [FIX] Fix single-pass extraction routing in LegacyExecutor - Route _handle_structure_pipeline to _handle_single_pass_extraction when is_single_pass=True (was always calling _handle_answer_prompt) - Delegate _handle_single_pass_extraction to cloud plugin via ExecutorRegistry, falling back to _handle_answer_prompt if plugin not installed Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * Fixing API depployment response mismatches * Fix single-pass extraction showing only one prompt result in real-time - Fix accumulation bug in usePromptOutput updateCoverage() where each loop iteration spread the original promptOutputs instead of the accumulating updatedPromptOutputs, causing only the last prompt to render - Improve index success toast to show document name - Strip adapter names from index key configs for consistent hashing - Update sdk1 uv.lock Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * Move summarize from sync Django plugin to executor worker for IDE index When "Summarize" is enabled and a user indexes a new document in Prompt Studio, the backend returned a 500 because the sync Django plugin tried to read the extracted .txt file before extraction happened in the worker. Fix: defer summarization to the executor worker's _handle_ide_index (extract → summarize → index), build summarize_params in the payload, and track the summarize index in the ide_index_complete callback. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * Address PR #1849 review comments: null guards, thread safety - Fix null guard ordering in build_index_payload: add DefaultProfileError check before calling validators on default_profile - Fix null guard ordering in _fetch_single_pass_response: move check before .llm.id access and validators (was dead code after dereference) - Add threading.Lock to worker_celery singleton to prevent race under concurrent gunicorn threads Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * Add documentation to ExecutionResponse DTO describing result structure Documents the ExecutionResponse dataclass fields, especially the result attribute's per-file dict structure (output, metadata, metrics, error keys) as requested in PR review. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * Fix PR review issues: IDOR, null guards, rollback, spinner, summarize, prompt lookup - Strip result payload from task_status to prevent IDOR data leak - Move null guard before validators in build_fetch_response_payload - Roll back indexing flag on broker failure in index_document - Use explicit IDs for spinner clearing instead of ORM serialization format - Catch broad exceptions in summarize tracking to prevent false failures - Guard prompt_id lookup in fetch_response with 400/404 responses Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Fix CI, tests, and add async prompt studio improvements - Fix biome import ordering in frontend test files - Fix 22 stale backend test assertions in test_tasks.py (patch targets, return values, view dispatch pattern, remove TestCeleryConfig) - Add ide_prompt_complete callback tests - Add frontend vitest config and regression tests for null guards, stale closures, and single-pass loading guard - Add LLMCompat llama-index compatibility wrapper in SDK1 - Add litellm cohere embed timeout monkey-patch (v1.82.3) - Improve S3 filesystem helper (region_name, empty credential handling) - Add RetrieverLLM and lazy LLM creation for retrievers - Improve worker cleanup: api_client.close() in finally blocks, early return on setup failure in API deployment tasks - Add workers conftest.py for test environment setup Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Fix pre-existing biome CI errors: import ordering and formatting Auto-fix 18 pre-existing organizeImports and formatting errors across 17 frontend files that were blocking biome ci on the entire codebase. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * Fix ruff F821: add missing transaction import in prompt_studio_helper Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * Add input validation guards to bulk_fetch_response endpoint Validate prompt_ids (non-empty), document_id (required), and handle DoesNotExist for both prompts and document to return proper 400/404 instead of dispatching no-op tasks or raising unhandled 500 errors. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * IDE Call backs * Sonar issues fix * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Fix ruff errors: restore summary_profile variable, suppress TC001 in dispatcher Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Update bun.lock to match package.json dependency ranges Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * Fix all biome lint warnings: empty blocks, missing braces, forEach returns, unused vars Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * Move ExecutionContext import into TYPE_CHECKING block Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Fix SonarQube issues: duplication, naming, nesting, unused var - Extract _parse_json_body() helper and _ERR_INVALID_JSON constant to deduplicate 5 identical JSON parsing blocks in internal_views.py - Rename `User` local variable to `user_model` (naming convention) - Merge _emit_result/_emit_error into unified _emit_event() in ide_callback tasks to reduce code duplication - Extract _get_task_error() helper to deduplicate AsyncResult error retrieval in ide_index_error and ide_prompt_error - Remove unused `mock_ar_cls` variable in test_ide_callback.py - Add security note documenting why @csrf_exempt is safe on internal endpoints Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * Replace worker-ide-callback Dockerfile with worker-unified The IDE callback worker should use the unified worker image (worker-unified.Dockerfile) consistent with all other v2 workers. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * Add celery_executor_agentic queue to executor worker The executor worker only consumed from celery_executor_legacy, but the agentic prompt studio dispatches tasks to celery_executor_agentic. This caused agentic operations to sit in RabbitMQ with no consumer, resulting in timeouts and stuck-in-progress states. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * FIxing email enforce type * Removing line-item from select choices * Update workers/shared/enums/worker_enums_base.py Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com> Signed-off-by: harini-venkataraman <115449948+harini-venkataraman@users.noreply.github.com> * Update backend/workflow_manager/workflow_v2/workflow_helper.py Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com> Signed-off-by: harini-venkataraman <115449948+harini-venkataraman@users.noreply.github.com> * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Fix false success logs and silent failures in ETL destination pipelines - Widen except clause in structure_tool_task to catch FileOperationError and log write paths for diagnostics - Add diagnostic logging at all silent return-None points in destination connector so missing INFILE/METADATA paths are visible in logs - Raise RuntimeError instead of silently skipping when no tool execution result is available for DB/FS destinations, preventing false success - Remove dead retry config from execute_bin task (max_retries=0) - Fix duplicate EXECUTOR/IDE_CALLBACK enum entries in WorkerType Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Revert ETL destination pipeline changes — deferring to next cut Reverts diagnostic logging and error-raising changes in structure_tool_task.py and destination_connector.py. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> --------- Signed-off-by: harini-venkataraman <115449948+harini-venkataraman@users.noreply.github.com> Co-authored-by: Ghost Jake <89829542+Deepak-Kesavan@users.noreply.github.com> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com> Co-authored-by: Ritwik G <100672805+ritwik-g@users.noreply.github.com> Co-authored-by: Kirtiman Mishra <110175055+kirtimanmishrazipstack@users.noreply.github.com> Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com> * [MISC] Fix blank LLM profile edit form and settings menu bold style (#1896) - Replace form.resetFields() with form.setFieldsValue() to fix blank edit form caused by Ant Design's initialValues being a one-time snapshot - Remove Strict Mode-incompatible cleanup that cleared editLlmProfileId - Clear editLlmProfileId in parent when adding new profile - Remove unconditional bold on first settings popover menu item Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * [FEAT] Port LINE_ITEM extraction to pluggable executor architecture LINE_ITEM enforce_type prompts previously raised an unconditional error in the new workers executor. Wire the structure-tool path to delegate to a `line_item` executor plugin (mirroring how TABLE delegates to the `table_extractor` plugin), so API deployments / ETL pipelines can run LINE_ITEM extraction once the cloud `line_item_extractor` plugin is installed. - legacy_executor.py: replace the LINE_ITEM error site in `_execute_single_prompt` with a delegation call and add a new `_run_line_item_extraction()` method structurally identical to `_run_table_extraction()`. - test_line_item_extraction.py: 5 new tests covering plugin missing, success, sub-context construction, failure path, and end-to-end Celery eager-mode delegation. - test_sanity_phase6d.py: update the existing LINE_ITEM guard test to match the new "install the line_item_extractor plugin" hint and patch `ExecutorRegistry.get` to simulate the missing plugin. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> --------- Signed-off-by: harini-venkataraman <115449948+harini-venkataraman@users.noreply.github.com> Co-authored-by: Ghost Jake <89829542+Deepak-Kesavan@users.noreply.github.com> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com> Co-authored-by: Ritwik G <100672805+ritwik-g@users.noreply.github.com> Co-authored-by: Kirtiman Mishra <110175055+kirtimanmishrazipstack@users.noreply.github.com> Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com> Co-authored-by: Chandrasekharan M <117059509+chandrasekharan-zipstack@users.noreply.github.com>
* [FIX] Executor Queue for Agentic extraction (#1893) * Execution backend - revamp * async flow * Streaming progress to FE * Removing multi hop in Prompt studio ide and structure tool * UN-3234 [FIX] Add beta tag to agentic prompt studio navigation item * Added executors for agentic prompt studio * Added executors for agentic prompt studio * Removed redundant envs * Removed redundant envs * Removed redundant envs * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Removed redundant envs * Removed redundant envs * Removed redundant envs * Removed redundant envs * Removed redundant envs * Removed redundant envs * Removed redundant envs * Removed redundant envs * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Removed redundant envs * adding worker for callbacks * adding worker for callbacks * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * adding worker for callbacks * adding worker for callbacks * adding worker for callbacks * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Pluggable apps and plugins to fit the new async prompt execution architecture * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Pluggable apps and plugins to fit the new async prompt execution architecture * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Pluggable apps and plugins to fit the new async prompt execution architecture * adding worker for callbacks * adding worker for callbacks * adding worker for callbacks * adding worker for callbacks * adding worker for callbacks * adding worker for callbacks * adding worker for callbacks * adding worker for callbacks * fix: write output files in agentic extraction pipeline Agentic extraction returned early without writing INFILE (JSON) or METADATA.json, causing destination connectors to read the original PDF and fail with "Expected tool output type: TXT, got: application/pdf". Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * UN-3266 fix: replace hardcoded /tmp paths with secure temp dirs in tests (#1850) * UN-3266 fix: replace hardcoded /tmp paths with secure temp dirs in tests Replace hardcoded /tmp/ paths (SonarCloud S5443 security hotspots) with pytest's tmp_path fixture or module-level tempfile.mkdtemp() constants in all affected test files to avoid world-writable directory vulnerabilities. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --------- Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Update docs * UN-3266 fix: remove dead code with undefined names in fetch_response Remove unreachable code block after the async callback return in fetch_response that still referenced output_count_before and response from the old synchronous implementation, causing ruff F821 errors. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * Un 3266 fix security hotspot tmp paths (#1851) * UN-3266 fix: replace hardcoded /tmp paths with secure temp dirs in tests Replace hardcoded /tmp/ paths (SonarCloud S5443 security hotspots) with pytest's tmp_path fixture or module-level tempfile.mkdtemp() constants in all affected test files to avoid world-writable directory vulnerabilities. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * UN-3266 fix: resolve ruff linting failures across multiple files - B026: pass url positionally in worker_celery.py to avoid star-arg after keyword - N803: rename MockAsyncResult to mock_async_result in test_tasks.py - E501/I001: fix long line and import sort in llm_whisperer helper - ANN401: replace Any with object|None in dispatcher.py; add noqa in test helpers - F841: remove unused workflow_id and result assignments Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --------- Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> * UN-3266 fix: resolve SonarCloud bugs S2259 and S1244 in PR #1849 - S2259: guard against None after _discover_plugins() in loader.py to satisfy static analysis on the dict[str,type]|None field type - S1244: replace float equality checks with pytest.approx() in test_answer_prompt.py and test_phase2h.py Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * UN-3266 fix: resolve SonarCloud code smells in PR #1849 - S5799: Merge all implicit string concatenations in log messages (legacy_executor.py, tasks.py, dispatcher.py, orchestrator.py, registry.py, variable_replacement.py, structure_tool_task.py) - S1192: Extract duplicate literal to _NO_CELERY_APP_MSG constant in dispatcher.py - S1871: Merge identical elif/else branches in tasks.py and test_sanity_phase6j.py - S1186: Add comment to empty stub method in test_sanity_phase6a.py - S1481: Remove unused local variables in test_sanity_phase6d/e/f/g/h/j and test_phase5d.py - S117: Rename PascalCase local variables to snake_case in test_sanity_phase3/5/6i.py - S5655: Broaden tool type annotation to StreamMixin in IndexingUtils.generate_index_key and PlatformHelper.get_adapter_config - docker:S7031: Merge consecutive RUN instructions in worker-unified.Dockerfile - javascript:S1128: Remove unused pollForCompletion import in usePromptRun.js Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * UN-3266 fix: wrap long log message in dispatcher.py to fix E501 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * UN-3266 fix: resolve remaining SonarCloud S117 naming violations Rename PascalCase local variables to snake_case to comply with S117: - legacy_executor.py: rename tuple-unpacked _get_prompt_deps() results (AnswerPromptService→answer_prompt_svc, RetrievalService→retrieval_svc, VariableReplacementService→variable_replacement_svc, LLM→llm_cls, EmbeddingCompat→embedding_compat_cls, VectorDB→vector_db_cls) and update all downstream usages including _apply_type_conversion and _handle_summarize - test_phase1_log_streaming.py: rename Mock* local variables to mock_* snake_case equivalents - test_sanity_phase3.py: rename MockDispatcher→mock_dispatcher_cls and MockShim→mock_shim_cls across all 10 test methods - test_sanity_phase5.py: rename MockShim→mock_shim, MockX2Text→mock_x2text in 6 test methods; MockDispatcher→mock_dispatcher_cls in dispatch test; fix LLM_cls→llm_cls, EmbeddingCompat→embedding_compat_cls, VectorDB→vector_db_cls in _mock_prompt_deps helper Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * UN-3266 fix: resolve remaining SonarCloud code smells in PR #1849 - test_sanity_phase2/4.py, test_answer_prompt.py: rename PascalCase local variables in _mock_prompt_deps/_mock_deps to snake_case (RetrievalService→retrieval_svc, VariableReplacementService→ variable_replacement_svc, Index→index_cls, LLM_cls→llm_cls, EmbeddingCompat→embedding_compat_cls, VectorDB→vector_db_cls, AnswerPromptService→answer_prompt_svc_cls) — fixes S117 - test_sanity_phase3.py: remove unused local variable "result" — fixes S1481 - structure_tool_task.py: remove redundant json.JSONDecodeError from except clause (subclass of ValueError) — fixes S5713 - shared/workflow/execution/service.py: replace generic Exception with RuntimeError for structure tool failure — fixes S112 - run-worker-docker.sh: define EXECUTOR_WORKER_TYPE constant and replace 10 literal "executor" occurrences — fixes S1192 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * UN-3266 fix: resolve SonarCloud cognitive complexity and code smell violations - Reduce cognitive complexity in answer_prompt.py: - Extract _build_grammar_notes, _run_webhook_postprocess helpers - _is_safe_public_url: extracted _resolve_host_addresses helper - handle_json: early-return pattern eliminates nesting - construct_prompt: delegates grammar loop to _build_grammar_notes - Reduce cognitive complexity in legacy_executor.py: - Extract _execute_single_prompt, _run_table_extraction helpers - Extract _run_challenge_if_enabled, _run_evaluation_if_enabled - Extract _inject_table_settings, _finalize_pipeline_result - Extract _convert_number_answer, _convert_scalar_answer - Extract _sanitize_dict_values helper - _handle_answer_prompt CC reduced from 50 to ~7 - Reduce CC in structure_tool_task.py: guard-clause refactor - Reduce CC in backend: dto.py, deployment_helper.py, api_deployment_views.py, prompt_studio_helper.py - Fix S117: rename PascalCase local vars in test_answer_prompt.py - Fix S1192: extract EXECUTOR_WORKER_TYPE constant in run-worker.sh - Fix S1172: remove unused params from structure_tool_task.py - Fix S5713: remove redundant JSONDecodeError in json_repair_helper.py - Fix S112/S5727 in test_execution.py Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * UN-3266 fix: remove unused RetrievalStrategy import from _handle_answer_prompt Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * UN-3266 fix: rename UsageHelper params to lowercase (N803) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * UN-3266 fix: resolve remaining SonarCloud issues from check run 66691002192 - Add @staticmethod to _sanitize_null_values (fixes S2325 missing self) - Reduce _execute_single_prompt params from 25 to 11 (S107) by grouping services as deps tuple and extracting exec params from context.executor_params - Add NOSONAR suppression for raise exc in test helper (S112) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * UN-3266 fix: remove unused locals in _handle_answer_prompt (F841) execution_id, file_hash, log_events_id, custom_data are now extracted inside _execute_single_prompt from context.executor_params. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * fix: resolve Biome linting errors in frontend source files Auto-fixed 48 lint errors across 56 files: import ordering, block statements, unused variable prefixing, and formatting issues. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: replace dynamic import of SharePermission with static import in Workflows Resolves vite build warning about SharePermission.jsx being both dynamically and statically imported across the codebase. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: resolve SonarCloud warnings in frontend components - Remove unnecessary try-catch around PostHog event calls - Flip negated condition in PromptOutput.handleTable for clarity Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Address PR #1849 review comments: fix null guards, dead code, and test drift - Remove redundant inline `import uuid as _uuid` in views.py (use module-level uuid) - URL-encode DB_USER in worker_celery.py result backend connection string - Remove misleading task_queues=[Queue("executor")] from dispatch-only Celery app - Remove dead `if not tool:` guards after objects.get() (already raises DoesNotExist) - Move profile_manager/default_profile null checks before first dereference - Reorder ProfileManager.objects.get before mark_document_indexed in tasks.py - Handle ProfileManager.DoesNotExist as warning, not hard failure - Wrap PostHog analytics in try/catch so failures don't block prompt execution - Handle pending-indexing 200 response in usePromptRun.js (clear RUNNING status) - Reset formData when metadata is missing in ConfigureDs.jsx - Fix test_should_skip_extraction tests: function now takes 1 arg (outputs only) - Fix agentic routing tests: mock X2Text.process, remove stale platform_helper kwarg Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Fix missing llm_usage_reason for summarize LLM usage tracking Add PSKeys.LLM_USAGE_REASON to usage_kwargs in _handle_summarize() so summarization costs appear under summarize_llm in API response metadata. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * UN-3266 [FIX] Fix single-pass extraction routing in LegacyExecutor - Route _handle_structure_pipeline to _handle_single_pass_extraction when is_single_pass=True (was always calling _handle_answer_prompt) - Delegate _handle_single_pass_extraction to cloud plugin via ExecutorRegistry, falling back to _handle_answer_prompt if plugin not installed Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * Fixing API depployment response mismatches * Fix single-pass extraction showing only one prompt result in real-time - Fix accumulation bug in usePromptOutput updateCoverage() where each loop iteration spread the original promptOutputs instead of the accumulating updatedPromptOutputs, causing only the last prompt to render - Improve index success toast to show document name - Strip adapter names from index key configs for consistent hashing - Update sdk1 uv.lock Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * Move summarize from sync Django plugin to executor worker for IDE index When "Summarize" is enabled and a user indexes a new document in Prompt Studio, the backend returned a 500 because the sync Django plugin tried to read the extracted .txt file before extraction happened in the worker. Fix: defer summarization to the executor worker's _handle_ide_index (extract → summarize → index), build summarize_params in the payload, and track the summarize index in the ide_index_complete callback. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * Address PR #1849 review comments: null guards, thread safety - Fix null guard ordering in build_index_payload: add DefaultProfileError check before calling validators on default_profile - Fix null guard ordering in _fetch_single_pass_response: move check before .llm.id access and validators (was dead code after dereference) - Add threading.Lock to worker_celery singleton to prevent race under concurrent gunicorn threads Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * Add documentation to ExecutionResponse DTO describing result structure Documents the ExecutionResponse dataclass fields, especially the result attribute's per-file dict structure (output, metadata, metrics, error keys) as requested in PR review. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * Fix PR review issues: IDOR, null guards, rollback, spinner, summarize, prompt lookup - Strip result payload from task_status to prevent IDOR data leak - Move null guard before validators in build_fetch_response_payload - Roll back indexing flag on broker failure in index_document - Use explicit IDs for spinner clearing instead of ORM serialization format - Catch broad exceptions in summarize tracking to prevent false failures - Guard prompt_id lookup in fetch_response with 400/404 responses Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Fix CI, tests, and add async prompt studio improvements - Fix biome import ordering in frontend test files - Fix 22 stale backend test assertions in test_tasks.py (patch targets, return values, view dispatch pattern, remove TestCeleryConfig) - Add ide_prompt_complete callback tests - Add frontend vitest config and regression tests for null guards, stale closures, and single-pass loading guard - Add LLMCompat llama-index compatibility wrapper in SDK1 - Add litellm cohere embed timeout monkey-patch (v1.82.3) - Improve S3 filesystem helper (region_name, empty credential handling) - Add RetrieverLLM and lazy LLM creation for retrievers - Improve worker cleanup: api_client.close() in finally blocks, early return on setup failure in API deployment tasks - Add workers conftest.py for test environment setup Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Fix pre-existing biome CI errors: import ordering and formatting Auto-fix 18 pre-existing organizeImports and formatting errors across 17 frontend files that were blocking biome ci on the entire codebase. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * Fix ruff F821: add missing transaction import in prompt_studio_helper Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * Add input validation guards to bulk_fetch_response endpoint Validate prompt_ids (non-empty), document_id (required), and handle DoesNotExist for both prompts and document to return proper 400/404 instead of dispatching no-op tasks or raising unhandled 500 errors. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * IDE Call backs * Sonar issues fix * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Fix ruff errors: restore summary_profile variable, suppress TC001 in dispatcher Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Update bun.lock to match package.json dependency ranges Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * Fix all biome lint warnings: empty blocks, missing braces, forEach returns, unused vars Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * Move ExecutionContext import into TYPE_CHECKING block Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Fix SonarQube issues: duplication, naming, nesting, unused var - Extract _parse_json_body() helper and _ERR_INVALID_JSON constant to deduplicate 5 identical JSON parsing blocks in internal_views.py - Rename `User` local variable to `user_model` (naming convention) - Merge _emit_result/_emit_error into unified _emit_event() in ide_callback tasks to reduce code duplication - Extract _get_task_error() helper to deduplicate AsyncResult error retrieval in ide_index_error and ide_prompt_error - Remove unused `mock_ar_cls` variable in test_ide_callback.py - Add security note documenting why @csrf_exempt is safe on internal endpoints Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * Replace worker-ide-callback Dockerfile with worker-unified The IDE callback worker should use the unified worker image (worker-unified.Dockerfile) consistent with all other v2 workers. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * Add celery_executor_agentic queue to executor worker The executor worker only consumed from celery_executor_legacy, but the agentic prompt studio dispatches tasks to celery_executor_agentic. This caused agentic operations to sit in RabbitMQ with no consumer, resulting in timeouts and stuck-in-progress states. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * FIxing email enforce type * Removing line-item from select choices * Update workers/shared/enums/worker_enums_base.py Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com> Signed-off-by: harini-venkataraman <115449948+harini-venkataraman@users.noreply.github.com> * Update backend/workflow_manager/workflow_v2/workflow_helper.py Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com> Signed-off-by: harini-venkataraman <115449948+harini-venkataraman@users.noreply.github.com> * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Fix false success logs and silent failures in ETL destination pipelines - Widen except clause in structure_tool_task to catch FileOperationError and log write paths for diagnostics - Add diagnostic logging at all silent return-None points in destination connector so missing INFILE/METADATA paths are visible in logs - Raise RuntimeError instead of silently skipping when no tool execution result is available for DB/FS destinations, preventing false success - Remove dead retry config from execute_bin task (max_retries=0) - Fix duplicate EXECUTOR/IDE_CALLBACK enum entries in WorkerType Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Revert ETL destination pipeline changes — deferring to next cut Reverts diagnostic logging and error-raising changes in structure_tool_task.py and destination_connector.py. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> --------- Signed-off-by: harini-venkataraman <115449948+harini-venkataraman@users.noreply.github.com> Co-authored-by: Ghost Jake <89829542+Deepak-Kesavan@users.noreply.github.com> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com> Co-authored-by: Ritwik G <100672805+ritwik-g@users.noreply.github.com> Co-authored-by: Kirtiman Mishra <110175055+kirtimanmishrazipstack@users.noreply.github.com> Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com> * [MISC] Fix blank LLM profile edit form and settings menu bold style (#1896) - Replace form.resetFields() with form.setFieldsValue() to fix blank edit form caused by Ant Design's initialValues being a one-time snapshot - Remove Strict Mode-incompatible cleanup that cleared editLlmProfileId - Clear editLlmProfileId in parent when adding new profile - Remove unconditional bold on first settings popover menu item Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * [FEAT] Port LINE_ITEM extraction to pluggable executor architecture LINE_ITEM enforce_type prompts previously raised an unconditional error in the new workers executor. Wire the structure-tool path to delegate to a `line_item` executor plugin (mirroring how TABLE delegates to the `table_extractor` plugin), so API deployments / ETL pipelines can run LINE_ITEM extraction once the cloud `line_item_extractor` plugin is installed. - legacy_executor.py: replace the LINE_ITEM error site in `_execute_single_prompt` with a delegation call and add a new `_run_line_item_extraction()` method structurally identical to `_run_table_extraction()`. - test_line_item_extraction.py: 5 new tests covering plugin missing, success, sub-context construction, failure path, and end-to-end Celery eager-mode delegation. - test_sanity_phase6d.py: update the existing LINE_ITEM guard test to match the new "install the line_item_extractor plugin" hint and patch `ExecutorRegistry.get` to simulate the missing plugin. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * Add line-item to prompt studio enforce_type select choices The `line-item` enforce_type is defined in the `ToolStudioPrompt` model but was missing from the `select_choices.json` dropdown options served to the prompt studio frontend, so users could not select it. Add it now that LINE_ITEM extraction is wired through the new pluggable executor architecture. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> --------- Signed-off-by: harini-venkataraman <115449948+harini-venkataraman@users.noreply.github.com> Co-authored-by: Ghost Jake <89829542+Deepak-Kesavan@users.noreply.github.com> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com> Co-authored-by: Ritwik G <100672805+ritwik-g@users.noreply.github.com> Co-authored-by: Kirtiman Mishra <110175055+kirtimanmishrazipstack@users.noreply.github.com> Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com> Co-authored-by: Chandrasekharan M <117059509+chandrasekharan-zipstack@users.noreply.github.com>
* Execution backend - revamp
* async flow
* Streaming progress to FE
* Removing multi hop in Prompt studio ide and structure tool
* UN-3234 [FIX] Add beta tag to agentic prompt studio navigation item
* Added executors for agentic prompt studio
* Added executors for agentic prompt studio
* Removed redundant envs
* Removed redundant envs
* Removed redundant envs
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Removed redundant envs
* Removed redundant envs
* Removed redundant envs
* Removed redundant envs
* Removed redundant envs
* Removed redundant envs
* Removed redundant envs
* Removed redundant envs
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Removed redundant envs
* adding worker for callbacks
* adding worker for callbacks
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* adding worker for callbacks
* adding worker for callbacks
* adding worker for callbacks
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Pluggable apps and plugins to fit the new async prompt execution architecture
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Pluggable apps and plugins to fit the new async prompt execution architecture
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Pluggable apps and plugins to fit the new async prompt execution architecture
* adding worker for callbacks
* adding worker for callbacks
* adding worker for callbacks
* adding worker for callbacks
* adding worker for callbacks
* adding worker for callbacks
* adding worker for callbacks
* adding worker for callbacks
* fix: write output files in agentic extraction pipeline
Agentic extraction returned early without writing INFILE (JSON) or
METADATA.json, causing destination connectors to read the original PDF
and fail with "Expected tool output type: TXT, got: application/pdf".
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* UN-3266 fix: replace hardcoded /tmp paths with secure temp dirs in tests (#1850)
* UN-3266 fix: replace hardcoded /tmp paths with secure temp dirs in tests
Replace hardcoded /tmp/ paths (SonarCloud S5443 security hotspots) with
pytest's tmp_path fixture or module-level tempfile.mkdtemp() constants
in all affected test files to avoid world-writable directory vulnerabilities.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
---------
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Update docs
* UN-3266 fix: remove dead code with undefined names in fetch_response
Remove unreachable code block after the async callback return in
fetch_response that still referenced output_count_before and response
from the old synchronous implementation, causing ruff F821 errors.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* Un 3266 fix security hotspot tmp paths (#1851)
* UN-3266 fix: replace hardcoded /tmp paths with secure temp dirs in tests
Replace hardcoded /tmp/ paths (SonarCloud S5443 security hotspots) with
pytest's tmp_path fixture or module-level tempfile.mkdtemp() constants
in all affected test files to avoid world-writable directory vulnerabilities.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* UN-3266 fix: resolve ruff linting failures across multiple files
- B026: pass url positionally in worker_celery.py to avoid star-arg after keyword
- N803: rename MockAsyncResult to mock_async_result in test_tasks.py
- E501/I001: fix long line and import sort in llm_whisperer helper
- ANN401: replace Any with object|None in dispatcher.py; add noqa in test helpers
- F841: remove unused workflow_id and result assignments
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
---------
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
* UN-3266 fix: resolve SonarCloud bugs S2259 and S1244 in PR #1849
- S2259: guard against None after _discover_plugins() in loader.py
to satisfy static analysis on the dict[str,type]|None field type
- S1244: replace float equality checks with pytest.approx() in
test_answer_prompt.py and test_phase2h.py
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* UN-3266 fix: resolve SonarCloud code smells in PR #1849
- S5799: Merge all implicit string concatenations in log messages
(legacy_executor.py, tasks.py, dispatcher.py, orchestrator.py,
registry.py, variable_replacement.py, structure_tool_task.py)
- S1192: Extract duplicate literal to _NO_CELERY_APP_MSG constant in
dispatcher.py
- S1871: Merge identical elif/else branches in tasks.py and
test_sanity_phase6j.py
- S1186: Add comment to empty stub method in test_sanity_phase6a.py
- S1481: Remove unused local variables in test_sanity_phase6d/e/f/g/h/j
and test_phase5d.py
- S117: Rename PascalCase local variables to snake_case in
test_sanity_phase3/5/6i.py
- S5655: Broaden tool type annotation to StreamMixin in
IndexingUtils.generate_index_key and PlatformHelper.get_adapter_config
- docker:S7031: Merge consecutive RUN instructions in
worker-unified.Dockerfile
- javascript:S1128: Remove unused pollForCompletion import in
usePromptRun.js
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* UN-3266 fix: wrap long log message in dispatcher.py to fix E501
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* UN-3266 fix: resolve remaining SonarCloud S117 naming violations
Rename PascalCase local variables to snake_case to comply with S117:
- legacy_executor.py: rename tuple-unpacked _get_prompt_deps() results
(AnswerPromptService→answer_prompt_svc, RetrievalService→retrieval_svc,
VariableReplacementService→variable_replacement_svc, LLM→llm_cls,
EmbeddingCompat→embedding_compat_cls, VectorDB→vector_db_cls) and
update all downstream usages including _apply_type_conversion and
_handle_summarize
- test_phase1_log_streaming.py: rename Mock* local variables to
mock_* snake_case equivalents
- test_sanity_phase3.py: rename MockDispatcher→mock_dispatcher_cls
and MockShim→mock_shim_cls across all 10 test methods
- test_sanity_phase5.py: rename MockShim→mock_shim, MockX2Text→mock_x2text
in 6 test methods; MockDispatcher→mock_dispatcher_cls in dispatch test;
fix LLM_cls→llm_cls, EmbeddingCompat→embedding_compat_cls,
VectorDB→vector_db_cls in _mock_prompt_deps helper
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* UN-3266 fix: resolve remaining SonarCloud code smells in PR #1849
- test_sanity_phase2/4.py, test_answer_prompt.py: rename PascalCase
local variables in _mock_prompt_deps/_mock_deps to snake_case
(RetrievalService→retrieval_svc, VariableReplacementService→
variable_replacement_svc, Index→index_cls, LLM_cls→llm_cls,
EmbeddingCompat→embedding_compat_cls, VectorDB→vector_db_cls,
AnswerPromptService→answer_prompt_svc_cls) — fixes S117
- test_sanity_phase3.py: remove unused local variable "result" — fixes S1481
- structure_tool_task.py: remove redundant json.JSONDecodeError from
except clause (subclass of ValueError) — fixes S5713
- shared/workflow/execution/service.py: replace generic Exception with
RuntimeError for structure tool failure — fixes S112
- run-worker-docker.sh: define EXECUTOR_WORKER_TYPE constant and
replace 10 literal "executor" occurrences — fixes S1192
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* UN-3266 fix: resolve SonarCloud cognitive complexity and code smell violations
- Reduce cognitive complexity in answer_prompt.py:
- Extract _build_grammar_notes, _run_webhook_postprocess helpers
- _is_safe_public_url: extracted _resolve_host_addresses helper
- handle_json: early-return pattern eliminates nesting
- construct_prompt: delegates grammar loop to _build_grammar_notes
- Reduce cognitive complexity in legacy_executor.py:
- Extract _execute_single_prompt, _run_table_extraction helpers
- Extract _run_challenge_if_enabled, _run_evaluation_if_enabled
- Extract _inject_table_settings, _finalize_pipeline_result
- Extract _convert_number_answer, _convert_scalar_answer
- Extract _sanitize_dict_values helper
- _handle_answer_prompt CC reduced from 50 to ~7
- Reduce CC in structure_tool_task.py: guard-clause refactor
- Reduce CC in backend: dto.py, deployment_helper.py,
api_deployment_views.py, prompt_studio_helper.py
- Fix S117: rename PascalCase local vars in test_answer_prompt.py
- Fix S1192: extract EXECUTOR_WORKER_TYPE constant in run-worker.sh
- Fix S1172: remove unused params from structure_tool_task.py
- Fix S5713: remove redundant JSONDecodeError in json_repair_helper.py
- Fix S112/S5727 in test_execution.py
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* UN-3266 fix: remove unused RetrievalStrategy import from _handle_answer_prompt
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* UN-3266 fix: rename UsageHelper params to lowercase (N803)
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* UN-3266 fix: resolve remaining SonarCloud issues from check run 66691002192
- Add @staticmethod to _sanitize_null_values (fixes S2325 missing self)
- Reduce _execute_single_prompt params from 25 to 11 (S107)
by grouping services as deps tuple and extracting exec params
from context.executor_params
- Add NOSONAR suppression for raise exc in test helper (S112)
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* UN-3266 fix: remove unused locals in _handle_answer_prompt (F841)
execution_id, file_hash, log_events_id, custom_data are now extracted
inside _execute_single_prompt from context.executor_params.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* fix: resolve Biome linting errors in frontend source files
Auto-fixed 48 lint errors across 56 files: import ordering, block
statements, unused variable prefixing, and formatting issues.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* fix: replace dynamic import of SharePermission with static import in Workflows
Resolves vite build warning about SharePermission.jsx being both
dynamically and statically imported across the codebase.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* fix: resolve SonarCloud warnings in frontend components
- Remove unnecessary try-catch around PostHog event calls
- Flip negated condition in PromptOutput.handleTable for clarity
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Address PR #1849 review comments: fix null guards, dead code, and test drift
- Remove redundant inline `import uuid as _uuid` in views.py (use module-level uuid)
- URL-encode DB_USER in worker_celery.py result backend connection string
- Remove misleading task_queues=[Queue("executor")] from dispatch-only Celery app
- Remove dead `if not tool:` guards after objects.get() (already raises DoesNotExist)
- Move profile_manager/default_profile null checks before first dereference
- Reorder ProfileManager.objects.get before mark_document_indexed in tasks.py
- Handle ProfileManager.DoesNotExist as warning, not hard failure
- Wrap PostHog analytics in try/catch so failures don't block prompt execution
- Handle pending-indexing 200 response in usePromptRun.js (clear RUNNING status)
- Reset formData when metadata is missing in ConfigureDs.jsx
- Fix test_should_skip_extraction tests: function now takes 1 arg (outputs only)
- Fix agentic routing tests: mock X2Text.process, remove stale platform_helper kwarg
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Fix missing llm_usage_reason for summarize LLM usage tracking
Add PSKeys.LLM_USAGE_REASON to usage_kwargs in _handle_summarize() so
summarization costs appear under summarize_llm in API response metadata.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* UN-3266 [FIX] Fix single-pass extraction routing in LegacyExecutor
- Route _handle_structure_pipeline to _handle_single_pass_extraction when
is_single_pass=True (was always calling _handle_answer_prompt)
- Delegate _handle_single_pass_extraction to cloud plugin via ExecutorRegistry,
falling back to _handle_answer_prompt if plugin not installed
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* Fixing API depployment response mismatches
* Fix single-pass extraction showing only one prompt result in real-time
- Fix accumulation bug in usePromptOutput updateCoverage() where each
loop iteration spread the original promptOutputs instead of the
accumulating updatedPromptOutputs, causing only the last prompt to
render
- Improve index success toast to show document name
- Strip adapter names from index key configs for consistent hashing
- Update sdk1 uv.lock
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* Move summarize from sync Django plugin to executor worker for IDE index
When "Summarize" is enabled and a user indexes a new document in Prompt
Studio, the backend returned a 500 because the sync Django plugin tried
to read the extracted .txt file before extraction happened in the worker.
Fix: defer summarization to the executor worker's _handle_ide_index
(extract → summarize → index), build summarize_params in the payload,
and track the summarize index in the ide_index_complete callback.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* Address PR #1849 review comments: null guards, thread safety
- Fix null guard ordering in build_index_payload: add DefaultProfileError
check before calling validators on default_profile
- Fix null guard ordering in _fetch_single_pass_response: move check
before .llm.id access and validators (was dead code after dereference)
- Add threading.Lock to worker_celery singleton to prevent race under
concurrent gunicorn threads
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* Add documentation to ExecutionResponse DTO describing result structure
Documents the ExecutionResponse dataclass fields, especially the
result attribute's per-file dict structure (output, metadata, metrics,
error keys) as requested in PR review.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* Fix PR review issues: IDOR, null guards, rollback, spinner, summarize, prompt lookup
- Strip result payload from task_status to prevent IDOR data leak
- Move null guard before validators in build_fetch_response_payload
- Roll back indexing flag on broker failure in index_document
- Use explicit IDs for spinner clearing instead of ORM serialization format
- Catch broad exceptions in summarize tracking to prevent false failures
- Guard prompt_id lookup in fetch_response with 400/404 responses
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Fix CI, tests, and add async prompt studio improvements
- Fix biome import ordering in frontend test files
- Fix 22 stale backend test assertions in test_tasks.py (patch targets,
return values, view dispatch pattern, remove TestCeleryConfig)
- Add ide_prompt_complete callback tests
- Add frontend vitest config and regression tests for null guards,
stale closures, and single-pass loading guard
- Add LLMCompat llama-index compatibility wrapper in SDK1
- Add litellm cohere embed timeout monkey-patch (v1.82.3)
- Improve S3 filesystem helper (region_name, empty credential handling)
- Add RetrieverLLM and lazy LLM creation for retrievers
- Improve worker cleanup: api_client.close() in finally blocks,
early return on setup failure in API deployment tasks
- Add workers conftest.py for test environment setup
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Fix pre-existing biome CI errors: import ordering and formatting
Auto-fix 18 pre-existing organizeImports and formatting errors across
17 frontend files that were blocking biome ci on the entire codebase.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* Fix ruff F821: add missing transaction import in prompt_studio_helper
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* Add input validation guards to bulk_fetch_response endpoint
Validate prompt_ids (non-empty), document_id (required), and handle
DoesNotExist for both prompts and document to return proper 400/404
instead of dispatching no-op tasks or raising unhandled 500 errors.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* IDE Call backs
* Sonar issues fix
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Fix ruff errors: restore summary_profile variable, suppress TC001 in dispatcher
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Update bun.lock to match package.json dependency ranges
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* Fix all biome lint warnings: empty blocks, missing braces, forEach returns, unused vars
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* Move ExecutionContext import into TYPE_CHECKING block
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Fix SonarQube issues: duplication, naming, nesting, unused var
- Extract _parse_json_body() helper and _ERR_INVALID_JSON constant to
deduplicate 5 identical JSON parsing blocks in internal_views.py
- Rename `User` local variable to `user_model` (naming convention)
- Merge _emit_result/_emit_error into unified _emit_event() in
ide_callback tasks to reduce code duplication
- Extract _get_task_error() helper to deduplicate AsyncResult error
retrieval in ide_index_error and ide_prompt_error
- Remove unused `mock_ar_cls` variable in test_ide_callback.py
- Add security note documenting why @csrf_exempt is safe on internal endpoints
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* Replace worker-ide-callback Dockerfile with worker-unified
The IDE callback worker should use the unified worker image
(worker-unified.Dockerfile) consistent with all other v2 workers.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* Add celery_executor_agentic queue to executor worker
The executor worker only consumed from celery_executor_legacy, but the
agentic prompt studio dispatches tasks to celery_executor_agentic. This
caused agentic operations to sit in RabbitMQ with no consumer, resulting
in timeouts and stuck-in-progress states.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* FIxing email enforce type
* Removing line-item from select choices
* Update workers/shared/enums/worker_enums_base.py
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
Signed-off-by: harini-venkataraman <115449948+harini-venkataraman@users.noreply.github.com>
* Update backend/workflow_manager/workflow_v2/workflow_helper.py
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
Signed-off-by: harini-venkataraman <115449948+harini-venkataraman@users.noreply.github.com>
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Fix false success logs and silent failures in ETL destination pipelines
- Widen except clause in structure_tool_task to catch FileOperationError
and log write paths for diagnostics
- Add diagnostic logging at all silent return-None points in destination
connector so missing INFILE/METADATA paths are visible in logs
- Raise RuntimeError instead of silently skipping when no tool execution
result is available for DB/FS destinations, preventing false success
- Remove dead retry config from execute_bin task (max_retries=0)
- Fix duplicate EXECUTOR/IDE_CALLBACK enum entries in WorkerType
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Revert ETL destination pipeline changes — deferring to next cut
Reverts diagnostic logging and error-raising changes in
structure_tool_task.py and destination_connector.py.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* Fix false success logs and missing data in ETL destination pipelines
The Celery-based structure tool execution never created the COPY_TO_FOLDER
directory that FS destination connectors expect, causing "file successfully
sent" logs with no data written. DB destinations silently skipped insertion
when tool_execution_result was None, also producing false success.
- Write structured output to COPY_TO_FOLDER for both regular and agentic paths
- Widen exception handling to catch FileOperationError from fs.json_dump
- Raise RuntimeError instead of silently skipping in FS/DB destination handlers
- Add warning logs at silent return-None points in result retrieval
- Surface METADATA.json write failures with error-level logging
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* Fix missing context_retrieval metric for single pass extraction
The cloud single_pass_extraction plugin handles retrieval internally but
does not report context_retrieval timing in its metrics. This adds a
post-execution file-read measurement that injects the metric, matching
what RetrievalService.retrieve_complete_context provides for the normal
answer_prompt path. Also forces chunk-size=0 for single pass so the OSS
fallback path uses full-context retrieval instead of vector DB.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* Fix Unstructured IO adapter PermissionError on remote storage
Rewrite UnstructuredHelper.process_document() to read file bytes via
fs.read() and wrap in BytesIO, removing the hardcoded local FileStorage
download/builtin open() pattern. The previous code assumed
input_file_path was a local filesystem path, which broke in the executor
worker container where files live in MinIO and the local staging path
isn't mounted. Now matches the pattern used by LLMWhisperer v2 and works
for both local and remote storage backends.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* Defer subscription usage tracking to IDE callback workers
Move subscription usage commit from the synchronous Prompt Studio entry
points (index_document, prompt_responder) into the async IDE callback
tasks (ide_index_complete, ide_prompt_complete). With the new executor
flow, the sync entry points return before the actual execution finishes,
so the dashboard usage decorator was firing prematurely and missing real
usage data. Tracking now runs after the executor signals success via the
callback, ensuring dashboard usage metrics reflect completed runs only.
Errors from the subscription plugin are caught and logged so they never
fail the callback. Plugin is optional (OSS mode is a no-op).
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* Fix missing embedding metadata in API deployment with chunking
In the structure pipeline indexing path, _run_pipeline_index built the
INDEX executor_params without usage_kwargs. This caused EmbeddingCompat
to register its UsageHandler callback with empty kwargs, so audit DB
rows for embedding usage were stored without run_id/file_execution_id.
get_usage_by_model() in the API deployment then returned no embedding
data, leaving the embedding key absent from the response metadata.
Propagate usage_kwargs from extract_params through _run_pipeline_index
into the INDEX ExecutionContext so the embedding adapter's callback
records audit rows against the correct file_execution_id.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* Fix email enforce type returning "NA" string and surface null in FE
The EMAIL branch in LegacyExecutor stored the literal string "NA" when
the LLM could not extract an address — first because the early-return
short-circuited before _convert_scalar_answer ran, and second because
_convert_scalar_answer never re-checked the second-pass LLM result.
The top-level NA → None sanitizer was also missing, so any "NA" that
slipped through type conversion reached the FE as a string.
Backend (workers/executor/executors/legacy_executor.py):
- _convert_scalar_answer now also returns None when the LLM
extraction itself yields "NA" (benefits both EMAIL and DATE)
- EMAIL branch in _convert_answer_by_type now delegates to
_convert_scalar_answer instead of inlining the if/else
- _sanitize_null_values re-adds the top-level scalar "NA" → None
branch as a defensive backstop, with .strip() symmetry across
dict, list, and nested helpers
Frontend (DisplayPromptResult.jsx + PromptCard.css):
- Split the null/undefined early-return: undefined still shows
"Yet to run", but null now renders an italic-grey "null" literal
so the user can distinguish "ran but produced no value" from
"never ran"
Tests:
- workers/tests/test_answer_prompt.py: TestNullSanitization NA
cases assert None instead of preserved strings; new
TestConvertScalarAnswer covers first-pass / second-pass /
success paths
- DisplayPromptResult.test.jsx: null test asserts the literal
"null" is rendered (and "Yet to run" is not)
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* Feat/line item executor plugin (#1899)
* [FIX] Executor Queue for Agentic extraction (#1893)
* Execution backend - revamp
* async flow
* Streaming progress to FE
* Removing multi hop in Prompt studio ide and structure tool
* UN-3234 [FIX] Add beta tag to agentic prompt studio navigation item
* Added executors for agentic prompt studio
* Added executors for agentic prompt studio
* Removed redundant envs
* Removed redundant envs
* Removed redundant envs
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Removed redundant envs
* Removed redundant envs
* Removed redundant envs
* Removed redundant envs
* Removed redundant envs
* Removed redundant envs
* Removed redundant envs
* Removed redundant envs
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Removed redundant envs
* adding worker for callbacks
* adding worker for callbacks
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* adding worker for callbacks
* adding worker for callbacks
* adding worker for callbacks
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Pluggable apps and plugins to fit the new async prompt execution architecture
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Pluggable apps and plugins to fit the new async prompt execution architecture
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Pluggable apps and plugins to fit the new async prompt execution architecture
* adding worker for callbacks
* adding worker for callbacks
* adding worker for callbacks
* adding worker for callbacks
* adding worker for callbacks
* adding worker for callbacks
* adding worker for callbacks
* adding worker for callbacks
* fix: write output files in agentic extraction pipeline
Agentic extraction returned early without writing INFILE (JSON) or
METADATA.json, causing destination connectors to read the original PDF
and fail with "Expected tool output type: TXT, got: application/pdf".
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* UN-3266 fix: replace hardcoded /tmp paths with secure temp dirs in tests (#1850)
* UN-3266 fix: replace hardcoded /tmp paths with secure temp dirs in tests
Replace hardcoded /tmp/ paths (SonarCloud S5443 security hotspots) with
pytest's tmp_path fixture or module-level tempfile.mkdtemp() constants
in all affected test files to avoid world-writable directory vulnerabilities.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
---------
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Update docs
* UN-3266 fix: remove dead code with undefined names in fetch_response
Remove unreachable code block after the async callback return in
fetch_response that still referenced output_count_before and response
from the old synchronous implementation, causing ruff F821 errors.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* Un 3266 fix security hotspot tmp paths (#1851)
* UN-3266 fix: replace hardcoded /tmp paths with secure temp dirs in tests
Replace hardcoded /tmp/ paths (SonarCloud S5443 security hotspots) with
pytest's tmp_path fixture or module-level tempfile.mkdtemp() constants
in all affected test files to avoid world-writable directory vulnerabilities.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* UN-3266 fix: resolve ruff linting failures across multiple files
- B026: pass url positionally in worker_celery.py to avoid star-arg after keyword
- N803: rename MockAsyncResult to mock_async_result in test_tasks.py
- E501/I001: fix long line and import sort in llm_whisperer helper
- ANN401: replace Any with object|None in dispatcher.py; add noqa in test helpers
- F841: remove unused workflow_id and result assignments
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
---------
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
* UN-3266 fix: resolve SonarCloud bugs S2259 and S1244 in PR #1849
- S2259: guard against None after _discover_plugins() in loader.py
to satisfy static analysis on the dict[str,type]|None field type
- S1244: replace float equality checks with pytest.approx() in
test_answer_prompt.py and test_phase2h.py
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* UN-3266 fix: resolve SonarCloud code smells in PR #1849
- S5799: Merge all implicit string concatenations in log messages
(legacy_executor.py, tasks.py, dispatcher.py, orchestrator.py,
registry.py, variable_replacement.py, structure_tool_task.py)
- S1192: Extract duplicate literal to _NO_CELERY_APP_MSG constant in
dispatcher.py
- S1871: Merge identical elif/else branches in tasks.py and
test_sanity_phase6j.py
- S1186: Add comment to empty stub method in test_sanity_phase6a.py
- S1481: Remove unused local variables in test_sanity_phase6d/e/f/g/h/j
and test_phase5d.py
- S117: Rename PascalCase local variables to snake_case in
test_sanity_phase3/5/6i.py
- S5655: Broaden tool type annotation to StreamMixin in
IndexingUtils.generate_index_key and PlatformHelper.get_adapter_config
- docker:S7031: Merge consecutive RUN instructions in
worker-unified.Dockerfile
- javascript:S1128: Remove unused pollForCompletion import in
usePromptRun.js
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* UN-3266 fix: wrap long log message in dispatcher.py to fix E501
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* UN-3266 fix: resolve remaining SonarCloud S117 naming violations
Rename PascalCase local variables to snake_case to comply with S117:
- legacy_executor.py: rename tuple-unpacked _get_prompt_deps() results
(AnswerPromptService→answer_prompt_svc, RetrievalService→retrieval_svc,
VariableReplacementService→variable_replacement_svc, LLM→llm_cls,
EmbeddingCompat→embedding_compat_cls, VectorDB→vector_db_cls) and
update all downstream usages including _apply_type_conversion and
_handle_summarize
- test_phase1_log_streaming.py: rename Mock* local variables to
mock_* snake_case equivalents
- test_sanity_phase3.py: rename MockDispatcher→mock_dispatcher_cls
and MockShim→mock_shim_cls across all 10 test methods
- test_sanity_phase5.py: rename MockShim→mock_shim, MockX2Text→mock_x2text
in 6 test methods; MockDispatcher→mock_dispatcher_cls in dispatch test;
fix LLM_cls→llm_cls, EmbeddingCompat→embedding_compat_cls,
VectorDB→vector_db_cls in _mock_prompt_deps helper
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* UN-3266 fix: resolve remaining SonarCloud code smells in PR #1849
- test_sanity_phase2/4.py, test_answer_prompt.py: rename PascalCase
local variables in _mock_prompt_deps/_mock_deps to snake_case
(RetrievalService→retrieval_svc, VariableReplacementService→
variable_replacement_svc, Index→index_cls, LLM_cls→llm_cls,
EmbeddingCompat→embedding_compat_cls, VectorDB→vector_db_cls,
AnswerPromptService→answer_prompt_svc_cls) — fixes S117
- test_sanity_phase3.py: remove unused local variable "result" — fixes S1481
- structure_tool_task.py: remove redundant json.JSONDecodeError from
except clause (subclass of ValueError) — fixes S5713
- shared/workflow/execution/service.py: replace generic Exception with
RuntimeError for structure tool failure — fixes S112
- run-worker-docker.sh: define EXECUTOR_WORKER_TYPE constant and
replace 10 literal "executor" occurrences — fixes S1192
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* UN-3266 fix: resolve SonarCloud cognitive complexity and code smell violations
- Reduce cognitive complexity in answer_prompt.py:
- Extract _build_grammar_notes, _run_webhook_postprocess helpers
- _is_safe_public_url: extracted _resolve_host_addresses helper
- handle_json: early-return pattern eliminates nesting
- construct_prompt: delegates grammar loop to _build_grammar_notes
- Reduce cognitive complexity in legacy_executor.py:
- Extract _execute_single_prompt, _run_table_extraction helpers
- Extract _run_challenge_if_enabled, _run_evaluation_if_enabled
- Extract _inject_table_settings, _finalize_pipeline_result
- Extract _convert_number_answer, _convert_scalar_answer
- Extract _sanitize_dict_values helper
- _handle_answer_prompt CC reduced from 50 to ~7
- Reduce CC in structure_tool_task.py: guard-clause refactor
- Reduce CC in backend: dto.py, deployment_helper.py,
api_deployment_views.py, prompt_studio_helper.py
- Fix S117: rename PascalCase local vars in test_answer_prompt.py
- Fix S1192: extract EXECUTOR_WORKER_TYPE constant in run-worker.sh
- Fix S1172: remove unused params from structure_tool_task.py
- Fix S5713: remove redundant JSONDecodeError in json_repair_helper.py
- Fix S112/S5727 in test_execution.py
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* UN-3266 fix: remove unused RetrievalStrategy import from _handle_answer_prompt
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* UN-3266 fix: rename UsageHelper params to lowercase (N803)
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* UN-3266 fix: resolve remaining SonarCloud issues from check run 66691002192
- Add @staticmethod to _sanitize_null_values (fixes S2325 missing self)
- Reduce _execute_single_prompt params from 25 to 11 (S107)
by grouping services as deps tuple and extracting exec params
from context.executor_params
- Add NOSONAR suppression for raise exc in test helper (S112)
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* UN-3266 fix: remove unused locals in _handle_answer_prompt (F841)
execution_id, file_hash, log_events_id, custom_data are now extracted
inside _execute_single_prompt from context.executor_params.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* fix: resolve Biome linting errors in frontend source files
Auto-fixed 48 lint errors across 56 files: import ordering, block
statements, unused variable prefixing, and formatting issues.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* fix: replace dynamic import of SharePermission with static import in Workflows
Resolves vite build warning about SharePermission.jsx being both
dynamically and statically imported across the codebase.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* fix: resolve SonarCloud warnings in frontend components
- Remove unnecessary try-catch around PostHog event calls
- Flip negated condition in PromptOutput.handleTable for clarity
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Address PR #1849 review comments: fix null guards, dead code, and test drift
- Remove redundant inline `import uuid as _uuid` in views.py (use module-level uuid)
- URL-encode DB_USER in worker_celery.py result backend connection string
- Remove misleading task_queues=[Queue("executor")] from dispatch-only Celery app
- Remove dead `if not tool:` guards after objects.get() (already raises DoesNotExist)
- Move profile_manager/default_profile null checks before first dereference
- Reorder ProfileManager.objects.get before mark_document_indexed in tasks.py
- Handle ProfileManager.DoesNotExist as warning, not hard failure
- Wrap PostHog analytics in try/catch so failures don't block prompt execution
- Handle pending-indexing 200 response in usePromptRun.js (clear RUNNING status)
- Reset formData when metadata is missing in ConfigureDs.jsx
- Fix test_should_skip_extraction tests: function now takes 1 arg (outputs only)
- Fix agentic routing tests: mock X2Text.process, remove stale platform_helper kwarg
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Fix missing llm_usage_reason for summarize LLM usage tracking
Add PSKeys.LLM_USAGE_REASON to usage_kwargs in _handle_summarize() so
summarization costs appear under summarize_llm in API response metadata.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* UN-3266 [FIX] Fix single-pass extraction routing in LegacyExecutor
- Route _handle_structure_pipeline to _handle_single_pass_extraction when
is_single_pass=True (was always calling _handle_answer_prompt)
- Delegate _handle_single_pass_extraction to cloud plugin via ExecutorRegistry,
falling back to _handle_answer_prompt if plugin not installed
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* Fixing API depployment response mismatches
* Fix single-pass extraction showing only one prompt result in real-time
- Fix accumulation bug in usePromptOutput updateCoverage() where each
loop iteration spread the original promptOutputs instead of the
accumulating updatedPromptOutputs, causing only the last prompt to
render
- Improve index success toast to show document name
- Strip adapter names from index key configs for consistent hashing
- Update sdk1 uv.lock
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* Move summarize from sync Django plugin to executor worker for IDE index
When "Summarize" is enabled and a user indexes a new document in Prompt
Studio, the backend returned a 500 because the sync Django plugin tried
to read the extracted .txt file before extraction happened in the worker.
Fix: defer summarization to the executor worker's _handle_ide_index
(extract → summarize → index), build summarize_params in the payload,
and track the summarize index in the ide_index_complete callback.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* Address PR #1849 review comments: null guards, thread safety
- Fix null guard ordering in build_index_payload: add DefaultProfileError
check before calling validators on default_profile
- Fix null guard ordering in _fetch_single_pass_response: move check
before .llm.id access and validators (was dead code after dereference)
- Add threading.Lock to worker_celery singleton to prevent race under
concurrent gunicorn threads
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* Add documentation to ExecutionResponse DTO describing result structure
Documents the ExecutionResponse dataclass fields, especially the
result attribute's per-file dict structure (output, metadata, metrics,
error keys) as requested in PR review.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* Fix PR review issues: IDOR, null guards, rollback, spinner, summarize, prompt lookup
- Strip result payload from task_status to prevent IDOR data leak
- Move null guard before validators in build_fetch_response_payload
- Roll back indexing flag on broker failure in index_document
- Use explicit IDs for spinner clearing instead of ORM serialization format
- Catch broad exceptions in summarize tracking to prevent false failures
- Guard prompt_id lookup in fetch_response with 400/404 responses
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Fix CI, tests, and add async prompt studio improvements
- Fix biome import ordering in frontend test files
- Fix 22 stale backend test assertions in test_tasks.py (patch targets,
return values, view dispatch pattern, remove TestCeleryConfig)
- Add ide_prompt_complete callback tests
- Add frontend vitest config and regression tests for null guards,
stale closures, and single-pass loading guard
- Add LLMCompat llama-index compatibility wrapper in SDK1
- Add litellm cohere embed timeout monkey-patch (v1.82.3)
- Improve S3 filesystem helper (region_name, empty credential handling)
- Add RetrieverLLM and lazy LLM creation for retrievers
- Improve worker cleanup: api_client.close() in finally blocks,
early return on setup failure in API deployment tasks
- Add workers conftest.py for test environment setup
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Fix pre-existing biome CI errors: import ordering and formatting
Auto-fix 18 pre-existing organizeImports and formatting errors across
17 frontend files that were blocking biome ci on the entire codebase.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* Fix ruff F821: add missing transaction import in prompt_studio_helper
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* Add input validation guards to bulk_fetch_response endpoint
Validate prompt_ids (non-empty), document_id (required), and handle
DoesNotExist for both prompts and document to return proper 400/404
instead of dispatching no-op tasks or raising unhandled 500 errors.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* IDE Call backs
* Sonar issues fix
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Fix ruff errors: restore summary_profile variable, suppress TC001 in dispatcher
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Update bun.lock to match package.json dependency ranges
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* Fix all biome lint warnings: empty blocks, missing braces, forEach returns, unused vars
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* Move ExecutionContext import into TYPE_CHECKING block
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Fix SonarQube issues: duplication, naming, nesting, unused var
- Extract _parse_json_body() helper and _ERR_INVALID_JSON constant to
deduplicate 5 identical JSON parsing blocks in internal_views.py
- Rename `User` local variable to `user_model` (naming convention)
- Merge _emit_result/_emit_error into unified _emit_event() in
ide_callback tasks to reduce code duplication
- Extract _get_task_error() helper to deduplicate AsyncResult error
retrieval in ide_index_error and ide_prompt_error
- Remove unused `mock_ar_cls` variable in test_ide_callback.py
- Add security note documenting why @csrf_exempt is safe on internal endpoints
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* Replace worker-ide-callback Dockerfile with worker-unified
The IDE callback worker should use the unified worker image
(worker-unified.Dockerfile) consistent with all other v2 workers.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* Add celery_executor_agentic queue to executor worker
The executor worker only consumed from celery_executor_legacy, but the
agentic prompt studio dispatches tasks to celery_executor_agentic. This
caused agentic operations to sit in RabbitMQ with no consumer, resulting
in timeouts and stuck-in-progress states.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* FIxing email enforce type
* Removing line-item from select choices
* Update workers/shared/enums/worker_enums_base.py
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
Signed-off-by: harini-venkataraman <115449948+harini-venkataraman@users.noreply.github.com>
* Update backend/workflow_manager/workflow_v2/workflow_helper.py
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
Signed-off-by: harini-venkataraman <115449948+harini-venkataraman@users.noreply.github.com>
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Fix false success logs and silent failures in ETL destination pipelines
- Widen except clause in structure_tool_task to catch FileOperationError
and log write paths for diagnostics
- Add diagnostic logging at all silent return-None points in destination
connector so missing INFILE/METADATA paths are visible in logs
- Raise RuntimeError instead of silently skipping when no tool execution
result is available for DB/FS destinations, preventing false success
- Remove dead retry config from execute_bin task (max_retries=0)
- Fix duplicate EXECUTOR/IDE_CALLBACK enum entries in WorkerType
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Revert ETL destination pipeline changes — deferring to next cut
Reverts diagnostic logging and error-raising changes in
structure_tool_task.py and destination_connector.py.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
---------
Signed-off-by: harini-venkataraman <115449948+harini-venkataraman@users.noreply.github.com>
Co-authored-by: Ghost Jake <89829542+Deepak-Kesavan@users.noreply.github.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-authored-by: Ritwik G <100672805+ritwik-g@users.noreply.github.com>
Co-authored-by: Kirtiman Mishra <110175055+kirtimanmishrazipstack@users.noreply.github.com>
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
* [MISC] Fix blank LLM profile edit form and settings menu bold style (#1896)
- Replace form.resetFields() with form.setFieldsValue() to fix blank
edit form caused by Ant Design's initialValues being a one-time snapshot
- Remove Strict Mode-incompatible cleanup that cleared editLlmProfileId
- Clear editLlmProfileId in parent when adding new profile
- Remove unconditional bold on first settings popover menu item
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* [FEAT] Port LINE_ITEM extraction to pluggable executor architecture
LINE_ITEM enforce_type prompts previously raised an unconditional error
in the new workers executor. Wire the structure-tool path to delegate to
a `line_item` executor plugin (mirroring how TABLE delegates to the
`table_extractor` plugin), so API deployments / ETL pipelines can run
LINE_ITEM extraction once the cloud `line_item_extractor` plugin is
installed.
- legacy_executor.py: replace the LINE_ITEM error site in
`_execute_single_prompt` with a delegation call and add a new
`_run_line_item_extraction()` method structurally identical to
`_run_table_extraction()`.
- test_line_item_extraction.py: 5 new tests covering plugin missing,
success, sub-context construction, failure path, and end-to-end
Celery eager-mode delegation.
- test_sanity_phase6d.py: update the existing LINE_ITEM guard test
to match the new "install the line_item_extractor plugin" hint
and patch `ExecutorRegistry.get` to simulate the missing plugin.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
---------
Signed-off-by: harini-venkataraman <115449948+harini-venkataraman@users.noreply.github.com>
Co-authored-by: Ghost Jake <89829542+Deepak-Kesavan@users.noreply.github.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-authored-by: Ritwik G <100672805+ritwik-g@users.noreply.github.com>
Co-authored-by: Kirtiman Mishra <110175055+kirtimanmishrazipstack@users.noreply.github.com>
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
Co-authored-by: Chandrasekharan M <117059509+chandrasekharan-zipstack@users.noreply.github.com>
* Guard against undefined connector type in PostHog event lookup
ConfigureDs called type.toUpperCase() unconditionally, which threw a
TypeError when type was undefined and broke the connector save flow.
Use optional chaining and only fire the PostHog event when the key
maps to a known connector.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* Add worker-executor-v2 service to docker-compose under workers-v2 profile
Defines a second executor worker container that runs the unified
worker image with WORKER_TYPE=executor on port 8092. Gated behind
the workers-v2 compose profile so it is opt-in and does not affect
default deployments.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* Feat/line item executor plugin (#1900)
* [FIX] Executor Queue for Agentic extraction (#1893)
* Execution backend - revamp
* async flow
* Streaming progress to FE
* Removing multi hop in Prompt studio ide and structure tool
* UN-3234 [FIX] Add beta tag to agentic prompt studio navigation item
* Added executors for agentic prompt studio
* Added executors for agentic prompt studio
* Removed redundant envs
* Removed redundant envs
* Removed redundant envs
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Removed redundant envs
* Removed redundant envs
* Removed redundant envs
* Removed redundant envs
* Removed redundant envs
* Removed redundant envs
* Removed redundant envs
* Removed redundant envs
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Removed redundant envs
* adding worker for callbacks
* adding worker for callbacks
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* adding worker for callbacks
* adding worker for callbacks
* adding worker for callbacks
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Pluggable apps and plugins to fit the new async prompt execution architecture
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Pluggable apps and plugins to fit the new async prompt execution architecture
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Pluggable apps and plugins to fit the new async prompt execution architecture
* adding worker for callbacks
* adding worker for callbacks
* adding worker for callbacks
* adding worker for callbacks
* adding worker for callbacks
* adding worker for callbacks
* adding worker for callbacks
* adding worker for callbacks
* fix: write output files in agentic extraction pipeline
Agentic extraction returned early without writing INFILE (JSON) or
METADATA.json, causing destination connectors to read the original PDF
and fail with "Expected tool output type: TXT, got: application/pdf".
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* UN-3266 fix: replace hardcoded /tmp paths with secure temp dirs in tests (#1850)
* UN-3266 fix: replace hardcoded /tmp paths with secure temp dirs in tests
Replace hardcoded /tmp/ paths (SonarCloud S5443 security hotspots) with
pytest's tmp_path fixture or module-level tempfile.mkdtemp() constants
in all affected test files to avoid world-writable directory vulnerabilities.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
---------
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Update docs
* UN-3266 fix: remove dead code with undefined names in fetch_response
Remove unreachable code block after the async callback return in
fetch_response that still referenced output_count_before and response
from the old synchronous implementation, causing ruff F821 errors.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* Un 3266 fix security hotspot tmp paths (#1851)
* UN-3266 fix: replace hardcoded /tmp paths with secure temp dirs in tests
Replace hardcoded /tmp/ paths (SonarCloud S5443 security hotspots) with
pytest's tmp_path fixture or module-level tempfile.mkdtemp() constants
in all affected test files to avoid world-writable directory vulnerabilities.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* UN-3266 fix: resolve ruff linting failures across multiple files
- B026: pass url positionally in worker_celery.py to avoid star-arg after keyword
- N803: rename MockAsyncResult to mock_async_result in test_tasks.py
- E501/I001: fix long line and import sort in llm_whisperer helper
- ANN401: replace Any with object|None in dispatcher.py; add noqa in test helpers
- F841: remove unused workflow_id and result assignments
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
---------
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
* UN-3266 fix: resolve SonarCloud bugs S2259 and S1244 in PR #1849
- S2259: guard against None after _discover_plugins() in loader.py
to satisfy static analysis on the dict[str,type]|None field type
- S1244: replace float equality checks with pytest.approx() in
test_answer_prompt.py and test_phase2h.py
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* UN-3266 fix: resolve SonarCloud code smells in PR #1849
- S5799: Merge all implicit string concatenations in log messages
(legacy_executor.py, tasks.py, dispatcher.py, orchestrator.py,
registry.py, variable_replacement.py, structure_tool_task.py)
- S1192: Extract duplicate literal to _NO_CELERY_APP_MSG constant in
dispatcher.py
- S1871: Merge identical elif/else branches in tasks.py and
test_sanity_phase6j.py
- S1186: Add comment to empty stub method in test_sanity_phase6a.py
- S1481: Remove unused local variables in test_sanity_phase6d/e/f/g/h/j
and test_phase5d.py
- S117: Rename PascalCase local variables to snake_case in
test_sanity_phase3/5/6i.py
- S5655: Broaden tool type annotation to StreamMixin in
IndexingUtils.generate_index_key and PlatformHelper.get_adapter_config
- docker:S7031: Merge consecutive RUN instructions in
worker-unified.Dockerfile
- javascript:S1128: Remove unused pollForCompletion import in
usePromptRun.js
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* UN-3266 fix: wrap long log message in dispatcher.py to fix E501
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* UN-3266 fix: resolve remaining SonarCloud S117 naming violations
Rename PascalCase local variables to snake_case to comply with S117:
- legacy_executor.py: rename tuple-unpacked _get_prompt_deps() results
(AnswerPromptService→answer_prompt_svc, RetrievalService→retrieval_svc,
VariableReplacementService→variable_replacement_svc, LLM→llm_cls,
EmbeddingCompat→embedding_compat_cls, VectorDB→vector_db_cls) and
update all downstream usages including _apply_type_conversion and
_handle_summarize
- test_phase1_log_streaming.py: rename Mock* local variables to
mock_* snake_case equivalents
- test_sanity_phase3.py: rename MockDispatcher→mock_dispatcher_cls
and MockShim→mock_shim_cls across all 10 test methods
- test_sanity_phase5.py: rename MockShim→mock_shim, MockX2Text→mock_x2text
in 6 test methods; MockDispatcher→mock_dispatcher_cls in dispatch test;
fix LLM_cls→llm_cls, EmbeddingCompat→embedding_compat_cls,
VectorDB→vector_db_cls in _mock_prompt_deps helper
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* UN-3266 fix: resolve remaining SonarCloud code smells in PR #1849
- test_sanity_phase2/4.py, test_answer_prompt.py: rename PascalCase
local variables in _mock_prompt_deps/_mock_deps to snake_case
(RetrievalService→retrieval_svc, VariableReplacementService→
variable_replacement_svc, Index→index_cls, LLM_cls→llm_cls,
EmbeddingCompat→embedding_compat_cls, VectorDB→vector_db_cls,
AnswerPromptService→answer_prompt_svc_cls) — fixes S117
- test_sanity_phase3.py: remove unused local variable "result" — fixes S1481
- structure_tool_task.py: remove redundant json.JSONDecodeError from
except clause (subclass of ValueError) — fixes S5713
- shared/workflow/execution/service.py: replace generic Exception with
RuntimeError for structure tool failure — fixes S112
- run-worker-docker.sh: define EXECUTOR_WORKER_TYPE constant and
replace 10 literal "executor" occurrences — fixes S1192
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* UN-3266 fix: resolve SonarCloud cognitive complexity and code smell violations
- Reduce cognitive complexity in answer_prompt.py:
- Extract _build_grammar_notes, _run_webhook_postprocess helpers
- _is_safe_public_url: extracted _resolve_host_addresses helper
- handle_json: early-return pattern eliminates nesting
- construct_prompt: delegates grammar loop to _build_grammar_notes
- Reduce cognitive complexity in legacy_executor.py:
- Extract _execute_single_prompt, _run_table_extraction helpers
- Extract _run_challenge_if_enabled, _run_evaluation_if_enabled
- Extract _inject_table_settings, _finalize_pipeline_result
- Extract _convert_number_answer, _convert_scalar_answer
- Extract _sanitize_dict_values helper
- _handle_answer_prompt CC reduced from 50 to ~7
- Reduce CC in structure_tool_task.py: guard-clause refactor
- Reduce CC in backend: dto.py, deployment_helper.py,
api_deployment_views.py, prompt_studio_helper.py
- Fix S117: rename PascalCase local vars in test_answer_prompt.py
- Fix S1192: extract EXECUTOR_WORKER_TYPE constant in run-worker.sh
- Fix S1172: remove unused params from structure_tool_task.py
- Fix S5713: remove redundant JSONDecodeError in json_repair_helper.py
- Fix S112/S5727 in test_execution.py
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* UN-3266 fix: remove unused RetrievalStrategy import from _handle_answer_prompt
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* UN-3266 fix: rename UsageHelper params to lowercase (N803)
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* UN-3266 fix: resolve remaining SonarCloud issues from check run 66691002192
- Add @staticmethod to _sanitize_null_values (fixes S2325 missing self)
- Reduce _execute_single_prompt params from 25 to 11 (S107)
by grouping services as deps tuple and extracting exec params
from context.executor_params
- Add NOSONAR suppression for raise exc in test helper (S112)
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* UN-3266 fix: remove unused locals in _handle_answer_prompt (F841)
execution_id, file_hash, log_events_id, custom_data are now extracted
inside _execute_single_prompt from context.executor_params.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* fix: resolve Biome linting errors in frontend source files
Auto-fixed 48 lint errors across 56 files: import ordering, block
statements, unused variable prefixing, and formatting issues.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* fix: replace dynamic import of SharePermission with static import in Workflows
Resolves vite build warning about SharePermission.jsx being both
dynamically and statically imported across the codebase.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* fix: resolve SonarCloud warnings in frontend components
- Remove unnecessary try-catch around PostHog event calls
- Flip negated condition in PromptOutput.handleTable for clarity
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Address PR #1849 review comments: fix null guards, dead code, and test drift
- Remove redundant inline `import uuid as _uuid` in views.py (use module-level uuid)
- URL-encode DB_USER in worker_celery.py result backend connection string
- Remove misleading task_queues=[Queue("executor")] from dispatch-only Celery app
- Remove dead `if not tool:` guards after objects.get() (already raises DoesNotExist)
- Move profile_manager/default_profile null checks before first dereference
- Reorder ProfileManager.objects.get before mark_document_indexed in tasks.py
- Handle ProfileManager.DoesNotExist as warning, not hard failure
- Wrap PostHog analytics in try/catch so failures don't block prompt execution
- Handle pending-indexing 200 response in usePromptRun.js (clear RUNNING status)
- Reset formData when metadata is missing in ConfigureDs.jsx
- Fix test_should_skip_extraction tests: function now takes 1 arg (outputs only)
- Fix agentic routing tests: mock X2Text.process, remove stale platform_helper kwarg
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Fix missing llm_usage_reason for summarize LLM usage tracking
Add PSKeys.LLM_USAGE_REASON to usage_kwargs in _handle_summarize() so
summarization costs appear under summarize_llm in API response metadata.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* UN-3266 [FIX] Fix single-pass extraction routing in LegacyExecutor
- Route _handle_structure_pipeline to _handle_single_pass_extraction when
is_single_pass=True (was always calling _handle_answer_prompt)
- Delegate _handle_single_pass_extraction to cloud plugin via ExecutorRegistry,
falling back to _handle_answer_prompt if plugin not installed
Co-Authored-By: Claude Opus 4.6 <noreply@anthro…
* Execution backend - revamp
* async flow
* Streaming progress to FE
* Removing multi hop in Prompt studio ide and structure tool
* UN-3234 [FIX] Add beta tag to agentic prompt studio navigation item
* Added executors for agentic prompt studio
* Added executors for agentic prompt studio
* Removed redundant envs
* Removed redundant envs
* Removed redundant envs
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Removed redundant envs
* Removed redundant envs
* Removed redundant envs
* Removed redundant envs
* Removed redundant envs
* Removed redundant envs
* Removed redundant envs
* Removed redundant envs
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Removed redundant envs
* adding worker for callbacks
* adding worker for callbacks
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* adding worker for callbacks
* adding worker for callbacks
* adding worker for callbacks
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Pluggable apps and plugins to fit the new async prompt execution architecture
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Pluggable apps and plugins to fit the new async prompt execution architecture
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Pluggable apps and plugins to fit the new async prompt execution architecture
* adding worker for callbacks
* adding worker for callbacks
* adding worker for callbacks
* adding worker for callbacks
* adding worker for callbacks
* adding worker for callbacks
* adding worker for callbacks
* adding worker for callbacks
* fix: write output files in agentic extraction pipeline
Agentic extraction returned early without writing INFILE (JSON) or
METADATA.json, causing destination connectors to read the original PDF
and fail with "Expected tool output type: TXT, got: application/pdf".
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* UN-3266 fix: replace hardcoded /tmp paths with secure temp dirs in tests (#1850)
* UN-3266 fix: replace hardcoded /tmp paths with secure temp dirs in tests
Replace hardcoded /tmp/ paths (SonarCloud S5443 security hotspots) with
pytest's tmp_path fixture or module-level tempfile.mkdtemp() constants
in all affected test files to avoid world-writable directory vulnerabilities.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
---------
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Update docs
* UN-3266 fix: remove dead code with undefined names in fetch_response
Remove unreachable code block after the async callback return in
fetch_response that still referenced output_count_before and response
from the old synchronous implementation, causing ruff F821 errors.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* Un 3266 fix security hotspot tmp paths (#1851)
* UN-3266 fix: replace hardcoded /tmp paths with secure temp dirs in tests
Replace hardcoded /tmp/ paths (SonarCloud S5443 security hotspots) with
pytest's tmp_path fixture or module-level tempfile.mkdtemp() constants
in all affected test files to avoid world-writable directory vulnerabilities.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* UN-3266 fix: resolve ruff linting failures across multiple files
- B026: pass url positionally in worker_celery.py to avoid star-arg after keyword
- N803: rename MockAsyncResult to mock_async_result in test_tasks.py
- E501/I001: fix long line and import sort in llm_whisperer helper
- ANN401: replace Any with object|None in dispatcher.py; add noqa in test helpers
- F841: remove unused workflow_id and result assignments
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
---------
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
* UN-3266 fix: resolve SonarCloud bugs S2259 and S1244 in PR #1849
- S2259: guard against None after _discover_plugins() in loader.py
to satisfy static analysis on the dict[str,type]|None field type
- S1244: replace float equality checks with pytest.approx() in
test_answer_prompt.py and test_phase2h.py
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* UN-3266 fix: resolve SonarCloud code smells in PR #1849
- S5799: Merge all implicit string concatenations in log messages
(legacy_executor.py, tasks.py, dispatcher.py, orchestrator.py,
registry.py, variable_replacement.py, structure_tool_task.py)
- S1192: Extract duplicate literal to _NO_CELERY_APP_MSG constant in
dispatcher.py
- S1871: Merge identical elif/else branches in tasks.py and
test_sanity_phase6j.py
- S1186: Add comment to empty stub method in test_sanity_phase6a.py
- S1481: Remove unused local variables in test_sanity_phase6d/e/f/g/h/j
and test_phase5d.py
- S117: Rename PascalCase local variables to snake_case in
test_sanity_phase3/5/6i.py
- S5655: Broaden tool type annotation to StreamMixin in
IndexingUtils.generate_index_key and PlatformHelper.get_adapter_config
- docker:S7031: Merge consecutive RUN instructions in
worker-unified.Dockerfile
- javascript:S1128: Remove unused pollForCompletion import in
usePromptRun.js
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* UN-3266 fix: wrap long log message in dispatcher.py to fix E501
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* UN-3266 fix: resolve remaining SonarCloud S117 naming violations
Rename PascalCase local variables to snake_case to comply with S117:
- legacy_executor.py: rename tuple-unpacked _get_prompt_deps() results
(AnswerPromptService→answer_prompt_svc, RetrievalService→retrieval_svc,
VariableReplacementService→variable_replacement_svc, LLM→llm_cls,
EmbeddingCompat→embedding_compat_cls, VectorDB→vector_db_cls) and
update all downstream usages including _apply_type_conversion and
_handle_summarize
- test_phase1_log_streaming.py: rename Mock* local variables to
mock_* snake_case equivalents
- test_sanity_phase3.py: rename MockDispatcher→mock_dispatcher_cls
and MockShim→mock_shim_cls across all 10 test methods
- test_sanity_phase5.py: rename MockShim→mock_shim, MockX2Text→mock_x2text
in 6 test methods; MockDispatcher→mock_dispatcher_cls in dispatch test;
fix LLM_cls→llm_cls, EmbeddingCompat→embedding_compat_cls,
VectorDB→vector_db_cls in _mock_prompt_deps helper
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* UN-3266 fix: resolve remaining SonarCloud code smells in PR #1849
- test_sanity_phase2/4.py, test_answer_prompt.py: rename PascalCase
local variables in _mock_prompt_deps/_mock_deps to snake_case
(RetrievalService→retrieval_svc, VariableReplacementService→
variable_replacement_svc, Index→index_cls, LLM_cls→llm_cls,
EmbeddingCompat→embedding_compat_cls, VectorDB→vector_db_cls,
AnswerPromptService→answer_prompt_svc_cls) — fixes S117
- test_sanity_phase3.py: remove unused local variable "result" — fixes S1481
- structure_tool_task.py: remove redundant json.JSONDecodeError from
except clause (subclass of ValueError) — fixes S5713
- shared/workflow/execution/service.py: replace generic Exception with
RuntimeError for structure tool failure — fixes S112
- run-worker-docker.sh: define EXECUTOR_WORKER_TYPE constant and
replace 10 literal "executor" occurrences — fixes S1192
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* UN-3266 fix: resolve SonarCloud cognitive complexity and code smell violations
- Reduce cognitive complexity in answer_prompt.py:
- Extract _build_grammar_notes, _run_webhook_postprocess helpers
- _is_safe_public_url: extracted _resolve_host_addresses helper
- handle_json: early-return pattern eliminates nesting
- construct_prompt: delegates grammar loop to _build_grammar_notes
- Reduce cognitive complexity in legacy_executor.py:
- Extract _execute_single_prompt, _run_table_extraction helpers
- Extract _run_challenge_if_enabled, _run_evaluation_if_enabled
- Extract _inject_table_settings, _finalize_pipeline_result
- Extract _convert_number_answer, _convert_scalar_answer
- Extract _sanitize_dict_values helper
- _handle_answer_prompt CC reduced from 50 to ~7
- Reduce CC in structure_tool_task.py: guard-clause refactor
- Reduce CC in backend: dto.py, deployment_helper.py,
api_deployment_views.py, prompt_studio_helper.py
- Fix S117: rename PascalCase local vars in test_answer_prompt.py
- Fix S1192: extract EXECUTOR_WORKER_TYPE constant in run-worker.sh
- Fix S1172: remove unused params from structure_tool_task.py
- Fix S5713: remove redundant JSONDecodeError in json_repair_helper.py
- Fix S112/S5727 in test_execution.py
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* UN-3266 fix: remove unused RetrievalStrategy import from _handle_answer_prompt
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* UN-3266 fix: rename UsageHelper params to lowercase (N803)
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* UN-3266 fix: resolve remaining SonarCloud issues from check run 66691002192
- Add @staticmethod to _sanitize_null_values (fixes S2325 missing self)
- Reduce _execute_single_prompt params from 25 to 11 (S107)
by grouping services as deps tuple and extracting exec params
from context.executor_params
- Add NOSONAR suppression for raise exc in test helper (S112)
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* UN-3266 fix: remove unused locals in _handle_answer_prompt (F841)
execution_id, file_hash, log_events_id, custom_data are now extracted
inside _execute_single_prompt from context.executor_params.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* fix: resolve Biome linting errors in frontend source files
Auto-fixed 48 lint errors across 56 files: import ordering, block
statements, unused variable prefixing, and formatting issues.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* fix: replace dynamic import of SharePermission with static import in Workflows
Resolves vite build warning about SharePermission.jsx being both
dynamically and statically imported across the codebase.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* fix: resolve SonarCloud warnings in frontend components
- Remove unnecessary try-catch around PostHog event calls
- Flip negated condition in PromptOutput.handleTable for clarity
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Address PR #1849 review comments: fix null guards, dead code, and test drift
- Remove redundant inline `import uuid as _uuid` in views.py (use module-level uuid)
- URL-encode DB_USER in worker_celery.py result backend connection string
- Remove misleading task_queues=[Queue("executor")] from dispatch-only Celery app
- Remove dead `if not tool:` guards after objects.get() (already raises DoesNotExist)
- Move profile_manager/default_profile null checks before first dereference
- Reorder ProfileManager.objects.get before mark_document_indexed in tasks.py
- Handle ProfileManager.DoesNotExist as warning, not hard failure
- Wrap PostHog analytics in try/catch so failures don't block prompt execution
- Handle pending-indexing 200 response in usePromptRun.js (clear RUNNING status)
- Reset formData when metadata is missing in ConfigureDs.jsx
- Fix test_should_skip_extraction tests: function now takes 1 arg (outputs only)
- Fix agentic routing tests: mock X2Text.process, remove stale platform_helper kwarg
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Fix missing llm_usage_reason for summarize LLM usage tracking
Add PSKeys.LLM_USAGE_REASON to usage_kwargs in _handle_summarize() so
summarization costs appear under summarize_llm in API response metadata.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* UN-3266 [FIX] Fix single-pass extraction routing in LegacyExecutor
- Route _handle_structure_pipeline to _handle_single_pass_extraction when
is_single_pass=True (was always calling _handle_answer_prompt)
- Delegate _handle_single_pass_extraction to cloud plugin via ExecutorRegistry,
falling back to _handle_answer_prompt if plugin not installed
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* Fixing API depployment response mismatches
* Fix single-pass extraction showing only one prompt result in real-time
- Fix accumulation bug in usePromptOutput updateCoverage() where each
loop iteration spread the original promptOutputs instead of the
accumulating updatedPromptOutputs, causing only the last prompt to
render
- Improve index success toast to show document name
- Strip adapter names from index key configs for consistent hashing
- Update sdk1 uv.lock
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* Move summarize from sync Django plugin to executor worker for IDE index
When "Summarize" is enabled and a user indexes a new document in Prompt
Studio, the backend returned a 500 because the sync Django plugin tried
to read the extracted .txt file before extraction happened in the worker.
Fix: defer summarization to the executor worker's _handle_ide_index
(extract → summarize → index), build summarize_params in the payload,
and track the summarize index in the ide_index_complete callback.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* Address PR #1849 review comments: null guards, thread safety
- Fix null guard ordering in build_index_payload: add DefaultProfileError
check before calling validators on default_profile
- Fix null guard ordering in _fetch_single_pass_response: move check
before .llm.id access and validators (was dead code after dereference)
- Add threading.Lock to worker_celery singleton to prevent race under
concurrent gunicorn threads
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* Add documentation to ExecutionResponse DTO describing result structure
Documents the ExecutionResponse dataclass fields, especially the
result attribute's per-file dict structure (output, metadata, metrics,
error keys) as requested in PR review.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* Fix PR review issues: IDOR, null guards, rollback, spinner, summarize, prompt lookup
- Strip result payload from task_status to prevent IDOR data leak
- Move null guard before validators in build_fetch_response_payload
- Roll back indexing flag on broker failure in index_document
- Use explicit IDs for spinner clearing instead of ORM serialization format
- Catch broad exceptions in summarize tracking to prevent false failures
- Guard prompt_id lookup in fetch_response with 400/404 responses
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Fix CI, tests, and add async prompt studio improvements
- Fix biome import ordering in frontend test files
- Fix 22 stale backend test assertions in test_tasks.py (patch targets,
return values, view dispatch pattern, remove TestCeleryConfig)
- Add ide_prompt_complete callback tests
- Add frontend vitest config and regression tests for null guards,
stale closures, and single-pass loading guard
- Add LLMCompat llama-index compatibility wrapper in SDK1
- Add litellm cohere embed timeout monkey-patch (v1.82.3)
- Improve S3 filesystem helper (region_name, empty credential handling)
- Add RetrieverLLM and lazy LLM creation for retrievers
- Improve worker cleanup: api_client.close() in finally blocks,
early return on setup failure in API deployment tasks
- Add workers conftest.py for test environment setup
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Fix pre-existing biome CI errors: import ordering and formatting
Auto-fix 18 pre-existing organizeImports and formatting errors across
17 frontend files that were blocking biome ci on the entire codebase.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* Fix ruff F821: add missing transaction import in prompt_studio_helper
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* Add input validation guards to bulk_fetch_response endpoint
Validate prompt_ids (non-empty), document_id (required), and handle
DoesNotExist for both prompts and document to return proper 400/404
instead of dispatching no-op tasks or raising unhandled 500 errors.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* IDE Call backs
* Sonar issues fix
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Fix ruff errors: restore summary_profile variable, suppress TC001 in dispatcher
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Update bun.lock to match package.json dependency ranges
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* Fix all biome lint warnings: empty blocks, missing braces, forEach returns, unused vars
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* Move ExecutionContext import into TYPE_CHECKING block
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Fix SonarQube issues: duplication, naming, nesting, unused var
- Extract _parse_json_body() helper and _ERR_INVALID_JSON constant to
deduplicate 5 identical JSON parsing blocks in internal_views.py
- Rename `User` local variable to `user_model` (naming convention)
- Merge _emit_result/_emit_error into unified _emit_event() in
ide_callback tasks to reduce code duplication
- Extract _get_task_error() helper to deduplicate AsyncResult error
retrieval in ide_index_error and ide_prompt_error
- Remove unused `mock_ar_cls` variable in test_ide_callback.py
- Add security note documenting why @csrf_exempt is safe on internal endpoints
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* Replace worker-ide-callback Dockerfile with worker-unified
The IDE callback worker should use the unified worker image
(worker-unified.Dockerfile) consistent with all other v2 workers.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* Add celery_executor_agentic queue to executor worker
The executor worker only consumed from celery_executor_legacy, but the
agentic prompt studio dispatches tasks to celery_executor_agentic. This
caused agentic operations to sit in RabbitMQ with no consumer, resulting
in timeouts and stuck-in-progress states.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* FIxing email enforce type
* Removing line-item from select choices
* Update workers/shared/enums/worker_enums_base.py
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
Signed-off-by: harini-venkataraman <115449948+harini-venkataraman@users.noreply.github.com>
* Update backend/workflow_manager/workflow_v2/workflow_helper.py
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
Signed-off-by: harini-venkataraman <115449948+harini-venkataraman@users.noreply.github.com>
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Fix false success logs and silent failures in ETL destination pipelines
- Widen except clause in structure_tool_task to catch FileOperationError
and log write paths for diagnostics
- Add diagnostic logging at all silent return-None points in destination
connector so missing INFILE/METADATA paths are visible in logs
- Raise RuntimeError instead of silently skipping when no tool execution
result is available for DB/FS destinations, preventing false success
- Remove dead retry config from execute_bin task (max_retries=0)
- Fix duplicate EXECUTOR/IDE_CALLBACK enum entries in WorkerType
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Revert ETL destination pipeline changes — deferring to next cut
Reverts diagnostic logging and error-raising changes in
structure_tool_task.py and destination_connector.py.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* Fix false success logs and missing data in ETL destination pipelines
The Celery-based structure tool execution never created the COPY_TO_FOLDER
directory that FS destination connectors expect, causing "file successfully
sent" logs with no data written. DB destinations silently skipped insertion
when tool_execution_result was None, also producing false success.
- Write structured output to COPY_TO_FOLDER for both regular and agentic paths
- Widen exception handling to catch FileOperationError from fs.json_dump
- Raise RuntimeError instead of silently skipping in FS/DB destination handlers
- Add warning logs at silent return-None points in result retrieval
- Surface METADATA.json write failures with error-level logging
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* Fix missing context_retrieval metric for single pass extraction
The cloud single_pass_extraction plugin handles retrieval internally but
does not report context_retrieval timing in its metrics. This adds a
post-execution file-read measurement that injects the metric, matching
what RetrievalService.retrieve_complete_context provides for the normal
answer_prompt path. Also forces chunk-size=0 for single pass so the OSS
fallback path uses full-context retrieval instead of vector DB.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* Fix Unstructured IO adapter PermissionError on remote storage
Rewrite UnstructuredHelper.process_document() to read file bytes via
fs.read() and wrap in BytesIO, removing the hardcoded local FileStorage
download/builtin open() pattern. The previous code assumed
input_file_path was a local filesystem path, which broke in the executor
worker container where files live in MinIO and the local staging path
isn't mounted. Now matches the pattern used by LLMWhisperer v2 and works
for both local and remote storage backends.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* Defer subscription usage tracking to IDE callback workers
Move subscription usage commit from the synchronous Prompt Studio entry
points (index_document, prompt_responder) into the async IDE callback
tasks (ide_index_complete, ide_prompt_complete). With the new executor
flow, the sync entry points return before the actual execution finishes,
so the dashboard usage decorator was firing prematurely and missing real
usage data. Tracking now runs after the executor signals success via the
callback, ensuring dashboard usage metrics reflect completed runs only.
Errors from the subscription plugin are caught and logged so they never
fail the callback. Plugin is optional (OSS mode is a no-op).
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* Fix missing embedding metadata in API deployment with chunking
In the structure pipeline indexing path, _run_pipeline_index built the
INDEX executor_params without usage_kwargs. This caused EmbeddingCompat
to register its UsageHandler callback with empty kwargs, so audit DB
rows for embedding usage were stored without run_id/file_execution_id.
get_usage_by_model() in the API deployment then returned no embedding
data, leaving the embedding key absent from the response metadata.
Propagate usage_kwargs from extract_params through _run_pipeline_index
into the INDEX ExecutionContext so the embedding adapter's callback
records audit rows against the correct file_execution_id.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* Fix email enforce type returning "NA" string and surface null in FE
The EMAIL branch in LegacyExecutor stored the literal string "NA" when
the LLM could not extract an address — first because the early-return
short-circuited before _convert_scalar_answer ran, and second because
_convert_scalar_answer never re-checked the second-pass LLM result.
The top-level NA → None sanitizer was also missing, so any "NA" that
slipped through type conversion reached the FE as a string.
Backend (workers/executor/executors/legacy_executor.py):
- _convert_scalar_answer now also returns None when the LLM
extraction itself yields "NA" (benefits both EMAIL and DATE)
- EMAIL branch in _convert_answer_by_type now delegates to
_convert_scalar_answer instead of inlining the if/else
- _sanitize_null_values re-adds the top-level scalar "NA" → None
branch as a defensive backstop, with .strip() symmetry across
dict, list, and nested helpers
Frontend (DisplayPromptResult.jsx + PromptCard.css):
- Split the null/undefined early-return: undefined still shows
"Yet to run", but null now renders an italic-grey "null" literal
so the user can distinguish "ran but produced no value" from
"never ran"
Tests:
- workers/tests/test_answer_prompt.py: TestNullSanitization NA
cases assert None instead of preserved strings; new
TestConvertScalarAnswer covers first-pass / second-pass /
success paths
- DisplayPromptResult.test.jsx: null test asserts the literal
"null" is rendered (and "Yet to run" is not)
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* Feat/line item executor plugin (#1899)
* [FIX] Executor Queue for Agentic extraction (#1893)
* Execution backend - revamp
* async flow
* Streaming progress to FE
* Removing multi hop in Prompt studio ide and structure tool
* UN-3234 [FIX] Add beta tag to agentic prompt studio navigation item
* Added executors for agentic prompt studio
* Added executors for agentic prompt studio
* Removed redundant envs
* Removed redundant envs
* Removed redundant envs
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Removed redundant envs
* Removed redundant envs
* Removed redundant envs
* Removed redundant envs
* Removed redundant envs
* Removed redundant envs
* Removed redundant envs
* Removed redundant envs
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Removed redundant envs
* adding worker for callbacks
* adding worker for callbacks
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* adding worker for callbacks
* adding worker for callbacks
* adding worker for callbacks
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Pluggable apps and plugins to fit the new async prompt execution architecture
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Pluggable apps and plugins to fit the new async prompt execution architecture
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Pluggable apps and plugins to fit the new async prompt execution architecture
* adding worker for callbacks
* adding worker for callbacks
* adding worker for callbacks
* adding worker for callbacks
* adding worker for callbacks
* adding worker for callbacks
* adding worker for callbacks
* adding worker for callbacks
* fix: write output files in agentic extraction pipeline
Agentic extraction returned early without writing INFILE (JSON) or
METADATA.json, causing destination connectors to read the original PDF
and fail with "Expected tool output type: TXT, got: application/pdf".
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* UN-3266 fix: replace hardcoded /tmp paths with secure temp dirs in tests (#1850)
* UN-3266 fix: replace hardcoded /tmp paths with secure temp dirs in tests
Replace hardcoded /tmp/ paths (SonarCloud S5443 security hotspots) with
pytest's tmp_path fixture or module-level tempfile.mkdtemp() constants
in all affected test files to avoid world-writable directory vulnerabilities.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
---------
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Update docs
* UN-3266 fix: remove dead code with undefined names in fetch_response
Remove unreachable code block after the async callback return in
fetch_response that still referenced output_count_before and response
from the old synchronous implementation, causing ruff F821 errors.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* Un 3266 fix security hotspot tmp paths (#1851)
* UN-3266 fix: replace hardcoded /tmp paths with secure temp dirs in tests
Replace hardcoded /tmp/ paths (SonarCloud S5443 security hotspots) with
pytest's tmp_path fixture or module-level tempfile.mkdtemp() constants
in all affected test files to avoid world-writable directory vulnerabilities.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* UN-3266 fix: resolve ruff linting failures across multiple files
- B026: pass url positionally in worker_celery.py to avoid star-arg after keyword
- N803: rename MockAsyncResult to mock_async_result in test_tasks.py
- E501/I001: fix long line and import sort in llm_whisperer helper
- ANN401: replace Any with object|None in dispatcher.py; add noqa in test helpers
- F841: remove unused workflow_id and result assignments
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
---------
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
* UN-3266 fix: resolve SonarCloud bugs S2259 and S1244 in PR #1849
- S2259: guard against None after _discover_plugins() in loader.py
to satisfy static analysis on the dict[str,type]|None field type
- S1244: replace float equality checks with pytest.approx() in
test_answer_prompt.py and test_phase2h.py
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* UN-3266 fix: resolve SonarCloud code smells in PR #1849
- S5799: Merge all implicit string concatenations in log messages
(legacy_executor.py, tasks.py, dispatcher.py, orchestrator.py,
registry.py, variable_replacement.py, structure_tool_task.py)
- S1192: Extract duplicate literal to _NO_CELERY_APP_MSG constant in
dispatcher.py
- S1871: Merge identical elif/else branches in tasks.py and
test_sanity_phase6j.py
- S1186: Add comment to empty stub method in test_sanity_phase6a.py
- S1481: Remove unused local variables in test_sanity_phase6d/e/f/g/h/j
and test_phase5d.py
- S117: Rename PascalCase local variables to snake_case in
test_sanity_phase3/5/6i.py
- S5655: Broaden tool type annotation to StreamMixin in
IndexingUtils.generate_index_key and PlatformHelper.get_adapter_config
- docker:S7031: Merge consecutive RUN instructions in
worker-unified.Dockerfile
- javascript:S1128: Remove unused pollForCompletion import in
usePromptRun.js
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* UN-3266 fix: wrap long log message in dispatcher.py to fix E501
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* UN-3266 fix: resolve remaining SonarCloud S117 naming violations
Rename PascalCase local variables to snake_case to comply with S117:
- legacy_executor.py: rename tuple-unpacked _get_prompt_deps() results
(AnswerPromptService→answer_prompt_svc, RetrievalService→retrieval_svc,
VariableReplacementService→variable_replacement_svc, LLM→llm_cls,
EmbeddingCompat→embedding_compat_cls, VectorDB→vector_db_cls) and
update all downstream usages including _apply_type_conversion and
_handle_summarize
- test_phase1_log_streaming.py: rename Mock* local variables to
mock_* snake_case equivalents
- test_sanity_phase3.py: rename MockDispatcher→mock_dispatcher_cls
and MockShim→mock_shim_cls across all 10 test methods
- test_sanity_phase5.py: rename MockShim→mock_shim, MockX2Text→mock_x2text
in 6 test methods; MockDispatcher→mock_dispatcher_cls in dispatch test;
fix LLM_cls→llm_cls, EmbeddingCompat→embedding_compat_cls,
VectorDB→vector_db_cls in _mock_prompt_deps helper
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* UN-3266 fix: resolve remaining SonarCloud code smells in PR #1849
- test_sanity_phase2/4.py, test_answer_prompt.py: rename PascalCase
local variables in _mock_prompt_deps/_mock_deps to snake_case
(RetrievalService→retrieval_svc, VariableReplacementService→
variable_replacement_svc, Index→index_cls, LLM_cls→llm_cls,
EmbeddingCompat→embedding_compat_cls, VectorDB→vector_db_cls,
AnswerPromptService→answer_prompt_svc_cls) — fixes S117
- test_sanity_phase3.py: remove unused local variable "result" — fixes S1481
- structure_tool_task.py: remove redundant json.JSONDecodeError from
except clause (subclass of ValueError) — fixes S5713
- shared/workflow/execution/service.py: replace generic Exception with
RuntimeError for structure tool failure — fixes S112
- run-worker-docker.sh: define EXECUTOR_WORKER_TYPE constant and
replace 10 literal "executor" occurrences — fixes S1192
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* UN-3266 fix: resolve SonarCloud cognitive complexity and code smell violations
- Reduce cognitive complexity in answer_prompt.py:
- Extract _build_grammar_notes, _run_webhook_postprocess helpers
- _is_safe_public_url: extracted _resolve_host_addresses helper
- handle_json: early-return pattern eliminates nesting
- construct_prompt: delegates grammar loop to _build_grammar_notes
- Reduce cognitive complexity in legacy_executor.py:
- Extract _execute_single_prompt, _run_table_extraction helpers
- Extract _run_challenge_if_enabled, _run_evaluation_if_enabled
- Extract _inject_table_settings, _finalize_pipeline_result
- Extract _convert_number_answer, _convert_scalar_answer
- Extract _sanitize_dict_values helper
- _handle_answer_prompt CC reduced from 50 to ~7
- Reduce CC in structure_tool_task.py: guard-clause refactor
- Reduce CC in backend: dto.py, deployment_helper.py,
api_deployment_views.py, prompt_studio_helper.py
- Fix S117: rename PascalCase local vars in test_answer_prompt.py
- Fix S1192: extract EXECUTOR_WORKER_TYPE constant in run-worker.sh
- Fix S1172: remove unused params from structure_tool_task.py
- Fix S5713: remove redundant JSONDecodeError in json_repair_helper.py
- Fix S112/S5727 in test_execution.py
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* UN-3266 fix: remove unused RetrievalStrategy import from _handle_answer_prompt
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* UN-3266 fix: rename UsageHelper params to lowercase (N803)
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* UN-3266 fix: resolve remaining SonarCloud issues from check run 66691002192
- Add @staticmethod to _sanitize_null_values (fixes S2325 missing self)
- Reduce _execute_single_prompt params from 25 to 11 (S107)
by grouping services as deps tuple and extracting exec params
from context.executor_params
- Add NOSONAR suppression for raise exc in test helper (S112)
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* UN-3266 fix: remove unused locals in _handle_answer_prompt (F841)
execution_id, file_hash, log_events_id, custom_data are now extracted
inside _execute_single_prompt from context.executor_params.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* fix: resolve Biome linting errors in frontend source files
Auto-fixed 48 lint errors across 56 files: import ordering, block
statements, unused variable prefixing, and formatting issues.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* fix: replace dynamic import of SharePermission with static import in Workflows
Resolves vite build warning about SharePermission.jsx being both
dynamically and statically imported across the codebase.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* fix: resolve SonarCloud warnings in frontend components
- Remove unnecessary try-catch around PostHog event calls
- Flip negated condition in PromptOutput.handleTable for clarity
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Address PR #1849 review comments: fix null guards, dead code, and test drift
- Remove redundant inline `import uuid as _uuid` in views.py (use module-level uuid)
- URL-encode DB_USER in worker_celery.py result backend connection string
- Remove misleading task_queues=[Queue("executor")] from dispatch-only Celery app
- Remove dead `if not tool:` guards after objects.get() (already raises DoesNotExist)
- Move profile_manager/default_profile null checks before first dereference
- Reorder ProfileManager.objects.get before mark_document_indexed in tasks.py
- Handle ProfileManager.DoesNotExist as warning, not hard failure
- Wrap PostHog analytics in try/catch so failures don't block prompt execution
- Handle pending-indexing 200 response in usePromptRun.js (clear RUNNING status)
- Reset formData when metadata is missing in ConfigureDs.jsx
- Fix test_should_skip_extraction tests: function now takes 1 arg (outputs only)
- Fix agentic routing tests: mock X2Text.process, remove stale platform_helper kwarg
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Fix missing llm_usage_reason for summarize LLM usage tracking
Add PSKeys.LLM_USAGE_REASON to usage_kwargs in _handle_summarize() so
summarization costs appear under summarize_llm in API response metadata.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* UN-3266 [FIX] Fix single-pass extraction routing in LegacyExecutor
- Route _handle_structure_pipeline to _handle_single_pass_extraction when
is_single_pass=True (was always calling _handle_answer_prompt)
- Delegate _handle_single_pass_extraction to cloud plugin via ExecutorRegistry,
falling back to _handle_answer_prompt if plugin not installed
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* Fixing API depployment response mismatches
* Fix single-pass extraction showing only one prompt result in real-time
- Fix accumulation bug in usePromptOutput updateCoverage() where each
loop iteration spread the original promptOutputs instead of the
accumulating updatedPromptOutputs, causing only the last prompt to
render
- Improve index success toast to show document name
- Strip adapter names from index key configs for consistent hashing
- Update sdk1 uv.lock
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* Move summarize from sync Django plugin to executor worker for IDE index
When "Summarize" is enabled and a user indexes a new document in Prompt
Studio, the backend returned a 500 because the sync Django plugin tried
to read the extracted .txt file before extraction happened in the worker.
Fix: defer summarization to the executor worker's _handle_ide_index
(extract → summarize → index), build summarize_params in the payload,
and track the summarize index in the ide_index_complete callback.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* Address PR #1849 review comments: null guards, thread safety
- Fix null guard ordering in build_index_payload: add DefaultProfileError
check before calling validators on default_profile
- Fix null guard ordering in _fetch_single_pass_response: move check
before .llm.id access and validators (was dead code after dereference)
- Add threading.Lock to worker_celery singleton to prevent race under
concurrent gunicorn threads
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* Add documentation to ExecutionResponse DTO describing result structure
Documents the ExecutionResponse dataclass fields, especially the
result attribute's per-file dict structure (output, metadata, metrics,
error keys) as requested in PR review.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* Fix PR review issues: IDOR, null guards, rollback, spinner, summarize, prompt lookup
- Strip result payload from task_status to prevent IDOR data leak
- Move null guard before validators in build_fetch_response_payload
- Roll back indexing flag on broker failure in index_document
- Use explicit IDs for spinner clearing instead of ORM serialization format
- Catch broad exceptions in summarize tracking to prevent false failures
- Guard prompt_id lookup in fetch_response with 400/404 responses
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Fix CI, tests, and add async prompt studio improvements
- Fix biome import ordering in frontend test files
- Fix 22 stale backend test assertions in test_tasks.py (patch targets,
return values, view dispatch pattern, remove TestCeleryConfig)
- Add ide_prompt_complete callback tests
- Add frontend vitest config and regression tests for null guards,
stale closures, and single-pass loading guard
- Add LLMCompat llama-index compatibility wrapper in SDK1
- Add litellm cohere embed timeout monkey-patch (v1.82.3)
- Improve S3 filesystem helper (region_name, empty credential handling)
- Add RetrieverLLM and lazy LLM creation for retrievers
- Improve worker cleanup: api_client.close() in finally blocks,
early return on setup failure in API deployment tasks
- Add workers conftest.py for test environment setup
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Fix pre-existing biome CI errors: import ordering and formatting
Auto-fix 18 pre-existing organizeImports and formatting errors across
17 frontend files that were blocking biome ci on the entire codebase.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* Fix ruff F821: add missing transaction import in prompt_studio_helper
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* Add input validation guards to bulk_fetch_response endpoint
Validate prompt_ids (non-empty), document_id (required), and handle
DoesNotExist for both prompts and document to return proper 400/404
instead of dispatching no-op tasks or raising unhandled 500 errors.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* IDE Call backs
* Sonar issues fix
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Fix ruff errors: restore summary_profile variable, suppress TC001 in dispatcher
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Update bun.lock to match package.json dependency ranges
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* Fix all biome lint warnings: empty blocks, missing braces, forEach returns, unused vars
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* Move ExecutionContext import into TYPE_CHECKING block
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Fix SonarQube issues: duplication, naming, nesting, unused var
- Extract _parse_json_body() helper and _ERR_INVALID_JSON constant to
deduplicate 5 identical JSON parsing blocks in internal_views.py
- Rename `User` local variable to `user_model` (naming convention)
- Merge _emit_result/_emit_error into unified _emit_event() in
ide_callback tasks to reduce code duplication
- Extract _get_task_error() helper to deduplicate AsyncResult error
retrieval in ide_index_error and ide_prompt_error
- Remove unused `mock_ar_cls` variable in test_ide_callback.py
- Add security note documenting why @csrf_exempt is safe on internal endpoints
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* Replace worker-ide-callback Dockerfile with worker-unified
The IDE callback worker should use the unified worker image
(worker-unified.Dockerfile) consistent with all other v2 workers.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* Add celery_executor_agentic queue to executor worker
The executor worker only consumed from celery_executor_legacy, but the
agentic prompt studio dispatches tasks to celery_executor_agentic. This
caused agentic operations to sit in RabbitMQ with no consumer, resulting
in timeouts and stuck-in-progress states.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* FIxing email enforce type
* Removing line-item from select choices
* Update workers/shared/enums/worker_enums_base.py
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
Signed-off-by: harini-venkataraman <115449948+harini-venkataraman@users.noreply.github.com>
* Update backend/workflow_manager/workflow_v2/workflow_helper.py
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
Signed-off-by: harini-venkataraman <115449948+harini-venkataraman@users.noreply.github.com>
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Fix false success logs and silent failures in ETL destination pipelines
- Widen except clause in structure_tool_task to catch FileOperationError
and log write paths for diagnostics
- Add diagnostic logging at all silent return-None points in destination
connector so missing INFILE/METADATA paths are visible in logs
- Raise RuntimeError instead of silently skipping when no tool execution
result is available for DB/FS destinations, preventing false success
- Remove dead retry config from execute_bin task (max_retries=0)
- Fix duplicate EXECUTOR/IDE_CALLBACK enum entries in WorkerType
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Revert ETL destination pipeline changes — deferring to next cut
Reverts diagnostic logging and error-raising changes in
structure_tool_task.py and destination_connector.py.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
---------
Signed-off-by: harini-venkataraman <115449948+harini-venkataraman@users.noreply.github.com>
Co-authored-by: Ghost Jake <89829542+Deepak-Kesavan@users.noreply.github.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-authored-by: Ritwik G <100672805+ritwik-g@users.noreply.github.com>
Co-authored-by: Kirtiman Mishra <110175055+kirtimanmishrazipstack@users.noreply.github.com>
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
* [MISC] Fix blank LLM profile edit form and settings menu bold style (#1896)
- Replace form.resetFields() with form.setFieldsValue() to fix blank
edit form caused by Ant Design's initialValues being a one-time snapshot
- Remove Strict Mode-incompatible cleanup that cleared editLlmProfileId
- Clear editLlmProfileId in parent when adding new profile
- Remove unconditional bold on first settings popover menu item
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* [FEAT] Port LINE_ITEM extraction to pluggable executor architecture
LINE_ITEM enforce_type prompts previously raised an unconditional error
in the new workers executor. Wire the structure-tool path to delegate to
a `line_item` executor plugin (mirroring how TABLE delegates to the
`table_extractor` plugin), so API deployments / ETL pipelines can run
LINE_ITEM extraction once the cloud `line_item_extractor` plugin is
installed.
- legacy_executor.py: replace the LINE_ITEM error site in
`_execute_single_prompt` with a delegation call and add a new
`_run_line_item_extraction()` method structurally identical to
`_run_table_extraction()`.
- test_line_item_extraction.py: 5 new tests covering plugin missing,
success, sub-context construction, failure path, and end-to-end
Celery eager-mode delegation.
- test_sanity_phase6d.py: update the existing LINE_ITEM guard test
to match the new "install the line_item_extractor plugin" hint
and patch `ExecutorRegistry.get` to simulate the missing plugin.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
---------
Signed-off-by: harini-venkataraman <115449948+harini-venkataraman@users.noreply.github.com>
Co-authored-by: Ghost Jake <89829542+Deepak-Kesavan@users.noreply.github.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-authored-by: Ritwik G <100672805+ritwik-g@users.noreply.github.com>
Co-authored-by: Kirtiman Mishra <110175055+kirtimanmishrazipstack@users.noreply.github.com>
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
Co-authored-by: Chandrasekharan M <117059509+chandrasekharan-zipstack@users.noreply.github.com>
* Guard against undefined connector type in PostHog event lookup
ConfigureDs called type.toUpperCase() unconditionally, which threw a
TypeError when type was undefined and broke the connector save flow.
Use optional chaining and only fire the PostHog event when the key
maps to a known connector.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* Add worker-executor-v2 service to docker-compose under workers-v2 profile
Defines a second executor worker container that runs the unified
worker image with WORKER_TYPE=executor on port 8092. Gated behind
the workers-v2 compose profile so it is opt-in and does not affect
default deployments.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* Feat/line item executor plugin (#1900)
* [FIX] Executor Queue for Agentic extraction (#1893)
* Execution backend - revamp
* async flow
* Streaming progress to FE
* Removing multi hop in Prompt studio ide and structure tool
* UN-3234 [FIX] Add beta tag to agentic prompt studio navigation item
* Added executors for agentic prompt studio
* Added executors for agentic prompt studio
* Removed redundant envs
* Removed redundant envs
* Removed redundant envs
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Removed redundant envs
* Removed redundant envs
* Removed redundant envs
* Removed redundant envs
* Removed redundant envs
* Removed redundant envs
* Removed redundant envs
* Removed redundant envs
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Removed redundant envs
* adding worker for callbacks
* adding worker for callbacks
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* adding worker for callbacks
* adding worker for callbacks
* adding worker for callbacks
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Pluggable apps and plugins to fit the new async prompt execution architecture
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Pluggable apps and plugins to fit the new async prompt execution architecture
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Pluggable apps and plugins to fit the new async prompt execution architecture
* adding worker for callbacks
* adding worker for callbacks
* adding worker for callbacks
* adding worker for callbacks
* adding worker for callbacks
* adding worker for callbacks
* adding worker for callbacks
* adding worker for callbacks
* fix: write output files in agentic extraction pipeline
Agentic extraction returned early without writing INFILE (JSON) or
METADATA.json, causing destination connectors to read the original PDF
and fail with "Expected tool output type: TXT, got: application/pdf".
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* UN-3266 fix: replace hardcoded /tmp paths with secure temp dirs in tests (#1850)
* UN-3266 fix: replace hardcoded /tmp paths with secure temp dirs in tests
Replace hardcoded /tmp/ paths (SonarCloud S5443 security hotspots) with
pytest's tmp_path fixture or module-level tempfile.mkdtemp() constants
in all affected test files to avoid world-writable directory vulnerabilities.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
---------
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Update docs
* UN-3266 fix: remove dead code with undefined names in fetch_response
Remove unreachable code block after the async callback return in
fetch_response that still referenced output_count_before and response
from the old synchronous implementation, causing ruff F821 errors.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* Un 3266 fix security hotspot tmp paths (#1851)
* UN-3266 fix: replace hardcoded /tmp paths with secure temp dirs in tests
Replace hardcoded /tmp/ paths (SonarCloud S5443 security hotspots) with
pytest's tmp_path fixture or module-level tempfile.mkdtemp() constants
in all affected test files to avoid world-writable directory vulnerabilities.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* UN-3266 fix: resolve ruff linting failures across multiple files
- B026: pass url positionally in worker_celery.py to avoid star-arg after keyword
- N803: rename MockAsyncResult to mock_async_result in test_tasks.py
- E501/I001: fix long line and import sort in llm_whisperer helper
- ANN401: replace Any with object|None in dispatcher.py; add noqa in test helpers
- F841: remove unused workflow_id and result assignments
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
---------
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
* UN-3266 fix: resolve SonarCloud bugs S2259 and S1244 in PR #1849
- S2259: guard against None after _discover_plugins() in loader.py
to satisfy static analysis on the dict[str,type]|None field type
- S1244: replace float equality checks with pytest.approx() in
test_answer_prompt.py and test_phase2h.py
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* UN-3266 fix: resolve SonarCloud code smells in PR #1849
- S5799: Merge all implicit string concatenations in log messages
(legacy_executor.py, tasks.py, dispatcher.py, orchestrator.py,
registry.py, variable_replacement.py, structure_tool_task.py)
- S1192: Extract duplicate literal to _NO_CELERY_APP_MSG constant in
dispatcher.py
- S1871: Merge identical elif/else branches in tasks.py and
test_sanity_phase6j.py
- S1186: Add comment to empty stub method in test_sanity_phase6a.py
- S1481: Remove unused local variables in test_sanity_phase6d/e/f/g/h/j
and test_phase5d.py
- S117: Rename PascalCase local variables to snake_case in
test_sanity_phase3/5/6i.py
- S5655: Broaden tool type annotation to StreamMixin in
IndexingUtils.generate_index_key and PlatformHelper.get_adapter_config
- docker:S7031: Merge consecutive RUN instructions in
worker-unified.Dockerfile
- javascript:S1128: Remove unused pollForCompletion import in
usePromptRun.js
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* UN-3266 fix: wrap long log message in dispatcher.py to fix E501
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* UN-3266 fix: resolve remaining SonarCloud S117 naming violations
Rename PascalCase local variables to snake_case to comply with S117:
- legacy_executor.py: rename tuple-unpacked _get_prompt_deps() results
(AnswerPromptService→answer_prompt_svc, RetrievalService→retrieval_svc,
VariableReplacementService→variable_replacement_svc, LLM→llm_cls,
EmbeddingCompat→embedding_compat_cls, VectorDB→vector_db_cls) and
update all downstream usages including _apply_type_conversion and
_handle_summarize
- test_phase1_log_streaming.py: rename Mock* local variables to
mock_* snake_case equivalents
- test_sanity_phase3.py: rename MockDispatcher→mock_dispatcher_cls
and MockShim→mock_shim_cls across all 10 test methods
- test_sanity_phase5.py: rename MockShim→mock_shim, MockX2Text→mock_x2text
in 6 test methods; MockDispatcher→mock_dispatcher_cls in dispatch test;
fix LLM_cls→llm_cls, EmbeddingCompat→embedding_compat_cls,
VectorDB→vector_db_cls in _mock_prompt_deps helper
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* UN-3266 fix: resolve remaining SonarCloud code smells in PR #1849
- test_sanity_phase2/4.py, test_answer_prompt.py: rename PascalCase
local variables in _mock_prompt_deps/_mock_deps to snake_case
(RetrievalService→retrieval_svc, VariableReplacementService→
variable_replacement_svc, Index→index_cls, LLM_cls→llm_cls,
EmbeddingCompat→embedding_compat_cls, VectorDB→vector_db_cls,
AnswerPromptService→answer_prompt_svc_cls) — fixes S117
- test_sanity_phase3.py: remove unused local variable "result" — fixes S1481
- structure_tool_task.py: remove redundant json.JSONDecodeError from
except clause (subclass of ValueError) — fixes S5713
- shared/workflow/execution/service.py: replace generic Exception with
RuntimeError for structure tool failure — fixes S112
- run-worker-docker.sh: define EXECUTOR_WORKER_TYPE constant and
replace 10 literal "executor" occurrences — fixes S1192
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* UN-3266 fix: resolve SonarCloud cognitive complexity and code smell violations
- Reduce cognitive complexity in answer_prompt.py:
- Extract _build_grammar_notes, _run_webhook_postprocess helpers
- _is_safe_public_url: extracted _resolve_host_addresses helper
- handle_json: early-return pattern eliminates nesting
- construct_prompt: delegates grammar loop to _build_grammar_notes
- Reduce cognitive complexity in legacy_executor.py:
- Extract _execute_single_prompt, _run_table_extraction helpers
- Extract _run_challenge_if_enabled, _run_evaluation_if_enabled
- Extract _inject_table_settings, _finalize_pipeline_result
- Extract _convert_number_answer, _convert_scalar_answer
- Extract _sanitize_dict_values helper
- _handle_answer_prompt CC reduced from 50 to ~7
- Reduce CC in structure_tool_task.py: guard-clause refactor
- Reduce CC in backend: dto.py, deployment_helper.py,
api_deployment_views.py, prompt_studio_helper.py
- Fix S117: rename PascalCase local vars in test_answer_prompt.py
- Fix S1192: extract EXECUTOR_WORKER_TYPE constant in run-worker.sh
- Fix S1172: remove unused params from structure_tool_task.py
- Fix S5713: remove redundant JSONDecodeError in json_repair_helper.py
- Fix S112/S5727 in test_execution.py
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* UN-3266 fix: remove unused RetrievalStrategy import from _handle_answer_prompt
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* UN-3266 fix: rename UsageHelper params to lowercase (N803)
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* UN-3266 fix: resolve remaining SonarCloud issues from check run 66691002192
- Add @staticmethod to _sanitize_null_values (fixes S2325 missing self)
- Reduce _execute_single_prompt params from 25 to 11 (S107)
by grouping services as deps tuple and extracting exec params
from context.executor_params
- Add NOSONAR suppression for raise exc in test helper (S112)
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* UN-3266 fix: remove unused locals in _handle_answer_prompt (F841)
execution_id, file_hash, log_events_id, custom_data are now extracted
inside _execute_single_prompt from context.executor_params.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* fix: resolve Biome linting errors in frontend source files
Auto-fixed 48 lint errors across 56 files: import ordering, block
statements, unused variable prefixing, and formatting issues.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* fix: replace dynamic import of SharePermission with static import in Workflows
Resolves vite build warning about SharePermission.jsx being both
dynamically and statically imported across the codebase.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* fix: resolve SonarCloud warnings in frontend components
- Remove unnecessary try-catch around PostHog event calls
- Flip negated condition in PromptOutput.handleTable for clarity
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Address PR #1849 review comments: fix null guards, dead code, and test drift
- Remove redundant inline `import uuid as _uuid` in views.py (use module-level uuid)
- URL-encode DB_USER in worker_celery.py result backend connection string
- Remove misleading task_queues=[Queue("executor")] from dispatch-only Celery app
- Remove dead `if not tool:` guards after objects.get() (already raises DoesNotExist)
- Move profile_manager/default_profile null checks before first dereference
- Reorder ProfileManager.objects.get before mark_document_indexed in tasks.py
- Handle ProfileManager.DoesNotExist as warning, not hard failure
- Wrap PostHog analytics in try/catch so failures don't block prompt execution
- Handle pending-indexing 200 response in usePromptRun.js (clear RUNNING status)
- Reset formData when metadata is missing in ConfigureDs.jsx
- Fix test_should_skip_extraction tests: function now takes 1 arg (outputs only)
- Fix agentic routing tests: mock X2Text.process, remove stale platform_helper kwarg
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Fix missing llm_usage_reason for summarize LLM usage tracking
Add PSKeys.LLM_USAGE_REASON to usage_kwargs in _handle_summarize() so
summarization costs appear under summarize_llm in API response metadata.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* UN-3266 [FIX] Fix single-pass extraction routing in LegacyExecutor
- Route _handle_structure_pipeline to _handle_single_pass_extraction when
is_single_pass=True (was always calling _handle_answer_prompt)
- Delegate _handle_single_pass_extraction to cloud plugin via ExecutorRegistry,
falling back to _handle_answer_prompt if plugin not installed
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic…
* Execution backend - revamp
* async flow
* Streaming progress to FE
* Removing multi hop in Prompt studio ide and structure tool
* UN-3234 [FIX] Add beta tag to agentic prompt studio navigation item
* Added executors for agentic prompt studio
* Added executors for agentic prompt studio
* Removed redundant envs
* Removed redundant envs
* Removed redundant envs
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Removed redundant envs
* Removed redundant envs
* Removed redundant envs
* Removed redundant envs
* Removed redundant envs
* Removed redundant envs
* Removed redundant envs
* Removed redundant envs
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Removed redundant envs
* adding worker for callbacks
* adding worker for callbacks
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* adding worker for callbacks
* adding worker for callbacks
* adding worker for callbacks
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Pluggable apps and plugins to fit the new async prompt execution architecture
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Pluggable apps and plugins to fit the new async prompt execution architecture
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Pluggable apps and plugins to fit the new async prompt execution architecture
* adding worker for callbacks
* adding worker for callbacks
* adding worker for callbacks
* adding worker for callbacks
* adding worker for callbacks
* adding worker for callbacks
* adding worker for callbacks
* adding worker for callbacks
* fix: write output files in agentic extraction pipeline
Agentic extraction returned early without writing INFILE (JSON) or
METADATA.json, causing destination connectors to read the original PDF
and fail with "Expected tool output type: TXT, got: application/pdf".
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* UN-3266 fix: replace hardcoded /tmp paths with secure temp dirs in tests (#1850)
* UN-3266 fix: replace hardcoded /tmp paths with secure temp dirs in tests
Replace hardcoded /tmp/ paths (SonarCloud S5443 security hotspots) with
pytest's tmp_path fixture or module-level tempfile.mkdtemp() constants
in all affected test files to avoid world-writable directory vulnerabilities.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
---------
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Update docs
* UN-3266 fix: remove dead code with undefined names in fetch_response
Remove unreachable code block after the async callback return in
fetch_response that still referenced output_count_before and response
from the old synchronous implementation, causing ruff F821 errors.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* Un 3266 fix security hotspot tmp paths (#1851)
* UN-3266 fix: replace hardcoded /tmp paths with secure temp dirs in tests
Replace hardcoded /tmp/ paths (SonarCloud S5443 security hotspots) with
pytest's tmp_path fixture or module-level tempfile.mkdtemp() constants
in all affected test files to avoid world-writable directory vulnerabilities.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* UN-3266 fix: resolve ruff linting failures across multiple files
- B026: pass url positionally in worker_celery.py to avoid star-arg after keyword
- N803: rename MockAsyncResult to mock_async_result in test_tasks.py
- E501/I001: fix long line and import sort in llm_whisperer helper
- ANN401: replace Any with object|None in dispatcher.py; add noqa in test helpers
- F841: remove unused workflow_id and result assignments
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
---------
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
* UN-3266 fix: resolve SonarCloud bugs S2259 and S1244 in PR #1849
- S2259: guard against None after _discover_plugins() in loader.py
to satisfy static analysis on the dict[str,type]|None field type
- S1244: replace float equality checks with pytest.approx() in
test_answer_prompt.py and test_phase2h.py
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* UN-3266 fix: resolve SonarCloud code smells in PR #1849
- S5799: Merge all implicit string concatenations in log messages
(legacy_executor.py, tasks.py, dispatcher.py, orchestrator.py,
registry.py, variable_replacement.py, structure_tool_task.py)
- S1192: Extract duplicate literal to _NO_CELERY_APP_MSG constant in
dispatcher.py
- S1871: Merge identical elif/else branches in tasks.py and
test_sanity_phase6j.py
- S1186: Add comment to empty stub method in test_sanity_phase6a.py
- S1481: Remove unused local variables in test_sanity_phase6d/e/f/g/h/j
and test_phase5d.py
- S117: Rename PascalCase local variables to snake_case in
test_sanity_phase3/5/6i.py
- S5655: Broaden tool type annotation to StreamMixin in
IndexingUtils.generate_index_key and PlatformHelper.get_adapter_config
- docker:S7031: Merge consecutive RUN instructions in
worker-unified.Dockerfile
- javascript:S1128: Remove unused pollForCompletion import in
usePromptRun.js
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* UN-3266 fix: wrap long log message in dispatcher.py to fix E501
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* UN-3266 fix: resolve remaining SonarCloud S117 naming violations
Rename PascalCase local variables to snake_case to comply with S117:
- legacy_executor.py: rename tuple-unpacked _get_prompt_deps() results
(AnswerPromptService→answer_prompt_svc, RetrievalService→retrieval_svc,
VariableReplacementService→variable_replacement_svc, LLM→llm_cls,
EmbeddingCompat→embedding_compat_cls, VectorDB→vector_db_cls) and
update all downstream usages including _apply_type_conversion and
_handle_summarize
- test_phase1_log_streaming.py: rename Mock* local variables to
mock_* snake_case equivalents
- test_sanity_phase3.py: rename MockDispatcher→mock_dispatcher_cls
and MockShim→mock_shim_cls across all 10 test methods
- test_sanity_phase5.py: rename MockShim→mock_shim, MockX2Text→mock_x2text
in 6 test methods; MockDispatcher→mock_dispatcher_cls in dispatch test;
fix LLM_cls→llm_cls, EmbeddingCompat→embedding_compat_cls,
VectorDB→vector_db_cls in _mock_prompt_deps helper
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* UN-3266 fix: resolve remaining SonarCloud code smells in PR #1849
- test_sanity_phase2/4.py, test_answer_prompt.py: rename PascalCase
local variables in _mock_prompt_deps/_mock_deps to snake_case
(RetrievalService→retrieval_svc, VariableReplacementService→
variable_replacement_svc, Index→index_cls, LLM_cls→llm_cls,
EmbeddingCompat→embedding_compat_cls, VectorDB→vector_db_cls,
AnswerPromptService→answer_prompt_svc_cls) — fixes S117
- test_sanity_phase3.py: remove unused local variable "result" — fixes S1481
- structure_tool_task.py: remove redundant json.JSONDecodeError from
except clause (subclass of ValueError) — fixes S5713
- shared/workflow/execution/service.py: replace generic Exception with
RuntimeError for structure tool failure — fixes S112
- run-worker-docker.sh: define EXECUTOR_WORKER_TYPE constant and
replace 10 literal "executor" occurrences — fixes S1192
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* UN-3266 fix: resolve SonarCloud cognitive complexity and code smell violations
- Reduce cognitive complexity in answer_prompt.py:
- Extract _build_grammar_notes, _run_webhook_postprocess helpers
- _is_safe_public_url: extracted _resolve_host_addresses helper
- handle_json: early-return pattern eliminates nesting
- construct_prompt: delegates grammar loop to _build_grammar_notes
- Reduce cognitive complexity in legacy_executor.py:
- Extract _execute_single_prompt, _run_table_extraction helpers
- Extract _run_challenge_if_enabled, _run_evaluation_if_enabled
- Extract _inject_table_settings, _finalize_pipeline_result
- Extract _convert_number_answer, _convert_scalar_answer
- Extract _sanitize_dict_values helper
- _handle_answer_prompt CC reduced from 50 to ~7
- Reduce CC in structure_tool_task.py: guard-clause refactor
- Reduce CC in backend: dto.py, deployment_helper.py,
api_deployment_views.py, prompt_studio_helper.py
- Fix S117: rename PascalCase local vars in test_answer_prompt.py
- Fix S1192: extract EXECUTOR_WORKER_TYPE constant in run-worker.sh
- Fix S1172: remove unused params from structure_tool_task.py
- Fix S5713: remove redundant JSONDecodeError in json_repair_helper.py
- Fix S112/S5727 in test_execution.py
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* UN-3266 fix: remove unused RetrievalStrategy import from _handle_answer_prompt
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* UN-3266 fix: rename UsageHelper params to lowercase (N803)
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* UN-3266 fix: resolve remaining SonarCloud issues from check run 66691002192
- Add @staticmethod to _sanitize_null_values (fixes S2325 missing self)
- Reduce _execute_single_prompt params from 25 to 11 (S107)
by grouping services as deps tuple and extracting exec params
from context.executor_params
- Add NOSONAR suppression for raise exc in test helper (S112)
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* UN-3266 fix: remove unused locals in _handle_answer_prompt (F841)
execution_id, file_hash, log_events_id, custom_data are now extracted
inside _execute_single_prompt from context.executor_params.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* fix: resolve Biome linting errors in frontend source files
Auto-fixed 48 lint errors across 56 files: import ordering, block
statements, unused variable prefixing, and formatting issues.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* fix: replace dynamic import of SharePermission with static import in Workflows
Resolves vite build warning about SharePermission.jsx being both
dynamically and statically imported across the codebase.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* fix: resolve SonarCloud warnings in frontend components
- Remove unnecessary try-catch around PostHog event calls
- Flip negated condition in PromptOutput.handleTable for clarity
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Address PR #1849 review comments: fix null guards, dead code, and test drift
- Remove redundant inline `import uuid as _uuid` in views.py (use module-level uuid)
- URL-encode DB_USER in worker_celery.py result backend connection string
- Remove misleading task_queues=[Queue("executor")] from dispatch-only Celery app
- Remove dead `if not tool:` guards after objects.get() (already raises DoesNotExist)
- Move profile_manager/default_profile null checks before first dereference
- Reorder ProfileManager.objects.get before mark_document_indexed in tasks.py
- Handle ProfileManager.DoesNotExist as warning, not hard failure
- Wrap PostHog analytics in try/catch so failures don't block prompt execution
- Handle pending-indexing 200 response in usePromptRun.js (clear RUNNING status)
- Reset formData when metadata is missing in ConfigureDs.jsx
- Fix test_should_skip_extraction tests: function now takes 1 arg (outputs only)
- Fix agentic routing tests: mock X2Text.process, remove stale platform_helper kwarg
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Fix missing llm_usage_reason for summarize LLM usage tracking
Add PSKeys.LLM_USAGE_REASON to usage_kwargs in _handle_summarize() so
summarization costs appear under summarize_llm in API response metadata.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* UN-3266 [FIX] Fix single-pass extraction routing in LegacyExecutor
- Route _handle_structure_pipeline to _handle_single_pass_extraction when
is_single_pass=True (was always calling _handle_answer_prompt)
- Delegate _handle_single_pass_extraction to cloud plugin via ExecutorRegistry,
falling back to _handle_answer_prompt if plugin not installed
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* Fixing API depployment response mismatches
* Fix single-pass extraction showing only one prompt result in real-time
- Fix accumulation bug in usePromptOutput updateCoverage() where each
loop iteration spread the original promptOutputs instead of the
accumulating updatedPromptOutputs, causing only the last prompt to
render
- Improve index success toast to show document name
- Strip adapter names from index key configs for consistent hashing
- Update sdk1 uv.lock
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* Move summarize from sync Django plugin to executor worker for IDE index
When "Summarize" is enabled and a user indexes a new document in Prompt
Studio, the backend returned a 500 because the sync Django plugin tried
to read the extracted .txt file before extraction happened in the worker.
Fix: defer summarization to the executor worker's _handle_ide_index
(extract → summarize → index), build summarize_params in the payload,
and track the summarize index in the ide_index_complete callback.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* Address PR #1849 review comments: null guards, thread safety
- Fix null guard ordering in build_index_payload: add DefaultProfileError
check before calling validators on default_profile
- Fix null guard ordering in _fetch_single_pass_response: move check
before .llm.id access and validators (was dead code after dereference)
- Add threading.Lock to worker_celery singleton to prevent race under
concurrent gunicorn threads
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* Add documentation to ExecutionResponse DTO describing result structure
Documents the ExecutionResponse dataclass fields, especially the
result attribute's per-file dict structure (output, metadata, metrics,
error keys) as requested in PR review.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* Fix PR review issues: IDOR, null guards, rollback, spinner, summarize, prompt lookup
- Strip result payload from task_status to prevent IDOR data leak
- Move null guard before validators in build_fetch_response_payload
- Roll back indexing flag on broker failure in index_document
- Use explicit IDs for spinner clearing instead of ORM serialization format
- Catch broad exceptions in summarize tracking to prevent false failures
- Guard prompt_id lookup in fetch_response with 400/404 responses
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Fix CI, tests, and add async prompt studio improvements
- Fix biome import ordering in frontend test files
- Fix 22 stale backend test assertions in test_tasks.py (patch targets,
return values, view dispatch pattern, remove TestCeleryConfig)
- Add ide_prompt_complete callback tests
- Add frontend vitest config and regression tests for null guards,
stale closures, and single-pass loading guard
- Add LLMCompat llama-index compatibility wrapper in SDK1
- Add litellm cohere embed timeout monkey-patch (v1.82.3)
- Improve S3 filesystem helper (region_name, empty credential handling)
- Add RetrieverLLM and lazy LLM creation for retrievers
- Improve worker cleanup: api_client.close() in finally blocks,
early return on setup failure in API deployment tasks
- Add workers conftest.py for test environment setup
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Fix pre-existing biome CI errors: import ordering and formatting
Auto-fix 18 pre-existing organizeImports and formatting errors across
17 frontend files that were blocking biome ci on the entire codebase.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* Fix ruff F821: add missing transaction import in prompt_studio_helper
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* Add input validation guards to bulk_fetch_response endpoint
Validate prompt_ids (non-empty), document_id (required), and handle
DoesNotExist for both prompts and document to return proper 400/404
instead of dispatching no-op tasks or raising unhandled 500 errors.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* IDE Call backs
* Sonar issues fix
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Fix ruff errors: restore summary_profile variable, suppress TC001 in dispatcher
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Update bun.lock to match package.json dependency ranges
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* Fix all biome lint warnings: empty blocks, missing braces, forEach returns, unused vars
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* Move ExecutionContext import into TYPE_CHECKING block
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Fix SonarQube issues: duplication, naming, nesting, unused var
- Extract _parse_json_body() helper and _ERR_INVALID_JSON constant to
deduplicate 5 identical JSON parsing blocks in internal_views.py
- Rename `User` local variable to `user_model` (naming convention)
- Merge _emit_result/_emit_error into unified _emit_event() in
ide_callback tasks to reduce code duplication
- Extract _get_task_error() helper to deduplicate AsyncResult error
retrieval in ide_index_error and ide_prompt_error
- Remove unused `mock_ar_cls` variable in test_ide_callback.py
- Add security note documenting why @csrf_exempt is safe on internal endpoints
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* Replace worker-ide-callback Dockerfile with worker-unified
The IDE callback worker should use the unified worker image
(worker-unified.Dockerfile) consistent with all other v2 workers.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* Add celery_executor_agentic queue to executor worker
The executor worker only consumed from celery_executor_legacy, but the
agentic prompt studio dispatches tasks to celery_executor_agentic. This
caused agentic operations to sit in RabbitMQ with no consumer, resulting
in timeouts and stuck-in-progress states.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* FIxing email enforce type
* Removing line-item from select choices
* Update workers/shared/enums/worker_enums_base.py
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
Signed-off-by: harini-venkataraman <115449948+harini-venkataraman@users.noreply.github.com>
* Update backend/workflow_manager/workflow_v2/workflow_helper.py
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
Signed-off-by: harini-venkataraman <115449948+harini-venkataraman@users.noreply.github.com>
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Fix false success logs and silent failures in ETL destination pipelines
- Widen except clause in structure_tool_task to catch FileOperationError
and log write paths for diagnostics
- Add diagnostic logging at all silent return-None points in destination
connector so missing INFILE/METADATA paths are visible in logs
- Raise RuntimeError instead of silently skipping when no tool execution
result is available for DB/FS destinations, preventing false success
- Remove dead retry config from execute_bin task (max_retries=0)
- Fix duplicate EXECUTOR/IDE_CALLBACK enum entries in WorkerType
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Revert ETL destination pipeline changes — deferring to next cut
Reverts diagnostic logging and error-raising changes in
structure_tool_task.py and destination_connector.py.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* Fix false success logs and missing data in ETL destination pipelines
The Celery-based structure tool execution never created the COPY_TO_FOLDER
directory that FS destination connectors expect, causing "file successfully
sent" logs with no data written. DB destinations silently skipped insertion
when tool_execution_result was None, also producing false success.
- Write structured output to COPY_TO_FOLDER for both regular and agentic paths
- Widen exception handling to catch FileOperationError from fs.json_dump
- Raise RuntimeError instead of silently skipping in FS/DB destination handlers
- Add warning logs at silent return-None points in result retrieval
- Surface METADATA.json write failures with error-level logging
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* Fix missing context_retrieval metric for single pass extraction
The cloud single_pass_extraction plugin handles retrieval internally but
does not report context_retrieval timing in its metrics. This adds a
post-execution file-read measurement that injects the metric, matching
what RetrievalService.retrieve_complete_context provides for the normal
answer_prompt path. Also forces chunk-size=0 for single pass so the OSS
fallback path uses full-context retrieval instead of vector DB.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* Fix Unstructured IO adapter PermissionError on remote storage
Rewrite UnstructuredHelper.process_document() to read file bytes via
fs.read() and wrap in BytesIO, removing the hardcoded local FileStorage
download/builtin open() pattern. The previous code assumed
input_file_path was a local filesystem path, which broke in the executor
worker container where files live in MinIO and the local staging path
isn't mounted. Now matches the pattern used by LLMWhisperer v2 and works
for both local and remote storage backends.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* Defer subscription usage tracking to IDE callback workers
Move subscription usage commit from the synchronous Prompt Studio entry
points (index_document, prompt_responder) into the async IDE callback
tasks (ide_index_complete, ide_prompt_complete). With the new executor
flow, the sync entry points return before the actual execution finishes,
so the dashboard usage decorator was firing prematurely and missing real
usage data. Tracking now runs after the executor signals success via the
callback, ensuring dashboard usage metrics reflect completed runs only.
Errors from the subscription plugin are caught and logged so they never
fail the callback. Plugin is optional (OSS mode is a no-op).
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* Fix missing embedding metadata in API deployment with chunking
In the structure pipeline indexing path, _run_pipeline_index built the
INDEX executor_params without usage_kwargs. This caused EmbeddingCompat
to register its UsageHandler callback with empty kwargs, so audit DB
rows for embedding usage were stored without run_id/file_execution_id.
get_usage_by_model() in the API deployment then returned no embedding
data, leaving the embedding key absent from the response metadata.
Propagate usage_kwargs from extract_params through _run_pipeline_index
into the INDEX ExecutionContext so the embedding adapter's callback
records audit rows against the correct file_execution_id.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* Fix email enforce type returning "NA" string and surface null in FE
The EMAIL branch in LegacyExecutor stored the literal string "NA" when
the LLM could not extract an address — first because the early-return
short-circuited before _convert_scalar_answer ran, and second because
_convert_scalar_answer never re-checked the second-pass LLM result.
The top-level NA → None sanitizer was also missing, so any "NA" that
slipped through type conversion reached the FE as a string.
Backend (workers/executor/executors/legacy_executor.py):
- _convert_scalar_answer now also returns None when the LLM
extraction itself yields "NA" (benefits both EMAIL and DATE)
- EMAIL branch in _convert_answer_by_type now delegates to
_convert_scalar_answer instead of inlining the if/else
- _sanitize_null_values re-adds the top-level scalar "NA" → None
branch as a defensive backstop, with .strip() symmetry across
dict, list, and nested helpers
Frontend (DisplayPromptResult.jsx + PromptCard.css):
- Split the null/undefined early-return: undefined still shows
"Yet to run", but null now renders an italic-grey "null" literal
so the user can distinguish "ran but produced no value" from
"never ran"
Tests:
- workers/tests/test_answer_prompt.py: TestNullSanitization NA
cases assert None instead of preserved strings; new
TestConvertScalarAnswer covers first-pass / second-pass /
success paths
- DisplayPromptResult.test.jsx: null test asserts the literal
"null" is rendered (and "Yet to run" is not)
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* Feat/line item executor plugin (#1899)
* [FIX] Executor Queue for Agentic extraction (#1893)
* Execution backend - revamp
* async flow
* Streaming progress to FE
* Removing multi hop in Prompt studio ide and structure tool
* UN-3234 [FIX] Add beta tag to agentic prompt studio navigation item
* Added executors for agentic prompt studio
* Added executors for agentic prompt studio
* Removed redundant envs
* Removed redundant envs
* Removed redundant envs
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Removed redundant envs
* Removed redundant envs
* Removed redundant envs
* Removed redundant envs
* Removed redundant envs
* Removed redundant envs
* Removed redundant envs
* Removed redundant envs
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Removed redundant envs
* adding worker for callbacks
* adding worker for callbacks
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* adding worker for callbacks
* adding worker for callbacks
* adding worker for callbacks
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Pluggable apps and plugins to fit the new async prompt execution architecture
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Pluggable apps and plugins to fit the new async prompt execution architecture
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Pluggable apps and plugins to fit the new async prompt execution architecture
* adding worker for callbacks
* adding worker for callbacks
* adding worker for callbacks
* adding worker for callbacks
* adding worker for callbacks
* adding worker for callbacks
* adding worker for callbacks
* adding worker for callbacks
* fix: write output files in agentic extraction pipeline
Agentic extraction returned early without writing INFILE (JSON) or
METADATA.json, causing destination connectors to read the original PDF
and fail with "Expected tool output type: TXT, got: application/pdf".
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* UN-3266 fix: replace hardcoded /tmp paths with secure temp dirs in tests (#1850)
* UN-3266 fix: replace hardcoded /tmp paths with secure temp dirs in tests
Replace hardcoded /tmp/ paths (SonarCloud S5443 security hotspots) with
pytest's tmp_path fixture or module-level tempfile.mkdtemp() constants
in all affected test files to avoid world-writable directory vulnerabilities.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
---------
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Update docs
* UN-3266 fix: remove dead code with undefined names in fetch_response
Remove unreachable code block after the async callback return in
fetch_response that still referenced output_count_before and response
from the old synchronous implementation, causing ruff F821 errors.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* Un 3266 fix security hotspot tmp paths (#1851)
* UN-3266 fix: replace hardcoded /tmp paths with secure temp dirs in tests
Replace hardcoded /tmp/ paths (SonarCloud S5443 security hotspots) with
pytest's tmp_path fixture or module-level tempfile.mkdtemp() constants
in all affected test files to avoid world-writable directory vulnerabilities.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* UN-3266 fix: resolve ruff linting failures across multiple files
- B026: pass url positionally in worker_celery.py to avoid star-arg after keyword
- N803: rename MockAsyncResult to mock_async_result in test_tasks.py
- E501/I001: fix long line and import sort in llm_whisperer helper
- ANN401: replace Any with object|None in dispatcher.py; add noqa in test helpers
- F841: remove unused workflow_id and result assignments
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
---------
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
* UN-3266 fix: resolve SonarCloud bugs S2259 and S1244 in PR #1849
- S2259: guard against None after _discover_plugins() in loader.py
to satisfy static analysis on the dict[str,type]|None field type
- S1244: replace float equality checks with pytest.approx() in
test_answer_prompt.py and test_phase2h.py
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* UN-3266 fix: resolve SonarCloud code smells in PR #1849
- S5799: Merge all implicit string concatenations in log messages
(legacy_executor.py, tasks.py, dispatcher.py, orchestrator.py,
registry.py, variable_replacement.py, structure_tool_task.py)
- S1192: Extract duplicate literal to _NO_CELERY_APP_MSG constant in
dispatcher.py
- S1871: Merge identical elif/else branches in tasks.py and
test_sanity_phase6j.py
- S1186: Add comment to empty stub method in test_sanity_phase6a.py
- S1481: Remove unused local variables in test_sanity_phase6d/e/f/g/h/j
and test_phase5d.py
- S117: Rename PascalCase local variables to snake_case in
test_sanity_phase3/5/6i.py
- S5655: Broaden tool type annotation to StreamMixin in
IndexingUtils.generate_index_key and PlatformHelper.get_adapter_config
- docker:S7031: Merge consecutive RUN instructions in
worker-unified.Dockerfile
- javascript:S1128: Remove unused pollForCompletion import in
usePromptRun.js
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* UN-3266 fix: wrap long log message in dispatcher.py to fix E501
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* UN-3266 fix: resolve remaining SonarCloud S117 naming violations
Rename PascalCase local variables to snake_case to comply with S117:
- legacy_executor.py: rename tuple-unpacked _get_prompt_deps() results
(AnswerPromptService→answer_prompt_svc, RetrievalService→retrieval_svc,
VariableReplacementService→variable_replacement_svc, LLM→llm_cls,
EmbeddingCompat→embedding_compat_cls, VectorDB→vector_db_cls) and
update all downstream usages including _apply_type_conversion and
_handle_summarize
- test_phase1_log_streaming.py: rename Mock* local variables to
mock_* snake_case equivalents
- test_sanity_phase3.py: rename MockDispatcher→mock_dispatcher_cls
and MockShim→mock_shim_cls across all 10 test methods
- test_sanity_phase5.py: rename MockShim→mock_shim, MockX2Text→mock_x2text
in 6 test methods; MockDispatcher→mock_dispatcher_cls in dispatch test;
fix LLM_cls→llm_cls, EmbeddingCompat→embedding_compat_cls,
VectorDB→vector_db_cls in _mock_prompt_deps helper
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* UN-3266 fix: resolve remaining SonarCloud code smells in PR #1849
- test_sanity_phase2/4.py, test_answer_prompt.py: rename PascalCase
local variables in _mock_prompt_deps/_mock_deps to snake_case
(RetrievalService→retrieval_svc, VariableReplacementService→
variable_replacement_svc, Index→index_cls, LLM_cls→llm_cls,
EmbeddingCompat→embedding_compat_cls, VectorDB→vector_db_cls,
AnswerPromptService→answer_prompt_svc_cls) — fixes S117
- test_sanity_phase3.py: remove unused local variable "result" — fixes S1481
- structure_tool_task.py: remove redundant json.JSONDecodeError from
except clause (subclass of ValueError) — fixes S5713
- shared/workflow/execution/service.py: replace generic Exception with
RuntimeError for structure tool failure — fixes S112
- run-worker-docker.sh: define EXECUTOR_WORKER_TYPE constant and
replace 10 literal "executor" occurrences — fixes S1192
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* UN-3266 fix: resolve SonarCloud cognitive complexity and code smell violations
- Reduce cognitive complexity in answer_prompt.py:
- Extract _build_grammar_notes, _run_webhook_postprocess helpers
- _is_safe_public_url: extracted _resolve_host_addresses helper
- handle_json: early-return pattern eliminates nesting
- construct_prompt: delegates grammar loop to _build_grammar_notes
- Reduce cognitive complexity in legacy_executor.py:
- Extract _execute_single_prompt, _run_table_extraction helpers
- Extract _run_challenge_if_enabled, _run_evaluation_if_enabled
- Extract _inject_table_settings, _finalize_pipeline_result
- Extract _convert_number_answer, _convert_scalar_answer
- Extract _sanitize_dict_values helper
- _handle_answer_prompt CC reduced from 50 to ~7
- Reduce CC in structure_tool_task.py: guard-clause refactor
- Reduce CC in backend: dto.py, deployment_helper.py,
api_deployment_views.py, prompt_studio_helper.py
- Fix S117: rename PascalCase local vars in test_answer_prompt.py
- Fix S1192: extract EXECUTOR_WORKER_TYPE constant in run-worker.sh
- Fix S1172: remove unused params from structure_tool_task.py
- Fix S5713: remove redundant JSONDecodeError in json_repair_helper.py
- Fix S112/S5727 in test_execution.py
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* UN-3266 fix: remove unused RetrievalStrategy import from _handle_answer_prompt
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* UN-3266 fix: rename UsageHelper params to lowercase (N803)
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* UN-3266 fix: resolve remaining SonarCloud issues from check run 66691002192
- Add @staticmethod to _sanitize_null_values (fixes S2325 missing self)
- Reduce _execute_single_prompt params from 25 to 11 (S107)
by grouping services as deps tuple and extracting exec params
from context.executor_params
- Add NOSONAR suppression for raise exc in test helper (S112)
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* UN-3266 fix: remove unused locals in _handle_answer_prompt (F841)
execution_id, file_hash, log_events_id, custom_data are now extracted
inside _execute_single_prompt from context.executor_params.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* fix: resolve Biome linting errors in frontend source files
Auto-fixed 48 lint errors across 56 files: import ordering, block
statements, unused variable prefixing, and formatting issues.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* fix: replace dynamic import of SharePermission with static import in Workflows
Resolves vite build warning about SharePermission.jsx being both
dynamically and statically imported across the codebase.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* fix: resolve SonarCloud warnings in frontend components
- Remove unnecessary try-catch around PostHog event calls
- Flip negated condition in PromptOutput.handleTable for clarity
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Address PR #1849 review comments: fix null guards, dead code, and test drift
- Remove redundant inline `import uuid as _uuid` in views.py (use module-level uuid)
- URL-encode DB_USER in worker_celery.py result backend connection string
- Remove misleading task_queues=[Queue("executor")] from dispatch-only Celery app
- Remove dead `if not tool:` guards after objects.get() (already raises DoesNotExist)
- Move profile_manager/default_profile null checks before first dereference
- Reorder ProfileManager.objects.get before mark_document_indexed in tasks.py
- Handle ProfileManager.DoesNotExist as warning, not hard failure
- Wrap PostHog analytics in try/catch so failures don't block prompt execution
- Handle pending-indexing 200 response in usePromptRun.js (clear RUNNING status)
- Reset formData when metadata is missing in ConfigureDs.jsx
- Fix test_should_skip_extraction tests: function now takes 1 arg (outputs only)
- Fix agentic routing tests: mock X2Text.process, remove stale platform_helper kwarg
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Fix missing llm_usage_reason for summarize LLM usage tracking
Add PSKeys.LLM_USAGE_REASON to usage_kwargs in _handle_summarize() so
summarization costs appear under summarize_llm in API response metadata.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* UN-3266 [FIX] Fix single-pass extraction routing in LegacyExecutor
- Route _handle_structure_pipeline to _handle_single_pass_extraction when
is_single_pass=True (was always calling _handle_answer_prompt)
- Delegate _handle_single_pass_extraction to cloud plugin via ExecutorRegistry,
falling back to _handle_answer_prompt if plugin not installed
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* Fixing API depployment response mismatches
* Fix single-pass extraction showing only one prompt result in real-time
- Fix accumulation bug in usePromptOutput updateCoverage() where each
loop iteration spread the original promptOutputs instead of the
accumulating updatedPromptOutputs, causing only the last prompt to
render
- Improve index success toast to show document name
- Strip adapter names from index key configs for consistent hashing
- Update sdk1 uv.lock
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* Move summarize from sync Django plugin to executor worker for IDE index
When "Summarize" is enabled and a user indexes a new document in Prompt
Studio, the backend returned a 500 because the sync Django plugin tried
to read the extracted .txt file before extraction happened in the worker.
Fix: defer summarization to the executor worker's _handle_ide_index
(extract → summarize → index), build summarize_params in the payload,
and track the summarize index in the ide_index_complete callback.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* Address PR #1849 review comments: null guards, thread safety
- Fix null guard ordering in build_index_payload: add DefaultProfileError
check before calling validators on default_profile
- Fix null guard ordering in _fetch_single_pass_response: move check
before .llm.id access and validators (was dead code after dereference)
- Add threading.Lock to worker_celery singleton to prevent race under
concurrent gunicorn threads
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* Add documentation to ExecutionResponse DTO describing result structure
Documents the ExecutionResponse dataclass fields, especially the
result attribute's per-file dict structure (output, metadata, metrics,
error keys) as requested in PR review.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* Fix PR review issues: IDOR, null guards, rollback, spinner, summarize, prompt lookup
- Strip result payload from task_status to prevent IDOR data leak
- Move null guard before validators in build_fetch_response_payload
- Roll back indexing flag on broker failure in index_document
- Use explicit IDs for spinner clearing instead of ORM serialization format
- Catch broad exceptions in summarize tracking to prevent false failures
- Guard prompt_id lookup in fetch_response with 400/404 responses
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Fix CI, tests, and add async prompt studio improvements
- Fix biome import ordering in frontend test files
- Fix 22 stale backend test assertions in test_tasks.py (patch targets,
return values, view dispatch pattern, remove TestCeleryConfig)
- Add ide_prompt_complete callback tests
- Add frontend vitest config and regression tests for null guards,
stale closures, and single-pass loading guard
- Add LLMCompat llama-index compatibility wrapper in SDK1
- Add litellm cohere embed timeout monkey-patch (v1.82.3)
- Improve S3 filesystem helper (region_name, empty credential handling)
- Add RetrieverLLM and lazy LLM creation for retrievers
- Improve worker cleanup: api_client.close() in finally blocks,
early return on setup failure in API deployment tasks
- Add workers conftest.py for test environment setup
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Fix pre-existing biome CI errors: import ordering and formatting
Auto-fix 18 pre-existing organizeImports and formatting errors across
17 frontend files that were blocking biome ci on the entire codebase.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* Fix ruff F821: add missing transaction import in prompt_studio_helper
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* Add input validation guards to bulk_fetch_response endpoint
Validate prompt_ids (non-empty), document_id (required), and handle
DoesNotExist for both prompts and document to return proper 400/404
instead of dispatching no-op tasks or raising unhandled 500 errors.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* IDE Call backs
* Sonar issues fix
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Fix ruff errors: restore summary_profile variable, suppress TC001 in dispatcher
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Update bun.lock to match package.json dependency ranges
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* Fix all biome lint warnings: empty blocks, missing braces, forEach returns, unused vars
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* Move ExecutionContext import into TYPE_CHECKING block
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Fix SonarQube issues: duplication, naming, nesting, unused var
- Extract _parse_json_body() helper and _ERR_INVALID_JSON constant to
deduplicate 5 identical JSON parsing blocks in internal_views.py
- Rename `User` local variable to `user_model` (naming convention)
- Merge _emit_result/_emit_error into unified _emit_event() in
ide_callback tasks to reduce code duplication
- Extract _get_task_error() helper to deduplicate AsyncResult error
retrieval in ide_index_error and ide_prompt_error
- Remove unused `mock_ar_cls` variable in test_ide_callback.py
- Add security note documenting why @csrf_exempt is safe on internal endpoints
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* Replace worker-ide-callback Dockerfile with worker-unified
The IDE callback worker should use the unified worker image
(worker-unified.Dockerfile) consistent with all other v2 workers.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* Add celery_executor_agentic queue to executor worker
The executor worker only consumed from celery_executor_legacy, but the
agentic prompt studio dispatches tasks to celery_executor_agentic. This
caused agentic operations to sit in RabbitMQ with no consumer, resulting
in timeouts and stuck-in-progress states.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* FIxing email enforce type
* Removing line-item from select choices
* Update workers/shared/enums/worker_enums_base.py
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
Signed-off-by: harini-venkataraman <115449948+harini-venkataraman@users.noreply.github.com>
* Update backend/workflow_manager/workflow_v2/workflow_helper.py
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
Signed-off-by: harini-venkataraman <115449948+harini-venkataraman@users.noreply.github.com>
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Fix false success logs and silent failures in ETL destination pipelines
- Widen except clause in structure_tool_task to catch FileOperationError
and log write paths for diagnostics
- Add diagnostic logging at all silent return-None points in destination
connector so missing INFILE/METADATA paths are visible in logs
- Raise RuntimeError instead of silently skipping when no tool execution
result is available for DB/FS destinations, preventing false success
- Remove dead retry config from execute_bin task (max_retries=0)
- Fix duplicate EXECUTOR/IDE_CALLBACK enum entries in WorkerType
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Revert ETL destination pipeline changes — deferring to next cut
Reverts diagnostic logging and error-raising changes in
structure_tool_task.py and destination_connector.py.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
---------
Signed-off-by: harini-venkataraman <115449948+harini-venkataraman@users.noreply.github.com>
Co-authored-by: Ghost Jake <89829542+Deepak-Kesavan@users.noreply.github.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-authored-by: Ritwik G <100672805+ritwik-g@users.noreply.github.com>
Co-authored-by: Kirtiman Mishra <110175055+kirtimanmishrazipstack@users.noreply.github.com>
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
* [MISC] Fix blank LLM profile edit form and settings menu bold style (#1896)
- Replace form.resetFields() with form.setFieldsValue() to fix blank
edit form caused by Ant Design's initialValues being a one-time snapshot
- Remove Strict Mode-incompatible cleanup that cleared editLlmProfileId
- Clear editLlmProfileId in parent when adding new profile
- Remove unconditional bold on first settings popover menu item
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* [FEAT] Port LINE_ITEM extraction to pluggable executor architecture
LINE_ITEM enforce_type prompts previously raised an unconditional error
in the new workers executor. Wire the structure-tool path to delegate to
a `line_item` executor plugin (mirroring how TABLE delegates to the
`table_extractor` plugin), so API deployments / ETL pipelines can run
LINE_ITEM extraction once the cloud `line_item_extractor` plugin is
installed.
- legacy_executor.py: replace the LINE_ITEM error site in
`_execute_single_prompt` with a delegation call and add a new
`_run_line_item_extraction()` method structurally identical to
`_run_table_extraction()`.
- test_line_item_extraction.py: 5 new tests covering plugin missing,
success, sub-context construction, failure path, and end-to-end
Celery eager-mode delegation.
- test_sanity_phase6d.py: update the existing LINE_ITEM guard test
to match the new "install the line_item_extractor plugin" hint
and patch `ExecutorRegistry.get` to simulate the missing plugin.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
---------
Signed-off-by: harini-venkataraman <115449948+harini-venkataraman@users.noreply.github.com>
Co-authored-by: Ghost Jake <89829542+Deepak-Kesavan@users.noreply.github.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-authored-by: Ritwik G <100672805+ritwik-g@users.noreply.github.com>
Co-authored-by: Kirtiman Mishra <110175055+kirtimanmishrazipstack@users.noreply.github.com>
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
Co-authored-by: Chandrasekharan M <117059509+chandrasekharan-zipstack@users.noreply.github.com>
* Guard against undefined connector type in PostHog event lookup
ConfigureDs called type.toUpperCase() unconditionally, which threw a
TypeError when type was undefined and broke the connector save flow.
Use optional chaining and only fire the PostHog event when the key
maps to a known connector.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* Add worker-executor-v2 service to docker-compose under workers-v2 profile
Defines a second executor worker container that runs the unified
worker image with WORKER_TYPE=executor on port 8092. Gated behind
the workers-v2 compose profile so it is opt-in and does not affect
default deployments.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* Feat/line item executor plugin (#1900)
* [FIX] Executor Queue for Agentic extraction (#1893)
* Execution backend - revamp
* async flow
* Streaming progress to FE
* Removing multi hop in Prompt studio ide and structure tool
* UN-3234 [FIX] Add beta tag to agentic prompt studio navigation item
* Added executors for agentic prompt studio
* Added executors for agentic prompt studio
* Removed redundant envs
* Removed redundant envs
* Removed redundant envs
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Removed redundant envs
* Removed redundant envs
* Removed redundant envs
* Removed redundant envs
* Removed redundant envs
* Removed redundant envs
* Removed redundant envs
* Removed redundant envs
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Removed redundant envs
* adding worker for callbacks
* adding worker for callbacks
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* adding worker for callbacks
* adding worker for callbacks
* adding worker for callbacks
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Pluggable apps and plugins to fit the new async prompt execution architecture
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Pluggable apps and plugins to fit the new async prompt execution architecture
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Pluggable apps and plugins to fit the new async prompt execution architecture
* adding worker for callbacks
* adding worker for callbacks
* adding worker for callbacks
* adding worker for callbacks
* adding worker for callbacks
* adding worker for callbacks
* adding worker for callbacks
* adding worker for callbacks
* fix: write output files in agentic extraction pipeline
Agentic extraction returned early without writing INFILE (JSON) or
METADATA.json, causing destination connectors to read the original PDF
and fail with "Expected tool output type: TXT, got: application/pdf".
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* UN-3266 fix: replace hardcoded /tmp paths with secure temp dirs in tests (#1850)
* UN-3266 fix: replace hardcoded /tmp paths with secure temp dirs in tests
Replace hardcoded /tmp/ paths (SonarCloud S5443 security hotspots) with
pytest's tmp_path fixture or module-level tempfile.mkdtemp() constants
in all affected test files to avoid world-writable directory vulnerabilities.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
---------
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Update docs
* UN-3266 fix: remove dead code with undefined names in fetch_response
Remove unreachable code block after the async callback return in
fetch_response that still referenced output_count_before and response
from the old synchronous implementation, causing ruff F821 errors.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* Un 3266 fix security hotspot tmp paths (#1851)
* UN-3266 fix: replace hardcoded /tmp paths with secure temp dirs in tests
Replace hardcoded /tmp/ paths (SonarCloud S5443 security hotspots) with
pytest's tmp_path fixture or module-level tempfile.mkdtemp() constants
in all affected test files to avoid world-writable directory vulnerabilities.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* UN-3266 fix: resolve ruff linting failures across multiple files
- B026: pass url positionally in worker_celery.py to avoid star-arg after keyword
- N803: rename MockAsyncResult to mock_async_result in test_tasks.py
- E501/I001: fix long line and import sort in llm_whisperer helper
- ANN401: replace Any with object|None in dispatcher.py; add noqa in test helpers
- F841: remove unused workflow_id and result assignments
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
---------
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
* UN-3266 fix: resolve SonarCloud bugs S2259 and S1244 in PR #1849
- S2259: guard against None after _discover_plugins() in loader.py
to satisfy static analysis on the dict[str,type]|None field type
- S1244: replace float equality checks with pytest.approx() in
test_answer_prompt.py and test_phase2h.py
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* UN-3266 fix: resolve SonarCloud code smells in PR #1849
- S5799: Merge all implicit string concatenations in log messages
(legacy_executor.py, tasks.py, dispatcher.py, orchestrator.py,
registry.py, variable_replacement.py, structure_tool_task.py)
- S1192: Extract duplicate literal to _NO_CELERY_APP_MSG constant in
dispatcher.py
- S1871: Merge identical elif/else branches in tasks.py and
test_sanity_phase6j.py
- S1186: Add comment to empty stub method in test_sanity_phase6a.py
- S1481: Remove unused local variables in test_sanity_phase6d/e/f/g/h/j
and test_phase5d.py
- S117: Rename PascalCase local variables to snake_case in
test_sanity_phase3/5/6i.py
- S5655: Broaden tool type annotation to StreamMixin in
IndexingUtils.generate_index_key and PlatformHelper.get_adapter_config
- docker:S7031: Merge consecutive RUN instructions in
worker-unified.Dockerfile
- javascript:S1128: Remove unused pollForCompletion import in
usePromptRun.js
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* UN-3266 fix: wrap long log message in dispatcher.py to fix E501
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* UN-3266 fix: resolve remaining SonarCloud S117 naming violations
Rename PascalCase local variables to snake_case to comply with S117:
- legacy_executor.py: rename tuple-unpacked _get_prompt_deps() results
(AnswerPromptService→answer_prompt_svc, RetrievalService→retrieval_svc,
VariableReplacementService→variable_replacement_svc, LLM→llm_cls,
EmbeddingCompat→embedding_compat_cls, VectorDB→vector_db_cls) and
update all downstream usages including _apply_type_conversion and
_handle_summarize
- test_phase1_log_streaming.py: rename Mock* local variables to
mock_* snake_case equivalents
- test_sanity_phase3.py: rename MockDispatcher→mock_dispatcher_cls
and MockShim→mock_shim_cls across all 10 test methods
- test_sanity_phase5.py: rename MockShim→mock_shim, MockX2Text→mock_x2text
in 6 test methods; MockDispatcher→mock_dispatcher_cls in dispatch test;
fix LLM_cls→llm_cls, EmbeddingCompat→embedding_compat_cls,
VectorDB→vector_db_cls in _mock_prompt_deps helper
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* UN-3266 fix: resolve remaining SonarCloud code smells in PR #1849
- test_sanity_phase2/4.py, test_answer_prompt.py: rename PascalCase
local variables in _mock_prompt_deps/_mock_deps to snake_case
(RetrievalService→retrieval_svc, VariableReplacementService→
variable_replacement_svc, Index→index_cls, LLM_cls→llm_cls,
EmbeddingCompat→embedding_compat_cls, VectorDB→vector_db_cls,
AnswerPromptService→answer_prompt_svc_cls) — fixes S117
- test_sanity_phase3.py: remove unused local variable "result" — fixes S1481
- structure_tool_task.py: remove redundant json.JSONDecodeError from
except clause (subclass of ValueError) — fixes S5713
- shared/workflow/execution/service.py: replace generic Exception with
RuntimeError for structure tool failure — fixes S112
- run-worker-docker.sh: define EXECUTOR_WORKER_TYPE constant and
replace 10 literal "executor" occurrences — fixes S1192
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* UN-3266 fix: resolve SonarCloud cognitive complexity and code smell violations
- Reduce cognitive complexity in answer_prompt.py:
- Extract _build_grammar_notes, _run_webhook_postprocess helpers
- _is_safe_public_url: extracted _resolve_host_addresses helper
- handle_json: early-return pattern eliminates nesting
- construct_prompt: delegates grammar loop to _build_grammar_notes
- Reduce cognitive complexity in legacy_executor.py:
- Extract _execute_single_prompt, _run_table_extraction helpers
- Extract _run_challenge_if_enabled, _run_evaluation_if_enabled
- Extract _inject_table_settings, _finalize_pipeline_result
- Extract _convert_number_answer, _convert_scalar_answer
- Extract _sanitize_dict_values helper
- _handle_answer_prompt CC reduced from 50 to ~7
- Reduce CC in structure_tool_task.py: guard-clause refactor
- Reduce CC in backend: dto.py, deployment_helper.py,
api_deployment_views.py, prompt_studio_helper.py
- Fix S117: rename PascalCase local vars in test_answer_prompt.py
- Fix S1192: extract EXECUTOR_WORKER_TYPE constant in run-worker.sh
- Fix S1172: remove unused params from structure_tool_task.py
- Fix S5713: remove redundant JSONDecodeError in json_repair_helper.py
- Fix S112/S5727 in test_execution.py
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* UN-3266 fix: remove unused RetrievalStrategy import from _handle_answer_prompt
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* UN-3266 fix: rename UsageHelper params to lowercase (N803)
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* UN-3266 fix: resolve remaining SonarCloud issues from check run 66691002192
- Add @staticmethod to _sanitize_null_values (fixes S2325 missing self)
- Reduce _execute_single_prompt params from 25 to 11 (S107)
by grouping services as deps tuple and extracting exec params
from context.executor_params
- Add NOSONAR suppression for raise exc in test helper (S112)
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* UN-3266 fix: remove unused locals in _handle_answer_prompt (F841)
execution_id, file_hash, log_events_id, custom_data are now extracted
inside _execute_single_prompt from context.executor_params.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* fix: resolve Biome linting errors in frontend source files
Auto-fixed 48 lint errors across 56 files: import ordering, block
statements, unused variable prefixing, and formatting issues.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* fix: replace dynamic import of SharePermission with static import in Workflows
Resolves vite build warning about SharePermission.jsx being both
dynamically and statically imported across the codebase.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* fix: resolve SonarCloud warnings in frontend components
- Remove unnecessary try-catch around PostHog event calls
- Flip negated condition in PromptOutput.handleTable for clarity
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Address PR #1849 review comments: fix null guards, dead code, and test drift
- Remove redundant inline `import uuid as _uuid` in views.py (use module-level uuid)
- URL-encode DB_USER in worker_celery.py result backend connection string
- Remove misleading task_queues=[Queue("executor")] from dispatch-only Celery app
- Remove dead `if not tool:` guards after objects.get() (already raises DoesNotExist)
- Move profile_manager/default_profile null checks before first dereference
- Reorder ProfileManager.objects.get before mark_document_indexed in tasks.py
- Handle ProfileManager.DoesNotExist as warning, not hard failure
- Wrap PostHog analytics in try/catch so failures don't block prompt execution
- Handle pending-indexing 200 response in usePromptRun.js (clear RUNNING status)
- Reset formData when metadata is missing in ConfigureDs.jsx
- Fix test_should_skip_extraction tests: function now takes 1 arg (outputs only)
- Fix agentic routing tests: mock X2Text.process, remove stale platform_helper kwarg
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Fix missing llm_usage_reason for summarize LLM usage tracking
Add PSKeys.LLM_USAGE_REASON to usage_kwargs in _handle_summarize() so
summarization costs appear under summarize_llm in API response metadata.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* UN-3266 [FIX] Fix single-pass extraction routing in LegacyExecutor
- Route _handle_structure_pipeline to _handle_single_pass_extraction when
is_single_pass=True (was always calling _handle_answer_prompt)
- Delegate _handle_single_pass_extraction to cloud plugin via ExecutorRegistry,
falling back to _handle_answer_prompt if plugin not installed
Co-Authored-By: Claude Opus 4.6 <norep…



What
Why
form.resetFields()resets to theinitialValuessnapshot captured at first render. Since adapter data loads asynchronously,initialValuesis always{}(empty), causing the edit form to appear blank. This is especially visible under React Strict Mode (local dev) where effects run twice.font-weight: 600on:first-child, which looked incorrect when hovering over submenu items.How
form.resetFields()withform.setFieldsValue(formDetails)to explicitly push current values into the form regardless of wheninitialValueswas capturededitLlmProfileIdduring the mount-unmount-remount cycleeditLlmProfileIdin the parent's "Add New" handler to prevent stale edit IDs from leaking into the add flowfont-weight: 600from.settings-menu-item:first-childCan 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)
setFieldsValuechange is a direct replacement that explicitly sets the same values thatresetFieldswas intended to restore. All other edit forms in the codebase already use this pattern (MenuLayout,PlatformApiKeys,Header). The CSS change only removes an unintended bold style.Database Migrations
Env Config
Relevant Docs
Related Issues or PRs
Dependencies Versions
Notes on Testing
Screenshots
Checklist
I have read and understood the Contribution Guidelines.