fix: preserve response-mode session scoping without Langfuse#4016
Open
shaun0927 wants to merge 2 commits intocamel-ai:masterfrom
Open
fix: preserve response-mode session scoping without Langfuse#4016shaun0927 wants to merge 2 commits intocamel-ai:masterfrom
shaun0927 wants to merge 2 commits intocamel-ai:masterfrom
Conversation
Response-mode backends were reusing the shared "__default__" chain key whenever Langfuse was disabled, even though ChatAgent already records an agent session id. This keeps the context-local session id available for backend scoping regardless of tracing configuration and adds focused regression tests for both OpenAIModel and OpenAICompatibleModel. Constraint: Must not change external response API behavior beyond session scoping Rejected: Keep gating session lookup on Langfuse availability | causes cross-agent chain reuse in normal deployments Confidence: high Scope-risk: narrow Reversibility: clean Directive: Session scoping for model backends should not depend on observability providers Tested: pytest -q test/models/test_openai_model.py test/models/test_openai_compatible_model.py -k 'responses_mode_uses_agent_session_scope_when_langfuse_is_disabled or openai_compatible_responses_uses_agent_session_scope_when_langfuse_is_disabled' Not-tested: Full OpenAI/OpenAI-compatible model suites without API credential fixtures
Contributor
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 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 |
Constraint: Keep the original fix unchanged while making the branch pass repository formatting rules Rejected: Leave pre-commit failure for maintainers to fix | blocks review on a formatting-only issue Confidence: high Scope-risk: narrow Reversibility: clean Directive: New regression tests should stay within the repo's line-length/style constraints to avoid noisy CI failures Tested: ruff check camel/utils/langfuse.py test/models/test_openai_model.py test/models/test_openai_compatible_model.py; pytest -q test/models/test_openai_model.py test/models/test_openai_compatible_model.py -k 'responses_mode_uses_agent_session_scope_when_langfuse_is_disabled or openai_compatible_responses_use_agent_session_scope_without_langfuse' Not-tested: Full model test suites with CI secrets
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Related Issue
Fixes #4012
Description
Response-mode chaining currently reuses the shared
"__default__"key whenever Langfuse is disabled, even thoughChatAgentalready sets an agent session id.This change keeps the context-local agent session id available regardless of tracing configuration so response chaining remains scoped per agent session.
Changes:
camel.utils.langfuse.get_current_agent_session_id()without gating it on Langfuse enablementOpenAIModelOpenAICompatibleModelWhat is the purpose of this pull request?
Checklist
pyproject.tomland runuv lockTest evidence
pytest -q test/models/test_openai_model.py test/models/test_openai_compatible_model.py -k 'responses_mode_uses_agent_session_scope_when_langfuse_is_disabled or openai_compatible_responses_uses_agent_session_scope_when_langfuse_is_disabled'Passed locally:
2 passed, 38 deselected