Repository navigation
feat(agent-session): refuse a command whose session_id is not the session of now - #827
Open
hongquanli wants to merge 4 commits into
Open
hongquanli wants to merge 4 commits into
hongquanli wants to merge 4 commits into
Conversation
… not the session of now A client of the control server can put the identifier of its agent session next to command and params. Squid then serves the request only when that session is the session of now. The check is in the same locked block as the change: for an action command at its admission, and for take over, hand back and end in the call that changes the session. A hand back carries the identifier to the window, so the input shield and the panel lock are not touched for a refused request. A begin with an identifier is refused. A read is served with any identifier. A request with no identifier works as before. This is for a program that reads the session state at intervals: between two reads, a human can end its session and a different program can begin one. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0152Tv36aY3Whyz7ATrKcZX3
…mports Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0152Tv36aY3Whyz7ATrKcZX3
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the
|
…long limit The test of a hand back with the wrong session id waited 2 s for the answer of a server thread and did not join the thread when the wait ran out. It now waits up to 10 s for the end of the thread, and the thread is a daemon, so a thread that a failed test leaves behind does not keep the tests from ending. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0152Tv36aY3Whyz7ATrKcZX3
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 this does
A client of the control server can put the identifier of its agent session next to
commandandparams:{"command": "move_to", "params": {"x_mm": 20.0}, "session_id": "5f0c..."}Squid then serves the request only when that session is the session of now. If the session ended, and also if a different session began after it, the answer is the error
this is not the agent session of now, and nothing changes.Why
A program that drives the microscope reads the session state at intervals. Between two reads, a human can end its session, and a different program can begin one. Without the identifier, the next command of the first program goes to the session of the second program.
Behaviour that does not change
A request with no
session_idworks as before. No client must change.How it works
control/core/agent_session.py). The check is in the same locked block as the change:admit);request_stop,end);hand_back)._executegets thesession_idof the request. The handlers of the session commands read it from a context variable, so their signatures and their schemas stay as they are.pingand theget_*commands are served with any identifier: they change nothing.begin_agent_sessionwith an identifier is refused: a session that begins has no identifier yet.send_command()has an optionalsession_id.docs/agent-session.mdhas a new part, "A command for one session:session_id".Tests
tests/control/test_HighContentScreeningGui.py, whole, in one process: 59 passed.Order
This pull request is on top of #823, and its base is the branch of #823. Merge #823 first.
🤖 Generated with Claude Code
https://claude.ai/code/session_0152Tv36aY3Whyz7ATrKcZX3