chore: address review notes — dedup comment and 409-path clarification
This commit is contained in:
parent
d385db69d5
commit
2253cf5a32
2 changed files with 8 additions and 0 deletions
|
|
@ -122,6 +122,11 @@ def submit_pending(session_key: str, data: dict) -> _ClarifyEntry:
|
|||
== list(data.get("choices_offered") or [])
|
||||
):
|
||||
entry = last
|
||||
# Dedup re-uses the existing entry with its original clarify_id.
|
||||
# If a future caller pre-populates clarify_id in data, it is
|
||||
# silently discarded here — the original entry's id wins.
|
||||
# Today no caller sets clarify_id (it's generated by __init__),
|
||||
# so this is a non-issue.
|
||||
cb = _gateway_notify_cbs.get(session_key)
|
||||
# Keep _pending aligned to the oldest unresolved entry.
|
||||
_pending[session_key] = gw_queue[0].data
|
||||
|
|
|
|||
|
|
@ -9080,6 +9080,9 @@ def _handle_clarify_respond(handler, body):
|
|||
ok = _resolve_clarify_legacy(sid, clarify_id, response)
|
||||
|
||||
if not ok:
|
||||
# Both the runtime adapter and legacy paths set ok=False for
|
||||
# stale/expired/wrong-session responses. The 409 status applies
|
||||
# uniformly regardless of which path resolved the clarify request.
|
||||
return j(handler, {
|
||||
"ok": False,
|
||||
"error": "Clarification prompt expired or not found. The agent may have already proceeded.",
|
||||
|
|
|
|||
Loading…
Reference in a new issue