Make your computer a home for your AI partner. Avibe is the local-first Agent OS: Vibey, its built-in AI partner, works out of the box, and Claude Code, Codex & OpenCode run unchanged beside it — reach them from your browser, phone, or any chat app.
Python agentagent-osaiai-agentsai-partnerchatopsclaudeclaude-codecodexdevtoolsdiscord-botlark-botllmlocal-firstlong-term-memoryopencodeslack-botvibe-codingvibeywechat
fix(queue): clarify unknown send feedback and reconcile Codex steers (#2077)
Call White29dd6b730174
diff --git a/core/services/agent_steering.py b/core/services/agent_steering.pyindex d6dcef71b..1439de2cb 100644--- a/core/services/agent_steering.py+++ b/core/services/agent_steering.py@@ -237,11 +237,18 @@ async def reconcile_steer_attempt() -> SteerResult:"""Read exact backend evidence without repeating the native write."""- targets = [- target- for target in _active_targets(controller, backend, request.target_session_id)- if target.logical_turn_id == request.expected_logical_turn_id- ]+ service = getattr(controller, "agent_service", None)+ backend_agent = getattr(service, "agents", {}).get(backend)+ retained_target = getattr(backend_agent, "reconciliation_steer_target", None)+ target = retained_target(request) if callable(retained_target) else None+ if isinstance(target, ActiveSteerTarget):+ targets = [target]+ else:+ targets = [+ target+ for target in _active_targets(controller, backend, request.target_session_id)+ if target.logical_turn_id == request.expected_logical_turn_id+ ]if len(targets) != 1:return result(SteerOutcome.UNKNOWN,diff --git a/docs/plans/agent-message-priority.md b/docs/plans/agent-message-priority.mdindex 98f17f750..f61e7f86f 100644--- a/docs/plans/agent-message-priority.md+++ b/docs/plans/agent-message-priority.md@@ -78,8 +78,12 @@ receiver.- **Codex:** call the installed app-server `turn/steer` method with `threadId`,`expectedTurnId`, and the same text / `localImage` input builder as `turn/start`.- Non-image files use the existing attachment context. A response is accepted only when its- `turnId` equals the expected native turn. Never fall back to `turn/start`.+ Include the durable steer attempt id as `clientUserMessageId`; Codex persists it+ on the resulting `userMessage` item. A response is accepted only when its+ `turnId` equals the expected native turn. If the acknowledgement is ambiguous,+ recovery reads the exact thread turn and accepts only a matching `clientId`;+ absence of that evidence remains `unknown` and fenced. Never fall back to+ `turn/start`.- **Claude:** call `query()` on the existing live client using the existingruntime session id while retaining the same receiver generation. Successfulcompletion of the SDK transport write is the acknowledgement. A timeout,diff --git a/modules/agents/codex/agent.py b/modules/agents/codex/agent.pyindex 41addac44..1f601a16b 100644--- a/modules/agents/codex/agent.py+++ b/modules/agents/codex/agent.py@@ -9,6 +9,7 @@ import osimport shleximport timefrom contextlib import AsyncExitStack+from dataclasses import dataclassfrom pathlib import Pathfrom typing import TYPE_CHECKING, Any, Awaitable, Callable, Dict, Optional, Sequence@@ -37,6 +38,7 @@ from core.prompt_registry import prompt_textfrom core.services.agent_steering import (ActiveSteerTarget,SteerOutcome,+ SteerReconcileRequest,SteerRequest,SteerResult,result as steer_result,@@ -81,6 +83,19 @@ _CODEX_REBINDABLE_SAME_ID_PROVIDERS = _CODEX_MANAGED_PROVIDER_IDS | frozenset(CODEX_CALLER_ENV_DIR = "codex-caller-env"CODEX_CONNECTION_PROBE_DIR = "codex-connection-probe"CODEX_PROMPT_STRATEGY_METADATA_KEY = "codex_prompt_strategy"+_STEER_RECONCILIATION_TTL_SECONDS = 300.0+_MAX_STEER_RECONCILIATION_TARGETS = 128+++@dataclass(frozen=True)+class _CodexSteerReconciliationTarget:+ target: ActiveSteerTarget+ target_session_id: str+ logical_turn_id: str+ native_turn_id: str+ thread_id: str+ cwd: str+ recorded_at: floatclass _CodexConnectionProbeState:@@ -173,6 +188,10 @@ class CodexAgent(BaseAgent):# base_session_id → asyncio.Lock (serialize turn lifecycle per session)self._session_locks: Dict[str, asyncio.Lock] = {}+ # A native steer can be accepted just before the Codex turn completes.+ # Keep its exact thread/session addressing briefly so a lost RPC response+ # can still be reconciled after the live turn registry is cleaned up.+ self._steer_reconciliation_targets: dict[str, _CodexSteerReconciliationTarget] = {}# base_session_id → (thread_id, developer_instructions)self._thread_developer_instructions: Dict[str, tuple[str, str]] = {}# base_session_id → (thread_id, collaboration | fallback |@@ -600,6 +619,122 @@ class CodexAgent(BaseAgent):return Nonereturn self._turn_registry.get_active_turn(active_request.base_session_id)+ def _prune_steer_reconciliation_targets(self) -> None:+ targets = getattr(self, "_steer_reconciliation_targets", None)+ if not targets:+ return+ cutoff = time.monotonic() - _STEER_RECONCILIATION_TTL_SECONDS+ for attempt_id, retained in list(targets.items()):+ if retained.recorded_at < cutoff:+ targets.pop(attempt_id, None)+ if len(targets) <= _MAX_STEER_RECONCILIATION_TARGETS:+ return+ oldest = sorted(targets.items(), key=lambda item: item[1].recorded_at)+ for attempt_id, _retained in oldest[: len(targets) - _MAX_STEER_RECONCILIATION_TARGETS]:+ targets.pop(attempt_id, None)++ def _remember_steer_reconciliation_target(+ self,+ request: SteerRequest,+ target: ActiveSteerTarget,+ *,+ thread_id: str,+ cwd: str,+ ) -> None:+ if not request.attempt_id or not thread_id or not cwd:+ return+ targets = getattr(self, "_steer_reconciliation_targets", None)+ if targets is None:+ targets = {}+ self._steer_reconciliation_targets = targets+ self._prune_steer_reconciliation_targets()+ targets[request.attempt_id] = _CodexSteerReconciliationTarget(+ target=target,+ target_session_id=request.target_session_id,+ logical_turn_id=request.expected_logical_turn_id,+ native_turn_id=request.expected_native_turn_id,+ thread_id=thread_id,+ cwd=cwd,+ recorded_at=time.monotonic(),+ )++ def _forget_steer_reconciliation_target(self, attempt_id: str) -> None:+ if not attempt_id:+ return+ targets = getattr(self, "_steer_reconciliation_targets", None)+ if targets is not None:+ targets.pop(attempt_id, None)++ def _finish_steer_receipt(+ self,+ request: SteerRequest,+ receipt: SteerResult,+ ) -> SteerResult:+ if receipt.outcome is not SteerOutcome.UNKNOWN:+ self._forget_steer_reconciliation_target(request.attempt_id)+ return receipt++ @staticmethod+ def _durable_reconciliation_binding(+ session_id: str,+ *,+ backend: str,+ ) -> tuple[str, str] | None:+ """Return the persisted native thread and workdir for a Session."""++ try:+ from core.scheduled_tasks import resolve_session_id_target++ target = resolve_session_id_target(session_id)+ except Exception:+ logger.debug(+ "Could not resolve durable Codex reconciliation binding for Session=%s",+ session_id,+ exc_info=True,+ )+ return None+ if str(target.agent_backend or "").strip() != backend:+ return None+ native_session_id = str(target.native_session_id or "").strip()+ workdir = str(target.workdir or "").strip()+ if not native_session_id or not workdir:+ return None+ return native_session_id, workdir++ def reconciliation_steer_target(+ self,+ request: SteerReconcileRequest,+ ) -> ActiveSteerTarget | None:+ """Return a live or durable target for a write whose acknowledgement was lost."""++ self._prune_steer_reconciliation_targets()+ targets = getattr(self, "_steer_reconciliation_targets", None) or {}+ retained = targets.get(request.attempt_id)+ if retained is not None:+ if (+ retained.target_session_id != request.target_session_id+ or retained.logical_turn_id != request.expected_logical_turn_id+ or retained.native_turn_id != request.expected_native_turn_id+ ):+ return None+ return retained.target++ # Recovery may run after a restart, when the in-memory target was lost.+ # The Session row still pins the Codex thread and workdir, so a read-only+ # reconciliation can proceed without reconstructing a live Turn gate.+ if self._durable_reconciliation_binding(+ request.target_session_id,+ backend=self.name,+ ) is None:+ return None+ return ActiveSteerTarget(+ runtime_key=request.target_session_id,+ logical_turn_id=request.expected_logical_turn_id,+ context=None,+ agent_request=None,+ agent=self,+ )+async def steer_active_turn(self,request: SteerRequest,@@ -621,15 +756,28 @@ class CodexAgent(BaseAgent):return steer_result(SteerOutcome.NOT_ACTIVE, reason="missing_native_thread", backend=self.name)if transport is None or not transport.is_initialized:return steer_result(SteerOutcome.REFUSED, reason="runtime_unavailable", backend=self.name)+ self._remember_steer_reconciliation_target(+ request,+ target,+ thread_id=thread_id,+ cwd=cwd,+ )++ steer_params = {+ "threadId": thread_id,+ "expectedTurnId": request.expected_native_turn_id,+ "input": self._build_native_input(request.text, request.files, request.input_metadata),+ }+ if request.attempt_id:+ # Codex persists this opaque client id on the userMessage item. It+ # lets recovery prove whether an acknowledgement-ambiguous write+ # landed without matching by text or replaying the input.+ steer_params["clientUserMessageId"] = request.attempt_idtry:response = await transport.send_request("turn/steer",- {- "threadId": thread_id,- "expectedTurnId": request.expected_native_turn_id,- "input": self._build_native_input(request.text, request.files, request.input_metadata),- },+ steer_params,)except RuntimeError as exc:diagnostic = str(exc)@@ -643,24 +791,33 @@ class CodexAgent(BaseAgent):"expectedturnid",)):- return steer_result(- SteerOutcome.NOT_ACTIVE,- reason="native_turn_mismatch",- backend=self.name,- diagnostic=diagnostic,+ return self._finish_steer_receipt(+ request,+ steer_result(+ SteerOutcome.NOT_ACTIVE,+ reason="native_turn_mismatch",+ backend=self.name,+ diagnostic=diagnostic,+ ),)if "activeturnnotsteerable" in lowered or "not steerable" in lowered:- return steer_result(+ return self._finish_steer_receipt(+ request,+ steer_result(+ SteerOutcome.REFUSED,+ reason="native_turn_not_steerable",+ backend=self.name,+ diagnostic=diagnostic,+ ),+ )+ return self._finish_steer_receipt(+ request,+ steer_result(SteerOutcome.REFUSED,- reason="native_turn_not_steerable",+ reason="backend_refused",backend=self.name,diagnostic=diagnostic,- )- return steer_result(- SteerOutcome.REFUSED,- reason="backend_refused",- backend=self.name,- diagnostic=diagnostic,+ ),)except ConnectionError as exc:diagnostic = str(exc)@@ -668,11 +825,14 @@ class CodexAgent(BaseAgent):"Codex app-server transport is not available","Codex app-server stdin is not available",}:- return steer_result(- SteerOutcome.REFUSED,- reason="runtime_unavailable",- backend=self.name,- diagnostic=diagnostic,+ return self._finish_steer_receipt(+ request,+ steer_result(+ SteerOutcome.REFUSED,+ reason="runtime_unavailable",+ backend=self.name,+ diagnostic=diagnostic,+ ),)self._touch_transport_activity(cwd)return steer_result(@@ -693,17 +853,152 @@ class CodexAgent(BaseAgent):self._touch_transport_activity(cwd)response_turn_id = str(response.get("turnId") or "").strip()if response_turn_id != request.expected_native_turn_id:+ return self._finish_steer_receipt(+ request,+ steer_result(+ SteerOutcome.UNKNOWN,+ reason="untrusted_acknowledgement",+ backend=self.name,+ response_turn_id=response_turn_id,+ ),+ )+ return self._finish_steer_receipt(+ request,+ steer_result(+ SteerOutcome.ACCEPTED,+ backend=self.name,+ thread_id=thread_id,+ turn_id=response_turn_id,+ ),+ )++ async def reconcile_steer_attempt(+ self,+ request: SteerReconcileRequest,+ target: ActiveSteerTarget,+ ) -> SteerResult:+ """Read Codex's persisted user-message id for one prior steer."""++ if not request.attempt_id:+ return steer_result(+ SteerOutcome.UNKNOWN,+ reason="missing_attempt_identity",+ backend=self.name,+ )++ active_request = target.agent_request+ base_session_id = (+ active_request.base_session_id+ if active_request is not None+ else request.target_session_id+ )+ targets = getattr(self, "_steer_reconciliation_targets", None) or {}+ retained = targets.get(request.attempt_id)+ if retained is not None:+ thread_id = retained.thread_id+ cwd = retained.cwd+ else:+ active_turn_id = self._turn_registry.get_active_turn(base_session_id)+ if active_turn_id == request.expected_native_turn_id:+ thread_id = self._session_mgr.get_thread_id(base_session_id)+ cwd = self._session_mgr.get_cwd(base_session_id)+ if not cwd and active_request is not None:+ cwd = active_request.working_path+ else:+ durable = self._durable_reconciliation_binding(+ request.target_session_id,+ backend=self.name,+ )+ if durable is None:+ return steer_result(+ SteerOutcome.UNKNOWN,+ reason="stale_native_turn",+ backend=self.name,+ )+ thread_id, cwd = durable++ transport = self._transports.get(cwd) if cwd else None+ if transport is not None and getattr(transport, "is_alive", True) is False:+ transport = None+ if transport is None and cwd:+ try:+ # A timed-out request marks the transport uninitialized, but an+ # alive reader can still answer this read-only evidence query.+ # If no usable process remains, create a fresh app-server for+ # thread/read; this never replays the original steer.+ transport = await self._get_or_create_transport(cwd)+ except Exception as exc:+ return steer_result(+ SteerOutcome.UNKNOWN,+ reason="attempt_evidence_unavailable",+ backend=self.name,+ diagnostic=str(exc),+ )+ if not thread_id or transport is None:+ return steer_result(+ SteerOutcome.UNKNOWN,+ reason="attempt_evidence_unavailable",+ backend=self.name,+ )++ try:+ response = await transport.send_request(+ "thread/read",+ {+ "threadId": thread_id,+ "includeTurns": True,+ },+ )+ except (ConnectionError, TimeoutError) as exc:+ return steer_result(+ SteerOutcome.UNKNOWN,+ reason="attempt_evidence_unavailable",+ backend=self.name,+ diagnostic=str(exc),+ )+ except Exception as exc: # noqa: BLE001 - absence is not negative proofreturn steer_result(SteerOutcome.UNKNOWN,- reason="untrusted_acknowledgement",+ reason="attempt_evidence_unavailable",backend=self.name,- response_turn_id=response_turn_id,+ diagnostic=str(exc),)++ thread = response.get("thread") if isinstance(response, dict) else None+ turns = thread.get("turns") if isinstance(thread, dict) else None+ if not isinstance(turns, list):+ return steer_result(+ SteerOutcome.UNKNOWN,+ reason="attempt_evidence_unavailable",+ backend=self.name,+ )++ for turn in turns:+ if not isinstance(turn, dict) or str(turn.get("id") or "") != request.expected_native_turn_id:+ continue+ items = turn.get("items")+ if not isinstance(items, list):+ break+ for item in items:+ if (+ isinstance(item, dict)+ and item.get("type") == "userMessage"+ and str(item.get("clientId") or "") == request.attempt_id+ ):+ self._forget_steer_reconciliation_target(request.attempt_id)+ return steer_result(+ SteerOutcome.ACCEPTED,+ reason="native_attempt_client_id_found",+ backend=self.name,+ native_turn_id=request.expected_native_turn_id,+ client_user_message_id=request.attempt_id,+ )+ break+return steer_result(- SteerOutcome.ACCEPTED,+ SteerOutcome.UNKNOWN,+ reason="untrusted_attempt_evidence",backend=self.name,- thread_id=thread_id,- turn_id=response_turn_id,)async def handle_stop(self, request: AgentRequest) -> bool:diff --git a/tests/test_agent_steering.py b/tests/test_agent_steering.pyindex e8248fd53..9375b5e6f 100644--- a/tests/test_agent_steering.py+++ b/tests/test_agent_steering.py@@ -400,6 +400,258 @@ async def test_codex_steers_expected_active_turn_without_starting_another_turn(nawait _cancel_tasks(gate_task)+async def test_codex_steer_reconciliation_uses_persisted_client_message_id() -> None:+ primary = _primary_request(backend="codex")+ gate_task = await _held_task()+ attempt_id = ATTEMPT_ID++ class _ReconcileTransport(_CodexTransport):+ async def send_request(self, method: str, params: dict) -> dict:+ self.calls.append((method, params))+ if method == "thread/read":+ return {+ "thread": {+ "turns": [{+ "id": "codex-turn",+ "status": "inProgress",+ "items": [{+ "type": "userMessage",+ "id": "user-message-1",+ "clientId": attempt_id,+ "content": [{"type": "text", "text": STEER_TEXT}],+ }],+ }],+ },+ }+ return {"turnId": "codex-turn"}++ transport = _ReconcileTransport()+ agent = object.__new__(CodexAgent)+ agent._turn_registry = _CodexTurnRegistry(primary.base_session_id, "codex-turn")+ agent._session_mgr = _CodexSessionManager(+ primary.base_session_id,+ "codex-thread",+ primary.working_path,+ )+ agent._transports = {primary.working_path: transport}+ controller = _controller_with_active_gate(agent, primary, gate_task)+ target = ActiveSteerTarget(+ runtime_key="runtime-key",+ logical_turn_id="logical-turn",+ context=primary.context,+ agent_request=primary,+ agent=agent,+ )+ try:+ receipt = await steer_active_turn(+ controller,+ "codex",+ SteerRequest(+ target_session_id="avibe-session",+ expected_logical_turn_id="logical-turn",+ expected_native_turn_id="codex-turn",+ text=STEER_TEXT,+ attempt_id=attempt_id,+ ),+ )+ assert receipt.outcome is SteerOutcome.ACCEPTED+ assert transport.calls[0] == (+ "turn/steer",+ {+ "threadId": "codex-thread",+ "expectedTurnId": "codex-turn",+ "input": [{"type": "text", "text": STEER_TEXT}],+ "clientUserMessageId": attempt_id,+ },+ )++ reconciled = await agent.reconcile_steer_attempt(+ SteerReconcileRequest(+ target_session_id="avibe-session",+ expected_logical_turn_id="logical-turn",+ expected_native_turn_id="codex-turn",+ attempt_id=attempt_id,+ ),+ target,+ )+ assert reconciled.outcome is SteerOutcome.ACCEPTED+ assert reconciled.reason == "native_attempt_client_id_found"+ assert [method for method, _params in transport.calls] == [+ "turn/steer",+ "thread/read",+ ]+ finally:+ await _cancel_tasks(gate_task)+++async def test_codex_steer_reconciliation_survives_completed_native_turn() -> None:+ primary = _primary_request(backend="codex")+ gate_task = await _held_task()+ attempt_id = ATTEMPT_ID++ class _CompletedTurnTransport(_CodexTransport):+ async def send_request(self, method: str, params: dict) -> dict:+ self.calls.append((method, params))+ if method == "turn/steer":+ self.is_initialized = False+ raise TimeoutError("steer response lost after native write")+ return {+ "thread": {+ "turns": [{+ "id": "codex-turn",+ "status": "completed",+ "items": [{+ "type": "userMessage",+ "clientId": attempt_id,+ }],+ }],+ },+ }++ transport = _CompletedTurnTransport()+ agent = object.__new__(CodexAgent)+ agent._turn_registry = _CodexTurnRegistry(primary.base_session_id, "codex-turn")+ agent._session_mgr = _CodexSessionManager(+ primary.base_session_id,+ "codex-thread",+ primary.working_path,+ )+ agent._transports = {primary.working_path: transport}+ agent._transport_last_activity = {}+ controller = _controller_with_active_gate(agent, primary, gate_task)+ request = SteerRequest(+ target_session_id="avibe-session",+ expected_logical_turn_id="logical-turn",+ expected_native_turn_id="codex-turn",+ text=STEER_TEXT,+ attempt_id=attempt_id,+ )+ try:+ receipt = await steer_active_turn(controller, "codex", request)+ assert receipt.outcome is SteerOutcome.UNKNOWN++ agent._turn_registry.active_turns.clear()+ controller.agent_service._turn_gates.clear()+ reconciled = await reconcile_steer_attempt(+ controller,+ "codex",+ SteerReconcileRequest(+ target_session_id="avibe-session",+ expected_logical_turn_id="logical-turn",+ expected_native_turn_id="codex-turn",+ attempt_id=attempt_id,+ ),+ )++ assert reconciled.outcome is SteerOutcome.ACCEPTED+ assert reconciled.reason == "native_attempt_client_id_found"+ assert [method for method, _params in transport.calls] == [+ "turn/steer",+ "thread/read",+ ]+ assert not agent._steer_reconciliation_targets+ finally:+ await _cancel_tasks(gate_task)+++async def test_codex_steer_reconciliation_uses_durable_binding_after_restart(monkeypatch) -> None:+ primary = _primary_request(backend="codex")+ attempt_id = ATTEMPT_ID++ class _CompletedTransport(_CodexTransport):+ async def send_request(self, method: str, params: dict) -> dict:+ self.calls.append((method, params))+ return {+ "thread": {+ "turns": [{+ "id": "codex-turn",+ "status": "completed",+ "items": [{"type": "userMessage", "clientId": attempt_id}],+ }],+ },+ }++ monkeypatch.setattr(+ "core.scheduled_tasks.resolve_session_id_target",+ lambda _session_id: SimpleNamespace(+ agent_backend="codex",+ native_session_id="codex-thread",+ workdir=primary.working_path,+ ),+ )+ transport = _CompletedTransport()+ agent = object.__new__(CodexAgent)+ agent._turn_registry = _CodexTurnRegistry(primary.base_session_id, "different-turn")+ agent._session_mgr = _CodexSessionManager(+ primary.base_session_id,+ "stale-thread",+ primary.working_path,+ )+ agent._transports = {primary.working_path: transport}+ agent._steer_reconciliation_targets = {}++ request = SteerReconcileRequest(+ target_session_id=primary.base_session_id,+ expected_logical_turn_id="logical-turn",+ expected_native_turn_id="codex-turn",+ attempt_id=attempt_id,+ )+ target = agent.reconciliation_steer_target(request)+ assert target is not None+ assert target.agent_request is None++ reconciled = await agent.reconcile_steer_attempt(request, target)++ assert reconciled.outcome is SteerOutcome.ACCEPTED+ assert reconciled.reason == "native_attempt_client_id_found"+ assert transport.calls == [("thread/read", {"threadId": "codex-thread", "includeTurns": True})]+++async def test_codex_steer_reconciliation_cache_keeps_only_unknown_receipts() -> None:+ primary = _primary_request(backend="codex")++ async def run(error: Exception | None, response: dict | None) -> dict:+ gate_task = await _held_task()+ transport = _CodexTransport(error=error, response=response)+ agent = object.__new__(CodexAgent)+ agent._turn_registry = _CodexTurnRegistry(primary.base_session_id, "codex-turn")+ agent._session_mgr = _CodexSessionManager(+ primary.base_session_id,+ "codex-thread",+ primary.working_path,+ )+ agent._transports = {primary.working_path: transport}+ agent._transport_last_activity = {}+ controller = _controller_with_active_gate(agent, primary, gate_task)+ try:+ await steer_active_turn(+ controller,+ "codex",+ SteerRequest(+ target_session_id=primary.base_session_id,+ expected_logical_turn_id="logical-turn",+ expected_native_turn_id="codex-turn",+ text=STEER_TEXT,+ attempt_id=ATTEMPT_ID,+ ),+ )+ return dict(agent._steer_reconciliation_targets)+ finally:+ await _cancel_tasks(gate_task)++ accepted = await run(None, {"turnId": "codex-turn"})+ refused = await run(RuntimeError("activeTurnNotSteerable"), None)+ unknown = await run(TimeoutError("turn/steer timed out"), None)++ assert accepted == {}+ assert refused == {}+ assert set(unknown) == {ATTEMPT_ID}++@pytest.mark.anyioasync def test_codex_start_renders_now_after_runtime_prompt_preparation(monkeypatch):"""Scenario: MESSAGE-DELIVERY-318."""diff --git a/tests/test_codex_agent.py b/tests/test_codex_agent.pyindex 383bc02ba..7a1858e19 100644--- a/tests/test_codex_agent.py+++ b/tests/test_codex_agent.py@@ -168,7 +168,11 @@ for name, module in _STUBBED_MODULES.items():_SPEC = importlib.util.spec_from_file_location("test_codex_agent_module", _AGENT_PATH)assert _SPEC is not None and _SPEC.loader is not None_MODULE = importlib.util.module_from_spec(_SPEC)-_SPEC.loader.exec_module(_MODULE)+sys.modules[_SPEC.name] = _MODULE+try:+ _SPEC.loader.exec_module(_MODULE)+finally:+ sys.modules.pop(_SPEC.name, None)CodexAgent = _MODULE.CodexAgentCODEX_PROMPT_STRATEGY_METADATA_KEY = _MODULE.CODEX_PROMPT_STRATEGY_METADATA_KEYCodexConnectionProbeRuntimeMismatchError = (diff --git a/ui/e2e/queue-attachments/previews.spec.ts b/ui/e2e/queue-attachments/previews.spec.tsindex c208db09c..5e6a84e5d 100644--- a/ui/e2e/queue-attachments/previews.spec.ts+++ b/ui/e2e/queue-attachments/previews.spec.ts@@ -148,7 +148,9 @@ test('an unconfirmed image survives reload and can be inspected but not resent oawait expect(pendingRow).toContainText('队列图片.png');const image = pendingRow.locator('img');await expect.poll(() => image.evaluate((el: HTMLImageElement) => el.naturalWidth)).toBeGreaterThan(0);- await expect(page.getByRole('button', { name: 'Confirming…' })).toBeDisabled();+ const pending = page.getByRole('button', { name: 'Send status not confirmed' });+ await expect(pending).toBeDisabled();+ await expect(pending.locator('.animate-spin')).toHaveCount(0);await expect(pendingRow.getByRole('button', { name: 'Remove from queue' })).toBeDisabled();await activate(page, pendingRow.locator('[data-queue-attachment]').first());await expect(page.getByRole('dialog')).toBeVisible();diff --git a/ui/src/components/workbench/ChatPage.tsx b/ui/src/components/workbench/ChatPage.tsxindex be2a2d3bb..266749f09 100644--- a/ui/src/components/workbench/ChatPage.tsx+++ b/ui/src/components/workbench/ChatPage.tsx@@ -3429,7 +3429,9 @@ export const QueueStrip: React.FC<{if (queue.length === 0) return null;const retryRequired = queue.some((item) => item.requires_explicit_retry === true);const headFenced = isQueueDeliveryFenced(queue[0]);+ const reconciling = queue[0].state === 'reconciling_steer';const busy = sendingNow || headFenced;+ const buttonBusy = sendingNow || (headFenced && !reconciling);return (<div className="shrink-0 px-4 md:px-8"><div className="mx-auto w-full max-w-[1080px] rounded-xl border border-cyan/25 bg-cyan/[0.04] p-2">@@ -3444,20 +3446,24 @@ export const QueueStrip: React.FC<{size="sm"onClick={onSendNow}disabled={busy}- aria-busy={busy}+ aria-busy={buttonBusy}className="h-6 min-w-[60px] justify-center px-2 text-[11px] text-cyan-ink">{busy ? (<>- <Loader2 className="size-3.5 animate-spin" aria-hidden="true" />- {t(queue[0].state === 'reconciling_steer' ? 'chat.queue.confirmingNow' : 'chat.queue.sendingNow')}+ {reconciling ? (+ <Info className="size-3.5" aria-hidden="true" />+ ) : (+ <Loader2 className="size-3.5 animate-spin" aria-hidden="true" />+ )}+ {t(reconciling ? 'chat.queue.confirmingNow' : 'chat.queue.sendingNow')}</>) : (t('chat.queue.sendNow'))}</Button></div>- {headFenced && (+ {reconciling && (<p role="status" className="px-1 pb-1.5 text-[11px] text-muted">{t('chat.queue.sendReconciling')}</p>)}{retryRequired && <p className="px-1 pb-1.5 text-[11px] text-muted">{t('chat.queue.retryHint')}</p>}diff --git a/ui/src/components/workbench/ChatQueueRow.test.tsx b/ui/src/components/workbench/ChatQueueRow.test.tsxindex d6380e692..de8eb9779 100644--- a/ui/src/components/workbench/ChatQueueRow.test.tsx+++ b/ui/src/components/workbench/ChatQueueRow.test.tsx@@ -132,8 +132,13 @@ describe('QueueStrip — compatible queued messages read as one batch', () => {<QueueStrip queue={items} onRemove={onRemove} onRecall={vi.fn()} onSendNow={onSendNow} /></I18nextProvider>,);- const send = screen.getByRole('button', { name: state === 'reconciling_steer' ? 'Confirming…' : 'Sending…' });+ const send = screen.getByRole('button', {+ name: state === 'reconciling_steer' ? 'Send status not confirmed' : 'Sending…',+ });expect((send as HTMLButtonElement).disabled).toBe(true);+ expect(Boolean(send.querySelector('.animate-spin'))).toBe(state !== 'reconciling_steer');+ expect(send.getAttribute('aria-busy')).toBe(state === 'reconciling_steer' ? 'false' : 'true');+ expect(Boolean(screen.queryByRole('status'))).toBe(state === 'reconciling_steer');fireEvent.click(send);expect(onSendNow).not.toHaveBeenCalled();const rows = [...document.querySelectorAll<HTMLElement>('[data-queue-row]')];diff --git a/ui/src/i18n/en.json b/ui/src/i18n/en.jsonindex d8ca4cd85..98d705e12 100644--- a/ui/src/i18n/en.json+++ b/ui/src/i18n/en.json@@ -4336,10 +4336,10 @@"retryHint": "Automatic startup retries stopped after failure. Your input is retained. Resolve the error, then use Send now or Retry on the failure notice.","sendNow": "Send now","sendingNow": "Sending…",- "confirmingNow": "Confirming…",+ "confirmingNow": "Send status not confirmed","sendDeferred": "Couldn't send into the current turn. Your message is still queued.","attachmentsUnavailable": "An attachment is no longer available. Your message is still queued; upload the attachment again to resend it.",- "sendReconciling": "Delivery is being confirmed. Your message is retained; don't resend it.",+ "sendReconciling": "We couldn't confirm whether this message was sent. It is kept here, and Avibe won't send it again. Refresh to check the latest status.","recall": "Recall to input","remove": "Remove from queue","attachments": {diff --git a/ui/src/i18n/zh.json b/ui/src/i18n/zh.jsonindex b8195e1b3..334221507 100644--- a/ui/src/i18n/zh.json+++ b/ui/src/i18n/zh.json@@ -4336,10 +4336,10 @@"title": "排队中 · {{count}}","sendNow": "立即发送","sendingNow": "发送中…",- "confirmingNow": "确认中…",+ "confirmingNow": "发送状态未确认","sendDeferred": "暂时无法发送到当前任务,消息仍保留在队列中。","attachmentsUnavailable": "部分附件已不可用,原消息仍保留在队列中。请重新上传附件后再发送。",- "sendReconciling": "正在确认消息是否送达,原消息已保留,请勿重复发送。",+ "sendReconciling": "暂时无法确认这条消息是否发送成功。消息已保留,系统不会重复发送;请刷新页面查看最新状态。","recall": "撤回到输入框","remove": "移出队列","attachments": {