Repository navigation
Closed
Labels
Description
Objective
Run new and resumed asynchronous turns through one conversation-owned worker workflow under the existing mailbox and lease.
This is not an exercise in designing a generic runtime API. The boundary should emerge by consolidating the two real Slack paths while preserving behavior, then be proven by agent-dispatch in #882.
Current state
processConversationWorkalready owns mailbox, lease, check-in, yield, redelivery, and wake recovery.AgentRunneralready owns agent execution and resumable session-record mechanics.- New Slack turns use
SlackTurnRuntime+reply-executor.ts. - Resumed turns re-enter the same queue but use
agent-continue-runner.ts+slack-resume.tsfor a separate restoration, outcome, delivery, and terminalization lifecycle.
Scope
- Reduce the signed queue wake payload to
conversationId; destination and source are loaded from durable conversation work rather than supplied by the queue callback. - Add one worker decision loop that, under the conversation lease, either resumes the active durable turn or starts the next mailbox turn.
- Route authorization completion back through conversation work: OAuth callbacks persist the completed authorization attempt and send a wake-up hint instead of calling the agent resume lifecycle directly.
- Share durable restoration,
AgentRunnerrequest construction, outcome handling, completion ordering, and terminalization between new and resumed work where their behavior is actually the same. - Keep provider concerns in Slack-owned code: message/thread parsing, installation hydration, actor lookup, status/reactions, authorization UX, formatting, and reply delivery.
- Keep
conversationId,turnId, actor, credential subject, destination, source, model/reasoning configuration, artifacts, sandbox state, and history explicit across slices. - Preserve steering/defer behavior when new mailbox input arrives while a turn is resumable or active.
- Make input handling explicit enough to preserve the current distinction between steerable Slack messages and ordered future work; do not treat every pending mailbox item as active-turn steering.
- Preserve completion policy differences without separate lifecycles: interactive auth pause versus non-interactive blocking, Slack no-reply versus required visible output, and provider reply versus future internal result delivery.
- Establish one delivery fence rule: after the completion target accepts output, retries may repair durable state but cannot deliver again.
- Keep local CLI synchronous.
Completion
- One leased worker path chooses start versus resume for Slack conversations.
- Queue wake payloads contain only
conversationId, and stale or forged callback data cannot change durable routing. - Initial and resumed slices use the same turn restoration and outcome/terminalization rules.
- OAuth completion cannot execute an agent slice outside the conversation lease.
- Slack-specific code is limited to provider input, UX, and delivery responsibilities.
- Timeout, cooperative yield, auth pause, no-reply, success, recoverable failure, and terminal failure preserve current durable behavior.
- Ordered mailbox work is not accidentally injected as steering into the active turn.
- Post-delivery persistence failure remains repairable without producing a duplicate reply/result.
- Queue redelivery, stale session versions, duplicate wakes, and hard-worker recovery cannot advance or deliver a turn twice.
- Model profile, reasoning, actor, authority, artifacts, sandbox, and history survive continuation.
- The separate Slack continuation lifecycle is deleted or reduced to provider adaptation with no independent turn ownership.
- Integration coverage proves new turn, timeout resume, yield resume, auth resume, worker recovery, duplicate wake, and delivery fencing.
Non-goals
- Designing bindings, invocations, child conversations, or model-facing tools.
- Migrating
agent-dispatch; Migrate agent dispatch onto the conversation worker #882 is the immediate second-consumer proof. - Creating public abstraction layers that have only one consumer.
Implementation checkpoints
Each checkpoint should be independently mergeable and behavior-preserving. Do not start the next checkpoint by introducing abstractions that the current checkpoint does not need.
1. Conversation-id wake-up
- Add an owning runtime schema for the queue payload and infer its TypeScript type from that schema.
- Remove destination from queue producers, signatures, callbacks, and worker inputs; queue messages carry only
conversationId. - Load destination and routing from durable conversation work after callback verification.
- Switch readers and writers together. Vercel push queues are partitioned by deployment and deliver messages to the same deployment that published them, so old deployments drain their old payloads while the new deployment uses the new contract.
- Keep first-contact ingress responsible for atomically establishing or validating the durable conversation route when it appends the first mailbox item.
- Update queue, signature, callback, heartbeat, and worker tests before changing turn behavior.
2. One leased Slack decision loop
- Under the acquired conversation lease, inspect durable active-turn/session state first.
- Resume valid active work; otherwise start the next pending mailbox input.
- Preserve the existing input-commit rule: durably checkpoint the prompt and any required active-task reference before acknowledging the mailbox item.
- Preserve the current rules for a pending Slack message that may steer, must defer, or starts a later turn.
- Do not choose resume behavior from
conversation.sourcealone; resource-event conversations already use Slack execution behavior. - Treat completed authorization as durable state that makes the active turn runnable; the callback wakes the conversation and the leased worker performs the resume.
3. Consolidate Slack start/resume ownership
- Move only behavior proven identical by the two paths: durable restoration,
AgentRunnerrequest materialization, session outcomes, delivery fencing, and terminalization. - Leave Slack provider hydration, status/reactions, auth UX, formatting, backfill, attachments, and delivery in Slack-owned modules.
- Delete the independent continuation lifecycle only after focused parity tests pass.
- Remove direct
resumeSlackTurn/resumeAuthorizedRequestexecution from OAuth handlers after queue-driven auth resume parity is proven.
Validation map
- Queue payload, idempotency, lease, wake, stale delivery, and recovery behavior:
tests/component/task-execution/conversation-work.test.tsandtests/component/vercel-queue-dev.test.ts. - Slack mailbox reconstruction, ack, steering, defer, and worker-result behavior:
tests/component/task-execution/slack-conversation-work.test.ts. - Timeout/yield session-record mechanics:
tests/integration/runtime/agent-run-agent-continue.test.ts. - Slack automatic continuation, hard-worker recovery, actor restoration, and delivery fencing:
tests/integration/agent-continue-slack.test.ts. - OAuth status, auth re-pause, reply formatting, and failure behavior:
tests/integration/oauth-resume-slack.test.tsplus the OAuth handler unit tests. - Missing-wake and expired-lease repair:
tests/integration/heartbeat.test.ts.
Activity
feat(runtime): Add durable conversation execution profiles
fix(runtime): Preserve local config and resume reasoning
ref(runtime): Make execution policy flow explicit
fix(runtime): Preserve allowed deferred tool dispatch
feat(runtime): Add durable conversation execution profiles
fix(runtime): Preserve local config and resume reasoning
ref(runtime): Make execution policy flow explicit
fix(runtime): Preserve allowed deferred tool dispatch
ref(runtime): Store execution policy in typed columns
ref(runtime): Store execution profile in typed columns
docs(runtime): Clarify execution profile terminology
fix(reporting): Preserve turn starting model
fix(reporting): Preserve turn starting model
18 remaining items
[-]Extract a conversation-neutral turn runtime[/-][+]Unify new and resumed turns in the conversation worker[/+]dcramer commentedon Jul 23, 2026
Checkpoint 1 reader-side implementation is now complete locally: queue contracts are runtime-schema-owned, verification accepts signed v1 destination-bearing payloads and signed v2 conversation-id-only wakes, callback/worker code normalizes both to
conversationId, and the worker loads destination from persisted conversation work. Production queue writers intentionally remain on v1 for the expand-first rollout. Typecheck and targeted lint pass; 113 queue/work, Slack worker, steering, and heartbeat tests pass. The checkpoint should not be marked complete until the dual reader is deployed before switching writers.ref(queue): Use conversation IDs in callbacks
dcramer commentedon Jul 23, 2026
Correction to the earlier reader-first rollout note: Vercel push queue messages are deployment-scoped and are delivered to the same deployment that published them. Production uses the deployment-aware QueueClient default, so there is no old-reader/new-writer overlap to protect here. PR #1019 now switches producers and consumers to the conversation-ID-only payload together and removes the compatibility layer.
ref(queue): Use conversation IDs in callbacks
ref(queue): Use conversation IDs in callbacks
ref(queue): Use conversation IDs in callbacks (#1019)
ref(runtime): Resume parked turns in conversation worker
ref(runtime): Resume parked turns in conversation worker
ref(runtime): Resume parked turns in conversation worker
ref(runtime): Run conversation work under one lease
ref(runtime): Run conversation work under one lease
ref(runtime): Run conversation work under one lease
ref(runtime): Continue paused work in the same worker (#1023)