fix: improve cross-device evidence and exploration lifecycle
Align Responses cache affinity across execution and summary calls, preserve required checks and evidence uncertainty, and allow safe deletion of inactive explorations while retaining independent reruns. Validation: backend suite passed except intentional prompt golden drift, then all 17 transcript tests passed after snapshot refresh; 268 frontend tests and production build passed; Ruff, quality ratchet and core type checks passed.
This commit is contained in:
1 parent
f1bb5d02aa
commit
2328a4df0c
32 files changed
+748
-79
No files matched your search
@@ -355,3 +355,46 @@ async def test_cache_key_is_stable_for_exploration_but_separates_roles(
|
||||
assert payloads[1]["prompt_cache_key"] != payloads[2]["prompt_cache_key"]
|
||||
assert "exploration-1" not in payloads[0]["prompt_cache_key"]
|
||||
assert payloads[1]["input"][:1] == payloads[0]["input"]
|
||||
for request, payload in zip(requests, payloads):
|
||||
assert request.headers["thread-id"] == payload["prompt_cache_key"]
|
||||
assert request.headers["session-id"] == payload["prompt_cache_key"]
|
||||
assert request.headers["x-client-request-id"]
|
||||
assert "extra_headers" not in payload
|
||||
assert requests[0].headers["x-client-request-id"] != requests[1].headers["x-client-request-id"]
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_auxiliary_summary_calls_send_role_scoped_affinity_on_responses(transport_model):
|
||||
from types import SimpleNamespace
|
||||
|
||||
from artemis.agents.flash.summarizer import VisualStepSummarizer
|
||||
from artemis.memory.chunking import StepCapsuleLens
|
||||
|
||||
model, requests, outputs = transport_model
|
||||
outputs.extend(
|
||||
[text_output("我看到页面显示当前设置,尚未确认其他状态变化。") for _ in range(4)]
|
||||
)
|
||||
ctx = SimpleNamespace(data_engine=SimpleNamespace(current_session_id="summary-task"))
|
||||
lens = StepCapsuleLens(model_name="test-model", llm=model, ctx=ctx)
|
||||
for text in ("first chunk", "next chunk"):
|
||||
await lens._invoke(model, [HumanMessage(content=text)], "test-model")
|
||||
visual = VisualStepSummarizer(ctx, model_name="test-model")
|
||||
visual._llm = model
|
||||
for number in (1, 2):
|
||||
visual._step_inputs[number] = {
|
||||
"step_number": number,
|
||||
"action_name": "press_key",
|
||||
"action_args": {},
|
||||
"pre_img_bytes": None,
|
||||
"post_img_bytes": None,
|
||||
"exec_outcome": "dispatched",
|
||||
}
|
||||
assert await visual._attempt(number)
|
||||
keys = []
|
||||
for request in requests:
|
||||
payload = json.loads(request.content)
|
||||
assert request.url.path == "/v1/responses"
|
||||
key = payload["prompt_cache_key"]
|
||||
assert request.headers["thread-id"] == request.headers["session-id"] == key
|
||||
keys.append(key)
|
||||
assert len(keys) == 4 and keys[0] == keys[1] and keys[2] == keys[3] and keys[0] != keys[2]
|
||||
Reference in new issue
Block a user