Skip to content

ref(slack): move Turn orchestration to provider layer - #1567

Merged
dcramer merged 1 commit into
mainfrom
codex/unify-turn-lifecycle
Aug 25, 2026
Merged

dcramer merged 1 commit into
mainfrom
codex/unify-turn-lifecycle

Conversation

@dcramer

@dcramer dcramer commented Aug 14, 2026 •

Copy link
Copy Markdown
Member

This is the first small slice of #1563. It moves the current Slack Turn
orchestration out of the native runtime namespace without changing product
behavior.

What changed

  • Move Slack event routing from chat/runtime/slack-runtime.ts to
    chat/providers/slack/runtime.ts.
  • Move the existing reply executor to chat/providers/slack/turn.ts and name
    its entry point createSlackTurn.
  • Name the dispatch capability executeSlackTurn.
  • Document chat/providers/slack as the concrete provider layer and
    chat/slack as the low-level Slack adapter.
  • Add a dependency rule that prevents the native agent runtime and shared
    services from importing provider layers.

Deliberate boundary

This pull request adds no provider registry, generic adapter framework, or new
interface hierarchy. It changes ownership and names only.

It does not extract native Turn execution. It does not change the Conversation
API, IDs, mailbox routing, recovery, local CLI, dispatch behavior, Slack reply
behavior, or child-agent behavior.

The existing replyExecutor service override remains because it currently
contains native agent services as well as Slack services. A later slice will
separate those dependencies when Slack calls the provider-neutral Turn
contract.

Part of #1563.

@vercel

vercel Bot commented Aug 14, 2026 •

Copy link
Copy Markdown

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

Project Deployment Actions Updated (UTC)
junior-docs Ready Ready Preview Aug 25, 2026 1:01am

Request Review

@dcramer
dcramer marked this pull request as ready for review August 14, 2026 18:51
@github-actions github-actions Bot added the risk: high PR risk score: high label Aug 14, 2026
@dcramer
dcramer force-pushed the codex/unify-turn-lifecycle branch from a7c647a to aa1a216 Compare August 14, 2026 19:08

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit fb072e0. Configure here.

@dcramer dcramer left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

There are a lot of web specific behaviors but web is just our native agent. It's the baseline. Slack is layered on top.

} from "@/chat/task-execution/store";
import type { ConversationWorkQueue } from "@/chat/task-execution/queue";

const webMailboxKindSchema = z

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Why not "web"

actorEmail: string;
idempotencyKey: string;
}): string {
return `local:web:${stableHex(

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

We shouldn't need a web specific conversation ID. It should simply generate a GUID.

Slack has a prefix but that should be considered legacy and we'll want to be able to look up a conversation associated with a Slack ID without it having a deterministic ID.

)}`;
}

function webMessageId(args: {

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Same here what's with this odd message key format

}

/** Build the stable Turn id for one web mailbox message. */
export function webTurnIdForMessage(messageId: string): string {

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Useless junk Java wrapper function

}

/** Build one stable Run id for a web Turn attempt. */
export function webRunIdForTurn(turnId: string, startedAtMs: number): string {

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Same here why aren't we just using GUIDs

return `web-run:${stableHex(turnId, String(startedAtMs))}`;
}

function requireLocalDestination(conversationId: string): LocalDestination {

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

What's this have to do with the core runtime or web

/** Restore a web Actor from validated mailbox metadata. */
export function actorFromMetadata(metadata: WebMailboxMetadata): WebActor {
return {
platform: "web",

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I think here there is either no platform or its native or something. Web is irrelevant.

@dcramer
dcramer force-pushed the codex/unify-turn-lifecycle branch from fb072e0 to 2914988 Compare August 25, 2026 00:19
@github-actions github-actions Bot added risk: medium PR risk score: medium and removed risk: high PR risk score: high labels Aug 25, 2026
@dcramer dcramer changed the title ref(chat): use one native agent turn path ref(slack): name the Slack Turn owner Aug 25, 2026
@dcramer
dcramer force-pushed the codex/unify-turn-lifecycle branch from 2914988 to 333a4d9 Compare August 25, 2026 00:24
@dcramer dcramer changed the title ref(slack): name the Slack Turn owner ref(slack): move Turn orchestration to provider layer Aug 25, 2026
@dcramer
dcramer force-pushed the codex/unify-turn-lifecycle branch from 333a4d9 to 4c9ff22 Compare August 25, 2026 01:00
@dcramer
dcramer merged commit 75112ed into main Aug 25, 2026
42 of 44 checks passed
@dcramer
dcramer deleted the codex/unify-turn-lifecycle branch August 25, 2026 01:50
MathurAditya724 added a commit that referenced this pull request Nov 12, 2026
…#3284)

Fixes two stale references. No behavior change.

- `packages/junior/src/build/rolldown-workarounds.ts`: replace the
placeholder `nitrojs/nitro/issues/XXXX` link with the real issue,
nitrojs/nitro#4085. The TODO now names an owner and a removal condition,
per `policies/code-comments.md`. nitrojs/nitro#4164 removed the
allowlist upstream, and the oldest Nitro version that Junior supports
(`3.0.260415-beta`) includes that fix. So the override can probably go,
but this PR does not remove it. That needs a production build check that
pi-ai providers still register without it.
- `.agents/skills/vercel-sandbox/SOURCES.md`: #1567 removed
`chat/runtime/reply-executor.ts`. The row now points at
`chat/providers/slack/turn.ts` and
`chat/task-execution/conversation-turn.ts`, which save each new sandbox
ref through `onSandboxRefChanged`. This matches `SKILL.md` and
`references/api-surface.md`. The old "success-path only" description was
also stale, so it is replaced.

<!-- junior-request-attribution:start -->
via @MathurAditya724.
<!-- junior-request-attribution:end -->

<!-- junior-session-footer:start -->
<!-- junior-conversation-id:agent%3A1704862f6367434a6de8ff84bf6d5be1 -->

--

[View
Session](https://junior-prod.sentry.dev/conversations/agent%3A1704862f6367434a6de8ff84bf6d5be1)
[[Sentry]](https://sentry.sentry.io/explore/conversations/agent%3A1704862f6367434a6de8ff84bf6d5be1/?project=4510944073809921)

<!-- junior-session-footer:end -->

Co-authored-by: sentry-junior[bot] <264270552+sentry-junior[bot]@users.noreply.github.com>
Co-authored-by: Aditya Mathur <[email protected]>

This branch was successfully deployed

1 active deployment
Preview – junior-docs — 4c9ff226 Deployed Aug 25, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

risk: medium PR risk score: medium

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant