Skip to content

Deliver classic (non-durable) tool approvals across server instances…#3403

Merged
inkeep-oss-sync[bot] merged 1 commit into
mainfrom
copybara/sync
Jun 22, 2026
Merged

Deliver classic (non-durable) tool approvals across server instances…#3403
inkeep-oss-sync[bot] merged 1 commit into
mainfrom
copybara/sync

Conversation

@inkeep-oss-sync

Copy link
Copy Markdown
Contributor

Deliver classic (non-durable) tool approvals across server instances via a shared decision store, fixing approvals lost when the response lands on a different instance than the one running the agent

* fix: deliver classic tool approvals across server instances

Classic (non-durable) agents kept a pending tool approval in the memory of the single instance running the agent. In multi-instance production the approval response often hit a different instance with no record of it, so it was dropped and the agent timed out after 10 minutes.

When an approval lands on an instance that isn't holding it, persist the decision to a new tool_approval_decisions table; the instance running the agent polls and consumes it. Same-instance approvals still resolve in memory. Includes the table, migration, cleanup, and a cross-instance test.

* fix: harden cross-instance tool approval per review feedback

- Guard the approval poll with an in-flight flag so DB latency can't stack one query per second per approval and exhaust the connection pool.
- Use Promise.allSettled for the approval batch so one failed DB write reports per-toolCallId instead of 500-ing the whole batch.
- Add a settled flag set synchronously on resolve, checked before the destructive DB consume, and re-record the decision if it was consumed after the approval already settled (closes the timeout/poll TOCTOU).
- Pass an empty conversationId instead of 'unknown' so the poll guard disables rather than querying an id that never matches.
- Convert waitForApproval to a single options argument (7 positional params).
- Log full error objects in the poll catch to preserve stack traces.
- Run the two cron cleanups independently so one failure doesn't skip the other.
- Add a cross-instance denial test covering reason propagation.

* fix: distinct log for approval re-record failure

The re-record after a post-settle consume shared the poll's outer catch, so a re-record (write) failure was logged as a poll (read) failure. Wrap it in its own try/catch with a distinct error log.

* chore: add conversationId to cross-instance delivery log

Makes the delivery log self-contained for triage correlation by conversationId.

GitOrigin-RevId: 1f0279996b4055a67695b1fbc5e875f8e1ed6a9d
@inkeep-oss-sync inkeep-oss-sync Bot enabled auto-merge June 22, 2026 20:26

@inkeep-internal-ci inkeep-internal-ci Bot 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.

Automated approval from agents-private public-mirror-sync (run: https://github.com/inkeep/agents-private/actions/runs/27981387577). Source of truth is the monorepo; direct edits on inkeep/agents are overwritten on next sync.

@inkeep-oss-sync inkeep-oss-sync Bot added this pull request to the merge queue Jun 22, 2026
@changeset-bot

changeset-bot Bot commented Jun 22, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: bb8e61b

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 10 packages
Name Type
@inkeep/agents-core Patch
@inkeep/agents-work-apps Patch
@inkeep/ai-sdk-provider Patch
@inkeep/create-agents Patch
@inkeep/agents-api Patch
@inkeep/agents-manage-ui Patch
@inkeep/agents-cli Patch
@inkeep/agents-email Patch
@inkeep/agents-mcp Patch
@inkeep/agents-sdk Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Merged via the queue into main with commit 44410c6 Jun 22, 2026
5 checks passed
@inkeep-oss-sync inkeep-oss-sync Bot deleted the copybara/sync branch June 22, 2026 20:26
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.

1 participant