Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 17 additions & 7 deletions amplifier_web/service.py
Original file line number Diff line number Diff line change
Expand Up @@ -2094,6 +2094,14 @@ async def _dispatch(self, action, args=None, origin="ui", command_id=None, expec
routed = await self.collaboration.route(action, args, origin, command_id, caller_session_id)
if routed is not None:
return routed
if action == 'conversation.delivery':
# A check is not another send command. Skip ordinary history refresh and
# per-check receipt/publication; exact new acceptance still reconciles
# through the existing delivery owner below.
if admission_check is not None:
admission_check()
return {'accepted': True, 'hostInstanceId': self.instance_id,
'result': await self._check_delivery(args['sessionId'], args['inputId'])}
if action == 'conversation.configuration':
from .conversation_configuration import read
async with self.lock:
Expand Down Expand Up @@ -3544,9 +3552,6 @@ async def _dispatch(self, action, args=None, origin="ui", command_id=None, expec
'interruptionRevision': session.get('interruptionRevision', 0)}
if shared_room else copy.deepcopy(session))
pending.append((self._send, (dispatch_session, text, input_id, previous_activity, args.get('preserveDraft', False))))
elif action == "conversation.delivery":
session = self._session(args['sessionId'])
pending.append((self._check_delivery, (session['id'], args['inputId'])))
elif action == "conversation.retry":
from .message_delivery import find_message
session = self._session(args['sessionId'])
Expand Down Expand Up @@ -4369,7 +4374,7 @@ async def _edit_current(self, source):
raise AppError(str(exc),409,code=receipt['code']) from exc

async def _check_delivery(self, sid, input_id):
if self._session(sid).get('externalAgent'):
if self._session(sid, hydrate=False).get('externalAgent'):
async with self.lock:
return self.external_conversations.delivery(self._session(sid), input_id)
from .message_delivery import find_message, receipt_delivery, receipt_mapping
Expand Down Expand Up @@ -4437,8 +4442,13 @@ def result(status, session, message=None):
}.get(status, 'Delivery is still uncertain. Checking does not resend it. Sending again may repeat work if the earlier attempt ran.')}

async with self.lock:
session = copy.deepcopy(self._session(sid))
message, status, protected, conflict, _ = saved_evidence(session)
from .cold_display import detached
view = detached(self._session(sid, hydrate=False))
# The native receipt probe needs identity, not a copy of the entire
# transcript, execution tree and accumulated tool output.
session = {key: view.get(key) for key in ('id', 'workspace', 'runtimeSessionId', 'nativeIdentity')}
message, status, protected, conflict, _ = saved_evidence(view)
message = copy.deepcopy(message)
if protected:
return result(status, session, message)
if conflict:
Expand All @@ -4454,7 +4464,7 @@ def result(status, session, message=None):
except Exception:
pass # A failed probe cannot prove that the input was not delivered.
async with self.lock:
current = self._session(sid)
current = self._session(sid, hydrate=False)
message, status, protected, conflict, writable = saved_evidence(current)
if protected:
return result(status, current, message)
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading