Skip to content

fix(agent): keep interruption feedback until it can be applied - #222

Merged
yuluo-yx merged 1 commit into
agentic-ai-java:mainfrom
Duansg:fix/agent-interruption-feedback
Oct 23, 2026
Merged

yuluo-yx merged 1 commit into
agentic-ai-java:mainfrom
Duansg:fix/agent-interruption-feedback

Conversation

@Duansg

@Duansg Duansg commented Oct 22, 2026

Copy link
Copy Markdown
Contributor

Describe what this PR does / why we need it

Contributing to ARGI: interruption feedback is no longer lost when InterruptionHook runs while the last assistant message still has pending tool calls.

Does this pull request fix one issue?

Fixes #211

Describe how you did it

  • The hook reads the feedback without removing it, validates it, and only claims it with remove(key, value) when it is applied.
  • With pending tool calls, valid feedback stays pending and is applied on the next model pass. Invalid feedback is discarded with a warning and never replayed.
  • If newer feedback is written between read and claim, the conditional remove fails, the older value is not applied and the newer one is kept. The single-slot "latest value" semantics are unchanged.

Describe how to verify it

./mvnw -pl :argi-agent-framework -am test (1388 tests pass). New InterruptionHookTest cases cover deferral and single application, invalid feedback with pending tool calls, and a latch-controlled concurrent write; the deferral and concurrency cases fail on the previous implementation.

Special notes for reviews

Cleanup of ReactAgent.threadIdStateMap entries is out of scope and can be a follow-up. This only covers the in-process feedback path, not persistent approvals (#130).

@yuluo-yx yuluo-yx left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Reviewed deferred feedback handling and conditional consumption with concurrent replacement tests. The frontend dependency audit failure is independent of this fix.

@yuluo-yx
yuluo-yx merged commit a2b92f5 into agentic-ai-java:main Oct 23, 2026
6 of 7 checks passed
@Duansg
Duansg deleted the fix/agent-interruption-feedback branch October 23, 2026 01:34
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.

[BUG][OPT-20] 避免人工反馈在不可处理时提前消费并丢失

2 participants