-
Notifications
You must be signed in to change notification settings - Fork 1.9k
fix: small DR/Thoughtful mode fixes #5269
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
The latest updates on your projects. Learn more about Vercel for GitHub.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Greptile Summary
This PR implements several targeted fixes for the DR (Deep Research) / Thoughtful mode system, addressing three main categories of issues:
Budget calculation fixes: The orchestrator now correctly uses next_tool_name
instead of next_tool
when accessing the available_tools
dictionary for cost calculations. This prevents KeyError exceptions that would occur when the system attempts to subtract tool costs from the remaining time budget.
Tool display improvements: The generic internal tool sub-agent now uses display_name
and llm_name
properties instead of internal path names, ensuring users see meaningful tool names in the interface. Additionally, CustomToolStart and CustomToolDelta events now explicitly set their 'type' fields, which is required for proper Pydantic discriminated union processing in the streaming event system.
Okta-specific handling: A new specialized prompt template OKTA_TOOL_USE_SPECIAL_PROMPT
has been added specifically for Okta Profile tools, which formats raw Okta responses into readable output before providing answers. The generic tool prompt has also been streamlined by removing redundant instructions about explaining tool functions.
Code cleanup: Unused variable assignments have been removed from the orchestrator, eliminating dead code while preserving necessary dictionary access for validation purposes.
These changes integrate with the existing DR system architecture by maintaining the same event-driven flow while fixing critical runtime issues and improving user experience through better tool identification and specialized response formatting.
Confidence score: 4/5
- This PR addresses specific runtime bugs and improves user experience with minimal risk to existing functionality
- Score reflects targeted fixes to well-defined issues with clear implementation approaches
- Pay close attention to the orchestrator budget calculation logic to ensure the variable name fixes don't introduce edge cases
4 files reviewed, no comments
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
1 issue found across 4 files
React with 👍 or 👎 to teach cubic. You can also tag @cubic-dev-ai
to give feedback, ask questions, or re-run the review.
specific task query using the tool response. | ||
If the tool definition and response did not provide information relevant to the specific context mentioned \ | ||
in the query, start out with a short statement highlighting this (e.g., I was not able to find information \ | ||
If the tool definition and response did not provide information relevant to the specific task query mentioned \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Comma is incorrectly placed on the next line, causing malformed "mentioned , start" output; add the comma at the end of the previous line before the continuation
Prompt for AI agents
Address the following comment on backend/onyx/prompts/dr_prompts.py at line 902:
<comment>Comma is incorrectly placed on the next line, causing malformed "mentioned , start" output; add the comma at the end of the previous line before the continuation</comment>
<file context>
@@ -863,10 +897,10 @@
- while the base question is important, really focus on answering the specific task query. \
That is your task.
-Please respond with a short sentence explaining what the tool does and provide a concise answer to the \
+Please respond with a concise answer to the \
specific task query using the tool response.
-If the tool definition and response did not provide information relevant to the specific context mentioned \
-in the query, start out with a short statement highlighting this (e.g., I was not able to find information \
+If the tool definition and response did not provide information relevant to the specific task query mentioned \
</file context>
backend/onyx/agents/agent_search/dr/nodes/dr_a1_orchestrator.py
Outdated
Show resolved
Hide resolved
...agents/agent_search/dr/sub_agents/generic_internal_tool/dr_generic_internal_tool_3_reduce.py
Outdated
Show resolved
Hide resolved
...agents/agent_search/dr/sub_agents/generic_internal_tool/dr_generic_internal_tool_3_reduce.py
Outdated
Show resolved
Hide resolved
reasoning="", | ||
additional_data=None, | ||
response_type="string", | ||
response_type="text", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should be Enum?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It should. But this comes from the definition of CustomToolDelta etc. : response_type: str
Should be an enum there. Added a todo at a couple of spots.
* fix budget calculation * Internal custom tool fix + Okta special casing * nits * CW comments
Description
A number of smaller fixes addressing observed issues:
Linear ticket: https://linear.app/danswer/issue/DAN-2337/drthoughtful-mode-fixes-with-okta
How Has This Been Tested?
Locally, using various question examples
Backporting (check the box to trigger backport action)
Note: You have to check that the action passes, otherwise resolve the conflicts manually and tag the patches.
Summary by cubic
Fixes DR/Thoughtful mode budget handling, improves internal tool labeling, and adds Okta-specific answer formatting for more accurate, readable outputs. Addresses Linear DAN-2337.