Repository navigation
Saved conversations follow the agent's answer settings in the API - #7
Merged
Merged
Conversation
Replay (GET /v1/agents/{id}/sessions/{sid} and .../messages) now leaves out the SQL and
the rows that show_sql_query / show_db_result hide -- debug_info.sql_query,
debug_info.db_output and the column-labelled result block -- exactly as the live answer
does. GET /v1/sessions/{sid}/export returns 403 for an agent that hides rows.
get_session_data requires both settings, so no caller can serve saved turns without them.
Previously only the MCP adapter applied the settings; a direct API caller with the same
key could read hidden SQL and rows. tests/backend/test_session_scope.py covers each route
with a visible and a hidden synthetic agent, plus a call-site gate.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…d on another agent Brings in the design accepted for the hosted codebase after independent review. The PR 6 check refused every session_id the API had not created itself, which breaks a chat service that sends its own thread id as session_id. Isolation now lives in the reads: - Chat history and saved replay read only the requesting agent's turns, so a shared or foreign session id can never put another agent's questions, answers, SQL or rows into this agent's context or replay. - A session this API created for another agent is still refused (404) before history or a model call; an id the API never created continues with this agent's turns only. - CSV export with an agent key finds only that agent's turns. - tests/backend/test_session_storage.py runs the product's queries on real PostgreSQL in a new session-storage CI job, including a thread id shared by two agents. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
add_user_feedback matched a turn by session_id and chat_id alone, so a key for one agent could overwrite another agent's stored verdict and, with a corrected SQL, its sql_query, which replay and export then serve. It now also matches the agent. Real-PostgreSQL test added. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Matches the hosted codebase: each run creates and drops its own schema, so an older shape of these tables left in a shared CI database cannot be kept by create_all. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
What changes
Same design as the hosted codebase, applied after independent review.
Session isolation (revises PR 6):
session_idthe API never created continues with this agent's turns only. A chat service that sends its own thread id keeps working.Visibility at the API: replay applies
show_sql_query/show_db_resultas the live answer does. It leaves outdebug_info.sql_query,debug_info.db_outputand the column-labelledresultblock. CSV export returns 403 for an agent that hides rows.get_session_datarequiresagent_idand both flags.Tests
tests/backend/test_session_scope.py(14 tests, offline).tests/backend/test_session_storage.py(6 tests). It runs the product's queries on real PostgreSQL in a newsession-storageCI job, including a thread id shared by two agents.Local runs:
test_session_scope,test_selection_policy,tests/deployment(receipt updated) andtests/mcp: OK.test_session_storage: 6/6 on a throwaway PostgreSQL.🤖 Generated with Claude Code