Conversation
|
✅ Verified — session-key scoping on stored Responses API records Reviewed the diff for
The fix is correct and complete. No issues found. |
93be75c to
33810fb
Compare
Rebased this PR onto current `origin/main` and reran the focused Responses API / ResponseStore coverage.
Validation:
```text
python -m pytest tests/gateway/test_api_server.py -k "ResponseStore or responses" -q --timeout-method=thread
36 passed, 1 skipped |
teknium1
left a comment
There was a problem hiding this comment.
Thanks for addressing a real cross-client isolation gap. Current main still stores Responses records without an owner key at gateway/platforms/api_server.py:3511-3516, retrieves/deletes them by ID alone at :3531-3559, and follows previous_response_id without a key comparison at :3325-3333.
Problems
- The patch also changes
/v1/runsresponse chaining, but the added tests do not cover that endpoint. Current main acceptsprevious_response_idatgateway/platforms/api_server.py:4243and loads it fromResponseStoreat:4266-4272; add a cross-key regression case to preserve the intended isolation guarantee.
Suggested changes
- When salvaging onto current main, relocate the persistence changes to both current storage paths: streamed
_persist_response_snapshot()atgateway/platforms/api_server.py:2750-2767and non-streaming storage at:3509-3520, then re-check GET/DELETE and Runs against their current locations.
Automated hermes-sweeper review.
| @@ -3599,6 +3599,95 @@ async def test_responses_endpoint_accepts_session_key(self, auth_adapter): | |||
| call_kwargs = mock_run.call_args.kwargs | |||
There was a problem hiding this comment.
Please add the analogous cross-key regression for /v1/runs with previous_response_id: this PR changes that handler too, but this test only covers /v1/responses retrieval, deletion, and chaining.
33810fb to
d1f1870
Compare
d1f1870 to
aed7e9f
Compare
|
Updated the branch again to fix the failing CI slice after rebasing onto current main. The failure was unrelated to the session-key change: two newly added model probe tests were still mocking Validation:
|
|
Rebase-on-behalf delivery — this PR's branch was rebased onto current main ( Rebased branch: Conflict resolution (3 hunks):
To adopt (author): git fetch https://github.com/andrexibiza/hermes-agent.git rebase-on-behalf/41209
git checkout fix/responses-session-key-scope
git reset --hard FETCH_HEAD
git push --force-with-lease origin fix/responses-session-key-scopepy_compile verified on the rebased tree. This unblocks the api_server R4 extraction window (hunk gate). |
Summary
Stored Responses API records now remember the
X-Hermes-Session-Keythat created them, and response chaining, retrieval, and deletion only succeed for the same session key. Legacy stored records without an owner key remain readable for backward compatibility.The fix also prevents globally named
conversationmappings from forcing a different session key into another caller's stored response chain; inaccessible mappings are treated as a fresh conversation.Why
POST /v1/responsesalready acceptsX-Hermes-Session-Keyfor long-term memory scoping, but stored response lookup was keyed only by response id. In authenticated multi-client API server deployments, a caller with another response id could useprevious_response_id,GET /v1/responses/{id}, orDELETE /v1/responses/{id}without a same-key ownership check.How This Fixes It
gateway_session_keyalongside each persisted Responses API record.X-Hermes-Session-Key.previous_response_idchaining, namedconversationlookup,GET /v1/responses/{response_id}, andDELETE /v1/responses/{response_id}.Tests
Note: the full file currently exposes an unrelated pre-existing
TestResponseStore.test_access_refreshes_lrufailure on this checkout because LRU timestamps can tie inside the same second.