fix(goal): make cancellation a user-only control (#6667)
This commit is contained in:
1 parent
c927808aff
commit
12a86eaa86
33 files changed
+641
-63
No files matched your search
@@ -528,3 +528,24 @@ async def test_goal_assembly_preserves_builtin_plugin_precedence(tmp_path, monke
|
||||
assert isinstance(loop.tools.get("create_goal"), CreateGoalTool)
|
||||
finally:
|
||||
await loop.aclose()
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.parametrize("status", ["active", "blocked"])
|
||||
async def test_agent_cannot_cancel_a_goal(tmp_path, status):
|
||||
sm = SessionManager(tmp_path)
|
||||
create, update, ctx = _tools(sm)
|
||||
try:
|
||||
await _execute(create, ctx, objective="Finish the task")
|
||||
if status == "blocked":
|
||||
await _execute(update, ctx, action="block", recap="Waiting for access")
|
||||
before = (await sm.state.read_header("websocket:c1")).metadata[GOAL_STATE_KEY]
|
||||
result = await _execute(update, ctx, action="cancel", recap="Cancelled by agent")
|
||||
assert result.is_error
|
||||
assert "complete, block, or replace" in result
|
||||
assert (await sm.state.read_header("websocket:c1")).metadata[GOAL_STATE_KEY] == before
|
||||
guidance = await create.runtime_context_provider()(_request_context(metadata={}))
|
||||
assert guidance is not None and "/cancel_goal" in guidance.content
|
||||
assert f"Goal ({status}):\nFinish the task" in guidance.content
|
||||
finally:
|
||||
await sm.state.aclose()
|
||||
Reference in new issue
Block a user