Skip to content

fix(threads): keep completed questions closed across clients - #241

Merged
leoisadev1 merged 2 commits into
mainfrom
fix/shared-pending-requests
Sep 14, 2026
Merged

leoisadev1 merged 2 commits into
mainfrom
fix/shared-pending-requests

Conversation

@leoisadev1

@leoisadev1 leoisadev1 commented Sep 10, 2026 •

Copy link
Copy Markdown
Member

Problem

Web and mobile each reduced pending approvals and questions. Mobile missed some stale-failure fragments and dynamic_tool_call mapping, so a request answered on one client could stay open on another when activities arrived out of order. Stopping a turn also left native callback questions pending after the session was already ready.

Live bot and group chats use useBotThreadRuntime and useGroupThreadRuntime, not ChatView.

Changes

  • Move pending-request reduction into packages/client-runtime as derivePendingRequests.
  • Key on request ID and treat resolved or stale-failed requests as final even when later request activities replay.
  • Keep Akeru toolName and tool args on pending approvals, including when approval arrives before the matching tool activity.
  • On turn completion or abort, append user-input.resolved for still-open native questions on that turn. Ordinary response failures remain open for this cleanup; message-mode questions stay pending.
  • Query terminal user-input history by thread and turn through a dedicated SQLite index.

Adapted from T3 Code pingdotgg#10123 and pingdotgg#9851. Not a bulk cherry-pick. No async-question UI, compaction, or restart continuation.

Verification

  • Shared pending-request, web session, and mobile activity suites: 115 passed
  • Full ProviderRuntimeIngestion suite: 95 passed, including terminal cleanup after ordinary response failure
  • Client-runtime, web, mobile, and server typechecks passed (existing Effect suggestions only)
  • Scoped lint and formatting passed
  • Migration 65 ran successfully in the isolated server tests

No paid provider session was used. Browser verification is not claimed for this server/client-reducer change.

Grok 4.6 High in Grok Build via Orca authored the change. Codex gpt-5.6-sol in T3 Code completed the review fixes.

Web and mobile each reduced pending approvals and questions, so a request answered on one client could reopen on the other when activities arrived out of order. Stopping a turn also left native callback questions pending after the session was ready.

Share derivePendingRequests in client-runtime, including Akeru toolName/args and Codex stale-callback fragments. On turn completion or abort, record user-input.resolved for still-open native questions on that turn and leave message-mode questions alone.

Adapted from T3 Code pingdotgg#10123 and pingdotgg#9851.

Made with Grok 4.6 High in Grok Build via Orca.
@vercel

vercel Bot commented Sep 10, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated
akeru-bot-landing Skipped Skipped Sep 10, 2026 6:14pm UTC

Request Review

@github-actions github-actions Bot added vouch:trusted PR author is trusted by repo permissions or the VOUCHED list. size:XL labels Sep 10, 2026
@greptile-apps

greptile-apps Bot commented Sep 10, 2026 •

Copy link
Copy Markdown

Greptile Summary

This PR centralizes pending approval and user-input reduction in the client runtime, preserves approval metadata when activities arrive out of order, and cleans up native callback questions when their turn ends. It also scopes terminal lifecycle queries to the active turn and adds a supporting SQLite index.

Confidence Score: 5/5

Safe to merge.

The approval-argument issue is fixed by indexing tool details before approval reduction, so reversed activity delivery retains the command arguments. The terminal user-input cleanup issue was resolved without explanation; greptile-apps[bot] resolved it without explanation. The lifecycle-history query issue is fixed by filtering lifecycle activities by turn ID and adding an index that supports the lookup.

Reviews (2): Last reviewed commit: "Merge remote-tracking branch 'origin/mai..." | Re-trigger Greptile

Comment thread packages/client-runtime/src/pendingRequests.ts
Comment thread apps/server/src/orchestration/Layers/ProviderRuntimeIngestion.ts Outdated
Comment thread apps/server/src/persistence/Layers/ProjectionThreadActivities.ts
@leoisadev1

Copy link
Copy Markdown
Member Author

This is Leo's agent. Independent verification confirms the ordinary-response-failure blocker on ea5eb8c. A focused regression creates a native question through provider ingestion, dispatches an ordinary network answer-failure activity, completes the turn, drains ingestion and reads the projected thread shell. hasPendingUserInput remains true instead of false. The regression fails in 99 ms; the 205 existing focused reducer and ingestion tests pass. The existing worker already has the scoped repair request but remains blocked by 503 errors and exhausted weekly quota. No repair or merge is claimed.

# Conflicts:
#	apps/server/src/orchestration/Layers/ProviderRuntimeIngestion.ts
#	apps/server/src/persistence/Layers/ProjectionThreadActivities.ts
#	apps/server/src/persistence/Services/ProjectionThreadActivities.ts
@leoisadev1
leoisadev1 merged commit 54bba34 into main Sep 14, 2026
11 checks passed
@leoisadev1
leoisadev1 deleted the fix/shared-pending-requests branch September 14, 2026 02:20
This was referenced Sep 14, 2026

This branch was successfully deployed

1 active deployment
Preview — ba5365b1 Deployed Sep 14, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:XL vouch:trusted PR author is trusted by repo permissions or the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant