Skip to content

fix(agent): acknowledge cloud messages before turn completion#3711

Closed
tatoalo wants to merge 1 commit into
mainfrom
posthog-code/async-agent-message-ack
Closed

fix(agent): acknowledge cloud messages before turn completion#3711
tatoalo wants to merge 1 commit into
mainfrom
posthog-code/async-agent-message-ack

Conversation

@tatoalo

@tatoalo tatoalo commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

Problem

Cloud task message delivery waits for the entire agent turn before responding. Long-running turns can outlive the sandbox tunnel request and appear to the caller as failed delivery even though the agent is working.

Changes

Add an opt-in asynchronous acknowledgement for user_message commands. The agent continues processing and reporting through the existing event stream while the command endpoint immediately confirms acceptance.

How did you test this?

  • Added an agent-server regression test that holds a turn open and verifies the command is acknowledged before completion.
  • Ran pnpm build:deps.
  • Ran pnpm --filter @posthog/agent exec vitest run src/server/agent-server.test.ts (148 tests passed).
  • Ran pnpm --filter @posthog/agent typecheck.
  • Ran Biome on the changed files.

Automatic notifications

  • Publish to changelog?
  • Alert Sales and Marketing teams?

Created with PostHog Code

Generated-By: PostHog Code
Task-Id: 7e2afcdb-b4f2-4a41-80a3-7e0d53b4abc3
@tatoalo tatoalo self-assigned this Jul 22, 2026
@trunk-io

trunk-io Bot commented Jul 22, 2026

Copy link
Copy Markdown

Merging to main in this repository is managed by Trunk.

  • To merge this pull request, check the box to the left or comment /trunk merge below.

After your PR is submitted to the merge queue, this comment will be automatically updated with its status. If the PR fails, failure details will also be posted here

@github-actions

Copy link
Copy Markdown

React Doctor found no issues in the changed files. 🎉

Reviewed by React Doctor for commit 6d43e7c.

@posthog

posthog Bot commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

👋 Visual changes detected for this PR.

Review and approve in PostHog Visual Review

If these changes are unexpected, they may be caused by a flaky test or a broken snapshot on master. Don't approve — rerun the job or wait for a fix.

tatoalo commented Jul 22, 2026

Copy link
Copy Markdown
Contributor Author

not needed

@tatoalo tatoalo closed this Jul 22, 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.

1 participant