fix: harden conversational mode draft revisions

This commit is contained in:
vee
2026-09-08 00:55:45 +08:00
parent f0a248ede3
commit 5e228e12ae
16 changed files with 1862 additions and 23 deletions
+31
View File
@@ -770,6 +770,37 @@ class TestCodexAssistantWebApi:
assert action["payload"]["hardware_execution_allowed"] is False
assert events[0]["engine"] == "n7web-mode-builder"
def test_become_percentage_update_keeps_movie_draft_route_end_to_end(
self,
) -> None:
reference = {
"name": "观影模式",
"source_request_id": "req-mode-preview",
"vehicle_id": "denza_n7",
}
message = "把观影模式的遮阳帘变成100%"
events = self.post_assistant(
{
"message": message,
"conversation_id": "conv-api-movie-shade-become-percent",
"execution_mode": "hardware",
"mode_profile_draft_context": reference,
}
)
assert not FAKE_CODEX.turn_calls
call = AssistantApiHandler.service.calls[-1]
assert call["utterance"] == message
assert call["mode_profile_draft_context"] == reference
action = next(event for event in events if event["type"] == "action.completed")
assert action["success"] is True
assert action["payload"]["execution_mode"] == "dry_run"
assert action["payload"]["hardware_execution_allowed"] is False
assert action["payload"]["mode_profile_draft"]["draft_revision"] == 2
assert events[0]["route"] == "vehicle_control"
assert events[0]["engine"] == "n7web-mode-builder"
def test_active_draft_reference_is_not_forwarded_for_an_unrelated_question(
self,
) -> None:
+5 -5
View File
@@ -656,7 +656,7 @@ operations:
) as response:
extension_styles = response.read().decode("utf-8").replace("\r\n", "\n")
with self.opener.open(
f"{self.base_url}/assistant-chat.js?v=codex-assistant-23", timeout=3
f"{self.base_url}/assistant-chat.js?v=codex-assistant-24", timeout=3
) as response:
assistant_script = response.read().decode("utf-8")
with self.opener.open(
@@ -718,8 +718,8 @@ operations:
self.assertNotIn("滚动查看更多", html)
self.assertIn('aria-label="发送消息"', html)
self.assertIn('id="assistantTranscript"', html)
self.assertIn('href="/assistant-chat.css?v=codex-assistant-23"', html)
self.assertIn('src="/assistant-chat.js?v=codex-assistant-23"', html)
self.assertIn('href="/assistant-chat.css?v=codex-assistant-24"', html)
self.assertIn('src="/assistant-chat.js?v=codex-assistant-24"', html)
self.assertIn('href="/energy-monitor.css?v=energy-monitor-4"', html)
self.assertIn('src="/energy-monitor.js?v=energy-monitor-4"', html)
self.assertNotIn('"admin"', console_script)
@@ -995,8 +995,8 @@ operations:
self.assertIn('const CACHE_VERSION = "cognitive-agent-pad-v272"', service_worker)
self.assertIn('/console-v2.css?v=delivery-state-65', service_worker)
self.assertIn('/console-v2.js?v=delivery-state-62', service_worker)
self.assertIn('/assistant-chat.css?v=codex-assistant-23', service_worker)
self.assertIn('/assistant-chat.js?v=codex-assistant-23', service_worker)
self.assertIn('/assistant-chat.css?v=codex-assistant-24', service_worker)
self.assertIn('/assistant-chat.js?v=codex-assistant-24', service_worker)
self.assertIn('/energy-monitor.css?v=energy-monitor-4', service_worker)
self.assertIn('/energy-monitor.js?v=energy-monitor-4', service_worker)
self.assertIn('"/app.js?v=dual-seat-127"', service_worker)