Skip to content

fix(webex): deny an undelivered approval at once instead of waiting - #34834

Merged
bolichen97 merged 1 commit into
mainfrom
fix/34404-webex-undelivered-approval
Nov 12, 2026
Merged

bolichen97 merged 1 commit into
mainfrom
fix/34404-webex-undelivered-approval

Conversation

@bolichen97

@bolichen97 bolichen97 commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor

Problem / Motivation

Goal: In a muted Webex conversation, a tool that needs approval is denied at once as "never delivered" instead of stalling the turn for the whole approval window first.

When a Webex conversation is muted (disconnected in the dashboard), its approval prompts are dropped on purpose. Webex still waits the full approval window (300 s) on every tool call that needs approval, for an answer nobody was asked for, and then denies it as approval_timeout.

Why it matters

Someone who disconnects a Webex conversation to keep working in the dashboard gets a turn that freezes for five minutes per tool call. The model is also told the prompt expired, when in fact it was never shown. The typed-reply channels already deny such a prompt at once.

Not a goal

What changed (motivation → approach → change)

A muted Webex conversation no longer stalls on approvals: a tool that needs one is denied straight away, and the model hears that the prompt never reached the user.

Before After
Muted conversation, tool needs approval waits 300 s, then denied as approval_timeout denied at once as approval_undeliverable
Muted conversation with an AutoNudge loop bound to it loop held after the 300 s wait loop held at once
Prompt delivered, user answers or lets it expire unchanged unchanged

Why it stalled: a muted turn renders with SilentRenderer, so the Webex renderer never calls PendingApprovals.reserve for the prompt. PendingApprovals.decide_with_cause in messaging/approval.py then opened a window of its own and waited it out. That broke the rule open_approval documents: no reservation means no prompt was delivered.

The fix: with no reservation, decide_with_cause returns (False, approval_undeliverable) at once, the same answer TextReplyApprovalDecider gives. It still calls _notify_approval_stalled, as the expired wait did, so a loop bound to the muted conversation is held instead of firing turns that are denied. The Webex renderer always reserves a delivered prompt before sending it, so nothing else changes. Tests that drove the registry without a reservation reserve first, the order production uses. docs/system-specs/modules/messaging.md lists SessionApprovalDecider among the deciders that record the undeliverable cause, and says an undelivered request signals the stall too.

Backwards compatibility

Compatible: a delivered Webex prompt is always reserved before it is sent, so only a never-delivered prompt changes, and it is still denied (sooner, with the true cause).

Reader: src/kiro_crew/webex/transport_dispatch.py:SessionApprovalDecider -- chat -- WebexRenderer reserves through mint_approval_nonce before it sends the prompt; test_webex_dispatch_cards.py::TestApprovalCardPress
Reader: src/kiro_crew/webex/transport_dispatch_interactions.py:_APPROVALS.has_pending -- chat -- a typed 1/2 still finds the reserved prompt while the turn waits; test_webex_dispatch.py::test_an_approve_reply_resolves_the_prompt_and_does_not_steer

Tests

  • test_approval_timeout_cause.py::TestSessionDecider::test_an_undelivered_prompt_is_denied_at_once_as_undeliverable: with no reservation the Webex decider denies inside the bound, records approval_undeliverable, and leaves nothing pending.
  • test_messaging_approval.py::TestApprovalStallSignalling::test_an_undelivered_prompt_signals_autonudge: with no reservation, the registry denies as undeliverable and still tells AutoNudge the approval stalled.
  • test_messaging_approval.py::TestReservationRace::test_an_answered_unadopted_reservation_is_discarded_with_the_turn: the later muted request is denied as undelivered, never by the discarded Approve.
  • The registry, nonce and Webex dispatch tests reserve before they decide, matching the renderer-first order.

Proof: PROVEN test/test_messaging_approval.py::TestReservationRace::test_an_answered_unadopted_reservation_is_discarded_with_the_turn (head 11052824863e)

Determinism: the 42 changed tests passed 20 times at -n0, 10 times at -n 4 --dist loadgroup --max-worker-restart=2 beside test_messaging_driver.py and test_messaging_dispatch.py, and once in a shuffled order (seed 34841).

Manual verification

N/A — unit coverage sufficient: the change is one branch in the approval registry, and the tests drive the same SessionApprovalDecider the Webex dispatcher builds.

Related Issues

Closes #34404

Sibling sweep

Swept: git grep -nE "class \w*ApprovalDecider\b" -- src/kiro_crew, then each decider's branch for a request with no reservation
Sibling: src/kiro_crew/messaging/approval.py -- changed here
Sibling: src/kiro_crew/discord/renderer_approval.py -- not affected -- denies a request with no reservation at once on main (#35767)
Sibling: src/kiro_crew/telegram/renderer_approval.py -- not affected -- denies a request with no reservation at once on main (#35767)
Sibling: src/kiro_crew/teams/approvals.py -- not affected -- denies a request with no reservation at once on main (#35767)
Sibling: src/kiro_crew/slack/renderer.py -- not affected -- its one caller (slack/transport_dispatch.py) pairs SlackApprovalDecider with SlackRenderer, never SilentRenderer, and SlackRenderer reserves before it posts

Pattern harvest

Not generalizable: each channel's decider has its own registry shape, so the "no reservation means undelivered" rule is a per-decider branch, not a pattern a lint can match.

Checklist

  • At most two commits (one is the norm), with a Conventional Commits title (feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)
  • Existing tests pass and new tests added for new functionality
  • Self-review completed; code follows project style guidelines
  • Documentation updated (if applicable)
  • No secrets, credentials, or internal references in the diff

@bolichen97
bolichen97 requested review from a team and KiroCrewCaptain as code owners November 10, 2026 21:56
@bolichen97
bolichen97 requested a review from CrysisDeu November 10, 2026 21:56
@bolichen97
bolichen97 enabled auto-merge (squash) November 10, 2026 22:17
@github-actions github-actions Bot added the readiness: action required A blocking check or review needs attention label Nov 10, 2026
@bolichen97

Copy link
Copy Markdown
Contributor Author

[operator: bolichen97] Every red check on 5977115 failed on GitHub's API rate limit for the CI installation (API rate limit exceeded for installation, 2026-11-10 21:56Z to 22:13Z), not on this change: Fast Gate itself passed, and Await Fast Gate, the review lanes, CodeQL and the Dependency License Gate could not read the API. CodeQL on main failed the same way in the same window. The shared-quota cause is tracked in #28761. Re-running the failed jobs once.

@github-actions

github-actions Bot commented Nov 11, 2026 •

Copy link
Copy Markdown
Contributor

UX Review (Opus 5.5) — ⏭️ skipped

Revision e4f0679f95317e132cc6c5026ae33791b27db85d touches no user-facing surface (no changes under website/ or committed screenshots), so the UX review was skipped. Does not block merge.

@github-actions

github-actions Bot commented Nov 11, 2026 •

Copy link
Copy Markdown
Contributor

First Principles Review (Opus 5.5) — ✅ PASS

Premise-level review of e4f0679f95317e132cc6c5026ae33791b27db85d — why this exists and whether the shipped surface is the smallest honest version. Updated in place on each push. A BLOCK verdict blocks PR readiness; PASS does not.

First-Principles-Verdict: PASS

Nothing blocks. The new branch reuses the existing DENY_CAUSE_APPROVAL_UNDELIVERABLE and _notify_approval_stalled. Its premise holds on main: driver.py:1315 awaits renderer.dispatch before _approve, and WebexRenderer always reserves because WEBEX_CAPABILITIES.rich_blocks=True is static.

What this change ships

Inventory (5 items) — 5 justified

Intent: someone who mutes a Webex conversation shouldn't have the turn freeze for 300 s on every tool call that needs approval. This is a FIX (#34404).

  1. In a muted Webex conversation, a tool that needs approval is denied at once instead of after 300 s — justified
  2. The model is told the prompt was never delivered (approval_undeliverable) rather than that it expired — justified
  3. An AutoNudge loop bound to the muted conversation is held at once — justified
  4. The registry no longer opens its own window when no reservation exists, which reverses the old "reservation that follows decide" docstring. The description declares it, and the driver's render-before-decide order backs it — justified
  5. messaging.md lists SessionApprovalDecider among the deciders that record the undeliverable cause — justified

[FIRST-PRINCIPLES-REVIEWED] e4f0679

Description read

[DESCRIPTION-READ] 8a89c402d09ba4de74b2d99bb2a1a36457e71529bbf295123bc31b3ea38e7b28

That sha256 names the PR description this verdict read. Recompute it with .github/scripts/pr-description-capture.sh; if it differs, the description changed after this verdict was formed and any finding drawn from the description is unproven.

@github-actions

github-actions Bot commented Nov 11, 2026 •

Copy link
Copy Markdown
Contributor

Design Review (Opus 5.5) — ✅ PASS

Design-level review of e4f0679f95317e132cc6c5026ae33791b27db85d — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS does not.

Design-Verdict: PASS

Nothing blocks. The one renderer that reserves in production, WebexRenderer built with WEBEX_CAPABILITIES (rich_blocks=True) and mint_approval_nonce, reserves before it sends. So a missing reservation does mean the prompt was never delivered.

Notes

  • The new rule is that a missing reservation means an undelivered prompt. That only holds while every PendingApprovals consumer reserves through the renderer before the driver awaits the decider. If a future renderer that sends the typed 1/2 prompt without the card, for example one gated off rich_blocks, it would be denied at once while the user is looking at a live prompt. A short comment at webex/renderer.py:363 naming that coupling would keep the gate from being changed without anyone noticing.

[DESIGN-REVIEWED] e4f0679

Description read

[DESCRIPTION-READ] 4c0cb7e9fd3d6e398128341e68714a710a0882c48801f3f6c4335e6c1d821fab

That sha256 names everything this verdict read: the PR description, plus the 1 evidence file(s) the workflow collected from it and handed this review. It covers that evidence because the media strip replaces every attachment URL with the same placeholder, so an edit swapping one attachment for another would leave the description's captured text identical while what this review judged changed. Recompute it with .github/scripts/pr-description-capture.sh over the same inputs; if it differs, the description or that evidence changed after this verdict was formed and any finding drawn from either is unproven.

@github-actions

github-actions Bot commented Nov 11, 2026 •

Copy link
Copy Markdown
Contributor

Opus 5.5 Review — ✅ no blocking findings

Reviewed e4f0679f95317e132cc6c5026ae33791b27db85d — this comment is updated in place on each push.

Review details

No findings.

[OPUS-REVIEWED] e4f0679

Verdict parsed from the review's SHA-scoped output markers for commit e4f0679f95317e132cc6c5026ae33791b27db85d.

False positive or not applicable? A repository writer can comment:
/ai-review override fable e4f0679f95317e132cc6c5026ae33791b27db85d false-positive: <reason, 20 to 500 characters>

@github-actions

github-actions Bot commented Nov 11, 2026 •

Copy link
Copy Markdown
Contributor

GPT 6.1 Review — ✅ no blocking findings

GPT 6.1 completed its review of e4f0679f95317e132cc6c5026ae33791b27db85d and found no blocking issues.

This comment is updated in place on each push.

Review details

No findings.
[GPT-REVIEWED] e4f0679

False positive or not applicable? A repository writer can comment:
/ai-review override gpt e4f0679f95317e132cc6c5026ae33791b27db85d false-positive: <reason, 20 to 500 characters>

@KiroCrewCaptain

Copy link
Copy Markdown
Collaborator

Code change approver recommendation: A person should decide

Why: the decider raised 1 possible problem and estimates a 60% chance that this change introduces a defect; a person should check it.

The fix achieves its goal: an unreserved Webex approval is denied at once as approval_undeliverable, and delivered prompts are unaffected because the only Webex renderer reserves before sending. But the early return skips _notify_approval_stalled, which main reached for the same request after the window. An AutoNudge loop in a muted Webex conversation is therefore no longer held. It keeps firing and spends its whole budget on denied turns. The fix is one existing call plus a test.

Things to check (possible problems the decider raised; at this confidence many turn out to be fine):

  • In a muted Webex conversation with an active AutoNudge loop, main held the loop after its first unanswered/undelivered approval (the approval-hold mechanism from rfc-goal-loop-approval-hold.md). Now every interactive tool is denied at once with no stall notification, so the loop keeps firing and spe (src/kiro_crew/messaging/approval.py, medium)

An automated recommendation, not a review: a maintainer still decides. It approves on its own only when the estimated chance of a defect is at most 12% and the change has at most 400 changed lines. Decider v3c (217fe607) · commit 5977115764 · 114 changed lines. If this recommendation is wrong, reply here: replies are how the approver is evaluated.

@buluoray buluoray left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Request changes on 5977115. A Webex approval with no renderer reservation (muted turn, SilentRenderer) is now denied at once as approval_undeliverable instead of waiting 300 s. A delivered card always reserves synchronously before its send is awaited, so a slow but delivered card is unaffected. The new branch only returns False, and nothing it leaves behind can be resolved by a late click. Decisive lines: src/kiro_crew/messaging/approval.py:655-660, src/kiro_crew/webex/renderer.py:372-375, src/kiro_crew/messaging/driver.py:1307-1326, src/kiro_crew/messaging/dispatch.py:794

@bolichen97
bolichen97 force-pushed the fix/34404-webex-undelivered-approval branch from 5977115 to 33f50a7 Compare November 11, 2026 15:22
@bolichen97

Copy link
Copy Markdown
Contributor Author

self-added: yes
mechanism: the no-reservation early deny in PendingApprovals.decide_with_cause

  • Preserve the approval hold for muted Webex nudge loops span=ea11a7eeabe4

fixed in 33f50a7: the no-reservation branch calls _notify_approval_stalled(session_key) before it returns (False, approval_undeliverable), the same call the expired wait makes, so a Webex loop bound to a muted conversation is held instead of firing denied turns.
Pinned by test_messaging_approval.py::TestApprovalStallSignalling::test_an_undelivered_prompt_signals_autonudge, red with the call removed (assert [] == ['webex:agent:direct:a@b.com']).
The helper resolves through binding_key_for (inert for a key no loop binds to) and swallows every error, so the turn's denial and cause are unchanged.
[operator: bolichen97]

@bolichen97

Copy link
Copy Markdown
Contributor Author

[operator: bolichen97] Re the one item under "Things to check" (a muted Webex conversation's AutoNudge loop no longer held): right, and fixed in 33f50a7. The immediate undeliverable denial now calls _notify_approval_stalled, as the expired wait did, so the loop is held at once instead of after the window; test_messaging_approval.py::TestApprovalStallSignalling::test_an_undelivered_prompt_signals_autonudge pins it.

@bolichen97

Copy link
Copy Markdown
Contributor Author

[operator: bolichen97] @buluoray thanks for the review of 5977115. It requested changes without naming a line, so I took the one open defect on that head as the reason: the immediate undeliverable denial skipped _notify_approval_stalled, so an AutoNudge loop bound to a muted Webex conversation was no longer held (the GPT lane and the change approver raised the same). Fixed in 33f50a7, with test_messaging_approval.py::TestApprovalStallSignalling::test_an_undelivered_prompt_signals_autonudge. Could you take another look at that head? If you meant something else, point me at it and I will fix it.

@github-actions github-actions Bot added readiness: checking Automated validation is still running readiness: passed Eligible automated validation passed for the current revision and removed readiness: action required A blocking check or review needs attention readiness: checking Automated validation is still running labels Nov 11, 2026
@KiroCrewCaptain

Copy link
Copy Markdown
Collaborator

The review found nothing that blocks this PR on 33f50a7. It is waiting on one thing: the change request from buluoray was submitted on the earlier head 5977115 and is still open. It names no line. The one defect raised on that head was the skipped AutoNudge stall notification, and it is fixed on this head and pinned by test_an_undelivered_prompt_signals_autonudge. A re-review from buluoray is what this PR needs now.

What the review checked on this head:

  • decide_with_cause has one production caller, in the Webex dispatcher.
  • The driver renders the prompt before it calls the decider.
  • The Webex renderer reserves before it sends, so the new branch is reached only by a muted turn. It can only deny and leaves nothing a late click could resolve.
  • The two new tests bound their waits.
  • The messaging.md spec is updated in the same commit.

Security: this changes the approval decision path, but it only tightens it. A prompt that was never delivered is now denied at once instead of after the 300 s window. Nothing new is approved, and a delivered prompt behaves as before.

Done well: the fix applies the rule open_approval already documents ("no entry means no prompt was delivered") to the one registry that did not follow it. It keeps the AutoNudge hold by reusing _notify_approval_stalled.

Optional:

  • webex/renderer.py:363: the reservation now proves the prompt was delivered, but it only happens inside the rich_blocks card branch, while the text prompt always ships. Today that holds by static configuration. Consider reserving before every decider-backed prompt and attaching the card only under the gate, or pin it with a test.
  • No test drives a real WebexRenderer through the reservation. Each touched Webex test reserves by hand. So dropping the mint_approval_nonce kwarg at transport_dispatch.py:555, or reserving under the wrong scope, would deny every interactive Webex approval with no red test. One dispatch-level test that answers a real rendered prompt would cover it.
  • test_messaging_approval.py:743, the test named on the Proof line, awaits decide_with_cause with no time limit. With the fix reverted, the test hits the suite timeout before it reaches the assertion. Wrapping it in asyncio.wait_for(..., timeout=FALLBACK_TIMEOUT_SECS) like its siblings would make it fail cleanly.

@github-actions github-actions Bot added readiness: checking Automated validation is still running and removed readiness: passed Eligible automated validation passed for the current revision labels Nov 11, 2026
@bolichen97
bolichen97 force-pushed the fix/34404-webex-undelivered-approval branch from 33f50a7 to e33f955 Compare November 11, 2026 22:41
@bolichen97

Copy link
Copy Markdown
Contributor Author

[operator: bolichen97] Re the third optional item (the test on the Proof line awaited decide_with_cause with no time limit): right, fixed in e33f955. test_an_answered_unadopted_reservation_is_discarded_with_the_turn now sets APPROVAL_TIMEOUT_S to FALLBACK_TIMEOUT_SECS (60 s, under the 120 s --timeout). With the fix in place the request is denied before that window is read, so nothing changes. With the fix reverted, the wait ends after 60 s and the unchanged assertion fails by name (approval_timeout instead of approval_undeliverable), so the run is no longer lost. I chose this over a wait_for because a TimeoutError is not an assertion failure, and prove.py reports such a run as inconclusive rather than proven. Proof is re-recorded on this head. The other await pending.decide_with_cause( lines in the changed tests already run with the window patched to 0.01 s.

@bolichen97

Copy link
Copy Markdown
Contributor Author

[operator: bolichen97] Re the first optional item (webex/renderer.py:363: the reservation is made only inside the rich_blocks card branch, while the typed prompt always ships): rebutted, no change. There is one WebexRenderer, built at webex/transport_dispatch.py:538 with WEBEX_CAPABILITIES, whose rich_blocks=True is a constant (webex/transport.py:96), and that call always passes mint_approval_nonce (line 555). So every Webex prompt that is sent reserves before it is sent, and the branch this PR adds is reached only by a muted turn. Moving the reservation out of the card branch would change the renderer for a configuration no code builds, which is outside this fix's goal.

@bolichen97

Copy link
Copy Markdown
Contributor Author

[operator: bolichen97] Re the second optional item (no test drives a real WebexRenderer through the reservation): true, and left out of this fix on purpose, no change. The wiring such a test would pin is one lambda, mint_approval_nonce=lambda rid: _APPROVALS.reserve(approval_scope, rid) at webex/transport_dispatch.py:555, built in the same function, and with the same approval_scope, as the SessionApprovalDecider at line 524. This PR does not touch that wiring. The registry side (a reserved prompt resolves, an unreserved one is denied as undelivered) is pinned in test_messaging_approval.py, and a press against a reserved prompt by test_webex_dispatch_cards.py::TestApprovalCardPress. A dispatch-level test that feeds a provider permission request through a real rendered prompt would be new end-to-end scaffolding that guards against a future edit, not a defect in this change.

@github-actions github-actions Bot added readiness: action required A blocking check or review needs attention and removed readiness: checking Automated validation is still running labels Nov 11, 2026

@buluoray buluoray left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approve on e33f955. This supersedes our earlier change request on 5977115. That request rested on one point: the new immediate denial for a Webex approval that was never shown skipped the stall signal, so an AutoNudge loop bound to a muted Webex conversation kept firing and spent its budget on denied turns. That is fixed on this head. The no-reservation branch now signals the stall before it denies, the same call the expired wait makes. A new test pins it and turns red when the call is removed. The branch still only denies and leaves nothing a late click or typed reply could approve. A delivered card still reserves before it is sent, so it waits as before. Only the Webex registry changed; Slack, Discord, Teams and Telegram use their own deciders and are untouched. 224 targeted tests pass. The backend test lanes have since finished on this head; the only failing tests are the two that are already red on main. Decisive lines: src/kiro_crew/messaging/approval.py:655-662, src/kiro_crew/messaging/approval.py:690-714, src/kiro_crew/autonudge_service/timers.py:384-386, test/test_messaging_approval.py::TestApprovalStallSignalling::test_an_undelivered_prompt_signals_autonudge

@bolichen97
bolichen97 force-pushed the fix/34404-webex-undelivered-approval branch from e33f955 to 5e0f51a Compare November 12, 2026 05:31
@bolichen97

Copy link
Copy Markdown
Contributor Author

Rebased: main moved in src/kiro_crew/dashboard/handlers/updates.py and test/test_update_boot_apply.py since this head went green (f9788c5 -> 80cf3df); CI re-running.

The backend reds on e33f955 were main's own (test_wait_discipline_ratchet.py::test_the_scan_matches_known_sites and test_updates_handlers_facade.py::test_every_name_served_from_outside_the_family_is_visible_to_type_checkers, both red on main's run for ce89396), fixed on main by #35625. This PR's patch is unchanged by the rebase.

[operator: bolichen97]

@github-actions github-actions Bot added readiness: checking Automated validation is still running readiness: action required A blocking check or review needs attention and removed readiness: action required A blocking check or review needs attention readiness: checking Automated validation is still running labels Nov 12, 2026
A muted Webex conversation renders its turn with SilentRenderer, which
drops the approval prompt on purpose, so the renderer never reserves a
decision window for it. PendingApprovals.decide_with_cause then opened
a window of its own and waited the full approval window for an answer
nobody was asked for, on every tool call, before denying it as expired.

With no reservation it denies at once with approval_undeliverable, the
rule open_approval documents and TextReplyApprovalDecider follows, and
still tells AutoNudge the approval stalled, as the expired wait did, so
a loop bound to the muted conversation holds instead of spending its
cycles on denied turns. A delivered Webex prompt is always reserved by
its renderer before it is sent, so it is unaffected. Tests that drove
the registry without a reservation reserve first, the order production
uses.

Closes #34404
@bolichen97
bolichen97 force-pushed the fix/34404-webex-undelivered-approval branch from 5e0f51a to e4f0679 Compare November 12, 2026 15:29
@bolichen97

Copy link
Copy Markdown
Contributor Author

Rebased: main moved in test/test_cloud_launch_customize.py, test/test_approval_timeout_cause.py and docs/system-specs/modules/messaging.md since this head went green (80cf3df -> 5e7b587); CI re-running.

The red Backend Tests shard 2 (Linux and Windows) on 5e0f51a was test/test_cloud_launch_customize.py::TestAmiArchitectureCheck::test_matching_architecture_proceeds_to_deploy, red on main at 80cf3df as well and fixed on main by #35746; Coverage Gate failed closed behind it. The patch is unchanged (now e4f0679).

[operator: bolichen97]

@github-actions github-actions Bot added readiness: checking Automated validation is still running readiness: passed Eligible automated validation passed for the current revision and removed readiness: action required A blocking check or review needs attention readiness: checking Automated validation is still running labels Nov 12, 2026
@bolichen97
bolichen97 merged commit 6ded84f into main Nov 12, 2026
97 checks passed
@bolichen97
bolichen97 deleted the fix/34404-webex-undelivered-approval branch November 12, 2026 16:31
@github-actions github-actions Bot removed the readiness: passed Eligible automated validation passed for the current revision label Nov 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Webex: a muted conversation stalls every tool call for the full approval window, then denies

3 participants