You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Bug]: Fresh-runtime denied ConfirmResult leaves the session stuck in PERMISSION_ASKING #3619
When an agent turn suspends on a permission question, the ASKING state is persisted in AgentState and survives a process restart — that part is great.
On a fresh runtime (post-restart, no live suspended stream):
Resuming with an approvedConfirmResult continues the tool call correctly — the session exits PERMISSION_ASKING.
Resuming with a deniedConfirmResult does not exit PERMISSION_ASKING. The denial is consumed (or dropped), but the session keeps reporting the same pending question, so the next user message still sees the agent as waiting on a decision that was already given.
In other words: durable approval continuation works; durable denial continuation does not.
Why it matters
Deny is a first-class decision. A host that restart-recovers pending approvals (from AgentState ASKING + the stored tool-call/reply identity) can safely resume approvals, but must special-case denials — and today there is no official path that both consumes the denial and terminates the asking state. The result is either a stuck session (must be abandoned) or a hand-rolled state edit that fights the runtime's ownership of AgentState.
This was previously reported for same-process denials in #3097 (denied tool calls emitted no tool-result events) — this is the fresh-runtime counterpart.
Requested seam
A typed continuation path where a denied ConfirmResult on a fresh runtime:
Validates against the persisted ASKING record (reply identity + tool-call ids),
Transitions the session out of PERMISSION_ASKING so normal input resumes.
We track this upstream-gated as SCHEDULER_HITL_DENIAL_RECOVERY; our host-side workaround (denial replay through the persisted-ASKING continuation path) is documented for removal once the seam lands.
I'd like to take this issue.
I traced it on main (b5159827f) to two coupled gaps in ReActAgent.CallExecution:
applyConfirmResults() transitions approved ToolUseBlocks out of ToolCallState.ASKING (ALLOWED), but leaves denied ToolUseBlocks in ToolCallState.ASKING in persisted AgentState.context.
askingToolCalls() filters lastAssistantMessage solely by ToolCallState.ASKING without checking MessageUtils.pendingToolUseIds(...), so denied calls can remain reported as PERMISSION_ASKING across fresh-runtime recovery, stop-on-denial middleware, partial denial, or mixed deny + external suspension.
I plan to submit a surgical fix updating denied ToolUseBlock state in applyConfirmResults(), adding pending-ID filtering in askingToolCalls() for defense in depth (including legacy persisted states), and adding offline JUnit 5 regression tests across AgentStateStore and ThreadJournalStore. Let me know if it's still open for a PR.
Activity
fix(core): 在发布授权请求前持久化暂停状态 (#3699)
Shawrange commentedon Nov 22, 2026
I'd like to take this issue.
I traced it on
main(b5159827f) to two coupled gaps inReActAgent.CallExecution:applyConfirmResults()transitions approvedToolUseBlocks out ofToolCallState.ASKING(ALLOWED), but leaves deniedToolUseBlocks inToolCallState.ASKINGin persistedAgentState.context.askingToolCalls()filterslastAssistantMessagesolely byToolCallState.ASKINGwithout checkingMessageUtils.pendingToolUseIds(...), so denied calls can remain reported asPERMISSION_ASKINGacross fresh-runtime recovery, stop-on-denial middleware, partial denial, or mixed deny + external suspension.I plan to submit a surgical fix updating denied
ToolUseBlockstate inapplyConfirmResults(), adding pending-ID filtering inaskingToolCalls()for defense in depth (including legacy persisted states), and adding offline JUnit 5 regression tests acrossAgentStateStoreandThreadJournalStore. Let me know if it's still open for a PR.