Conversation
There was a problem hiding this comment.
5 issues found across 64 files
Prompt for AI agents (all issues)
Check if these issues are valid — if so, understand the root cause of each and fix them.
<file name="backend/onyx/tools/tool_implementations/file_reader/file_reader_tool.py">
<violation number="1" location="backend/onyx/tools/tool_implementations/file_reader/file_reader_tool.py:150">
P2: Validate start_char/num_chars and raise a ToolCallException on invalid numeric input instead of letting int() raise ValueError/TypeError.</violation>
</file>
<file name="backend/onyx/chat/llm_loop.py">
<violation number="1" location="backend/onyx/chat/llm_loop.py:221">
P1: The token budget calculation (lines 164-165 in original file) subtracts `project_files.total_token_count`, which presumably accounts for full file texts. When this fallback branch is taken to use `file_metadata_for_tool`, the actual message size may differ significantly from `total_token_count`.
1. If `total_token_count` is 0 (metadata-only mode), the budget is not reduced, risking context overflow when the metadata message is added.
2. If `total_token_count` includes full texts, the budget is over-reduced, causing unnecessary history truncation.
The budget calculation should be conditional on which project message type is actually used.</violation>
</file>
<file name="backend/tests/integration/tests/no_vectordb/conftest.py">
<violation number="1" location="backend/tests/integration/tests/no_vectordb/conftest.py:20">
P2: Add a timeout to the `requests.get` call so test collection doesn't hang indefinitely when the server is slow or unreachable.</violation>
</file>
<file name="backend/tests/integration/tests/no_vectordb/test_no_vectordb_chat.py">
<violation number="1" location="backend/tests/integration/tests/no_vectordb/test_no_vectordb_chat.py:125">
P2: The wait loop can exit without confirming the file was processed, so the test can proceed in a bad state and fail later. Add an explicit timeout assertion after the loop (or a flag) to fail fast when the file never becomes available.</violation>
</file>
<file name="backend/tests/unit/onyx/document_index/test_disabled_document_index.py">
<violation number="1" location="backend/tests/unit/onyx/document_index/test_disabled_document_index.py:68">
P1: Rule violated: **Use Pydantic over dataclasses**
Use Pydantic BaseModel for data modeling instead of Python dataclasses in new code (rule: Use Pydantic over dataclasses).</violation>
</file>
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
| from dataclasses import dataclass, field | ||
|
|
||
| # We only need a stub — the method raises before inspecting arguments. | ||
| @dataclass |
There was a problem hiding this comment.
P1: Rule violated: Use Pydantic over dataclasses
Use Pydantic BaseModel for data modeling instead of Python dataclasses in new code (rule: Use Pydantic over dataclasses).
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At backend/tests/unit/onyx/document_index/test_disabled_document_index.py, line 68:
<comment>Use Pydantic BaseModel for data modeling instead of Python dataclasses in new code (rule: Use Pydantic over dataclasses).</comment>
<file context>
@@ -0,0 +1,191 @@
+ from dataclasses import dataclass, field
+
+ # We only need a stub — the method raises before inspecting arguments.
+ @dataclass
+ class _StubBatchParams:
+ doc_id_to_previous_chunk_cnt: dict[str, int] = field(default_factory=dict)
</file context>
|
|
||
| raw_file_id = cast(str, llm_kwargs[FILE_ID_FIELD]) | ||
| file_id = self._validate_file_id(raw_file_id) | ||
| start_char = max(0, int(llm_kwargs.get(START_CHAR_FIELD, 0))) |
There was a problem hiding this comment.
P2: Validate start_char/num_chars and raise a ToolCallException on invalid numeric input instead of letting int() raise ValueError/TypeError.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At backend/onyx/tools/tool_implementations/file_reader/file_reader_tool.py, line 150:
<comment>Validate start_char/num_chars and raise a ToolCallException on invalid numeric input instead of letting int() raise ValueError/TypeError.</comment>
<file context>
@@ -0,0 +1,196 @@
+
+ raw_file_id = cast(str, llm_kwargs[FILE_ID_FIELD])
+ file_id = self._validate_file_id(raw_file_id)
+ start_char = max(0, int(llm_kwargs.get(START_CHAR_FIELD, 0)))
+ num_chars = min(
+ MAX_NUM_CHARS,
</file context>
| def _server_has_vector_db_disabled() -> bool: | ||
| """Query the running server to check whether DISABLE_VECTOR_DB is set.""" | ||
| try: | ||
| resp = requests.get( |
There was a problem hiding this comment.
P2: Add a timeout to the requests.get call so test collection doesn't hang indefinitely when the server is slow or unreachable.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At backend/tests/integration/tests/no_vectordb/conftest.py, line 20:
<comment>Add a timeout to the `requests.get` call so test collection doesn't hang indefinitely when the server is slow or unreachable.</comment>
<file context>
@@ -0,0 +1,42 @@
+def _server_has_vector_db_disabled() -> bool:
+ """Query the running server to check whether DISABLE_VECTOR_DB is set."""
+ try:
+ resp = requests.get(
+ f"{API_SERVER_URL}/settings",
+ headers=GENERAL_HEADERS,
</file context>
Greptile OverviewGreptile SummaryThis PR introduces a “no vector DB” deployment mode controlled by To preserve basic chat + project workflows without Vespa/OpenSearch, it adds a Confidence Score: 3/5
Important Files Changed
Sequence DiagramsequenceDiagram
participant User
participant API as API Server
participant Settings as /settings
participant Chat as Chat handler
participant Tools as construct_tools
participant FR as FileReaderTool
participant Store as FileStore
User->>API: GET /settings
API->>Settings: fetch_settings()
Settings-->>API: vector_db_enabled = !DISABLE_VECTOR_DB
API-->>User: settings JSON
User->>API: POST /chat/... message
API->>Chat: handle_stream_message_objects()
Chat->>Chat: collect available_file_ids (chat files + project files + persona user_files)
Chat->>Tools: construct_tools(file_reader_tool_config)
Tools-->>Chat: tools include FileReaderTool with allowed IDs
Chat->>API: run_llm_loop(...)
Note over User,FR: In no-vector-DB mode, LLM reads file sections on demand
User->>FR: tool call read_file(file_id, start_char, num_chars)
FR->>Store: load_user_file(file_id)
Store-->>FR: plaintext bytes (if available)
FR-->>User: section text response
|
|
|
||
| def _create_file_tool_metadata_message( | ||
| file_metadata: list[FileToolMetadata], | ||
| token_counter: Callable[[str], int], | ||
| ) -> ChatMessageSimple: | ||
| """Build a lightweight metadata-only message listing files available via FileReaderTool. | ||
|
|
||
| Used when files are too large to fit in context and the vector DB is | ||
| disabled, so the LLM must use ``read_file`` to inspect them. | ||
| """ | ||
| lines = [ | ||
| "You have access to the following files. Use the read_file tool to " | ||
| "read sections of any file:" | ||
| ] | ||
| for meta in file_metadata: | ||
| lines.append( | ||
| f'- {meta.file_id}: "{meta.filename}" (~{meta.approx_char_count:,} chars)' | ||
| ) | ||
|
|
||
| message_content = "\n".join(lines) | ||
| return ChatMessageSimple( | ||
| message=message_content, | ||
| token_count=token_counter(message_content), | ||
| message_type=MessageType.USER, | ||
| ) |
There was a problem hiding this comment.
Wrong message role
_create_file_tool_metadata_message() returns a ChatMessageSimple with message_type=MessageType.USER. This injects synthetic metadata as a user message, which will be treated as user instruction/history rather than context (and can affect downstream logic that counts/filters user messages). This should be MessageType.SYSTEM (or whatever role you use for non-user context injections) to avoid contaminating conversation history.
Additional Comments (1)
|
ce9c51c to
edd4bc4
Compare
edd4bc4 to
7fd8ded
Compare
|
Preview Deployment
|
Description
Minimal version of Onyx. This deployment is primarily a chat frontend, with the ability to set up assistants that have access to manually uploaded files, but no connectors. This deployment method uses the following containers:
Notably, this does not include
launch a minimal onyx stack via docker-compose using
docker compose -f docker-compose.yml -f docker-compose.no-vectordb.yml -p $1 up -d --build
for helm you need to values a values override file with:
How Has This Been Tested?
tested in UI and added some unit tests for basic chat behavior in the presence of file reader tool
Additional Options
Summary by cubic
Adds a minimal deployment mode to run Onyx without a vector database. Core chat works and can read large files via a new File Reader tool; connectors and RAG search are disabled and related endpoints return 501.
New Features
Migration
Written for commit 527afa2. Summary will update on new commits.