Repository navigation
refactor(slack): drive progress drafts through the shared compositor - #109336
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 281f1c0c24
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| onReasoningEnd: onDraftBoundary, | ||
| onReasoningEnd: async () => { | ||
| progressReceipt.closeReasoning(); | ||
| await onDraftBoundary?.(); |
There was a problem hiding this comment.
Reset Slack reasoning state between bursts
When Slack is in progress/status-final mode, onReasoningEnd now only closes the receipt and delegates to onDraftBoundary, but that boundary calls beginNewProgressTurn() which returns false until a final reply has started or delivered. For separate reasoning items in one turn, such as onReasoningStream("<think>First</think>"), onReasoningEnd(), then onReasoningStream("<think>Second</think>"), the compositor's reasoning buffer is not reset, so the next burst is appended to the previous buffer (rendering stale/concatenated text like FirstSecond) instead of starting a fresh reasoning row as before. Reset the compositor's reasoning state on reasoning end before relying on the draft boundary.
Useful? React with 👍 / 👎.
281f1c0 to
6cd3582
Compare
Slack's status_final progress path now uses the shared channel compositor (preamble headline, reasoning, tools, plan checklist, commentary arbitration) instead of its hand-rolled gate/merge/render pipeline, and native task cards consume compositor snapshots with stable row identity (line ids first, fixed reasoning id, occurrence-suffixed content hashes). Finals in progress mode post as fresh messages that follow the draft's thread; the working draft then collapses into a compact activity receipt, while failed or error finals leave the draft as the turn record. The rotating native loading messages are gone in favor of the plain typing status. Queued and assistant-boundary turns re-arm with clean delivery state, and native completion status survives transient append failures.
6cd3582 to
6b371ce
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 6b371ce96e
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| .trim(); | ||
| return { | ||
| // Reasoning snapshots replace one rolling row; text-based ids would orphan it each delta. | ||
| ...(reasoning ? { id: "reasoning" } : {}), |
There was a problem hiding this comment.
Give native reasoning rows unique ids
When native Slack progress sees more than one reasoning burst separated by a tool call, the compositor intentionally keeps multiple 🧠 lines, but this mapper assigns every one the same reasoning id. The native task builder treats explicit ids as stable and does not occurrence-suffix them, so it emits multiple task_update chunks with the same Slack task id; because Slack task rows are keyed by id, the earlier reasoning row is overwritten/cannot be retired instead of appearing in arrival order.
Useful? React with 👍 / 👎.
| renderProgressDraft(); | ||
| const pushPlanProgress = async (steps?: AgentPlanStep[], explanation?: string) => { | ||
| if (streamMode === "status_final") { | ||
| await progressDraft.pushPlanProgress(steps, { explanation }); |
There was a problem hiding this comment.
Schedule preamble expiry for plan explanations
In status-final Slack progress, a preamble followed by a plan update with an explanation before the preamble ages out now stores that explanation only through the compositor. The compositor's expiry refresh is scheduled only when narrationText exists, not when planExplanation exists, so if no later progress event arrives the draft/native title remains the stale preamble after PROGRESS_STATUS_PREAMBLE_FRESH_MS instead of switching to the plan explanation.
Useful? React with 👍 / 👎.
|
Merged via squash.
|
…penclaw#109336) * test(slack): drop rotating loading-message fixture expectations * refactor(slack): drive progress drafts through the shared compositor Slack's status_final progress path now uses the shared channel compositor (preamble headline, reasoning, tools, plan checklist, commentary arbitration) instead of its hand-rolled gate/merge/render pipeline, and native task cards consume compositor snapshots with stable row identity (line ids first, fixed reasoning id, occurrence-suffixed content hashes). Finals in progress mode post as fresh messages that follow the draft's thread; the working draft then collapses into a compact activity receipt, while failed or error finals leave the draft as the turn record. The rotating native loading messages are gone in favor of the plain typing status. Queued and assistant-boundary turns re-arm with clean delivery state, and native completion status survives transient append failures.
…penclaw#109336) * test(slack): drop rotating loading-message fixture expectations * refactor(slack): drive progress drafts through the shared compositor Slack's status_final progress path now uses the shared channel compositor (preamble headline, reasoning, tools, plan checklist, commentary arbitration) instead of its hand-rolled gate/merge/render pipeline, and native task cards consume compositor snapshots with stable row identity (line ids first, fixed reasoning id, occurrence-suffixed content hashes). Finals in progress mode post as fresh messages that follow the draft's thread; the working draft then collapses into a compact activity receipt, while failed or error finals leave the draft as the turn record. The rotating native loading messages are gone in favor of the plain typing status. Queued and assistant-boundary turns re-arm with clean delivery state, and native completion status survives transient append failures.
What Problem This Solves
Slack was the last channel with a hand-rolled progress-draft pipeline: ~400 lines in
dispatch.tsre-implementing the gate, tool-line merging, reasoning normalization, preamble routing, and plan snapshot state that Discord and Telegram already get from the shared compositor — with drift (preambles rendered as interleaved 💬 lines instead of the status headline;% 4partial sampling; duplicated reasoning-merge helpers). Slack also edited the working draft into the final answer, which posts no new message (nothing re-notifies thread followers — the same reason Discord explicitly sends finals fresh), and it rotated four hardcoded "Reading the thread..." loading messages through the native status.Why This Change Was Made
status_finalpath now usescreateChannelProgressDraftCompositor— preamble headline, reasoning lane, tool lines, plan checklist, and commentary arbitration behave identically to Discord/Telegram, and the duplicated Slack-local logic is deleted. Native task cards consume compositor snapshots (new read-onlygetSnapshot()), with a settled row-identity scheme: compositor line ids first, a fixed id for the rolling reasoning row, occurrence-suffixed content hashes last (stable across rolling-window shifts and duplicate-count transitions).🧠 2 thoughts · 🛠️ 5 tool calls · ⏱️ 42s, via a shared receipt tracker generalized from Discord's counters). Failed or error finals leave the draft untouched as the record of the turn.Partial/block modes keep their existing final behavior; the narrator, Discord/Telegram, and all config surfaces are untouched. Slack production LOC is net-negative despite the added behavior.
User Impact
In Slack progress mode the working draft reads like Discord/Telegram (agent-authored headline over the live checklist and activity), the final answer arrives as a fresh message in the same thread — so followers actually get notified — and the draft settles into a one-line activity receipt instead of being overwritten. The four fake rotating status messages are gone. Opt-ins (
progress.commentary,toolProgress,nativeTaskCards,render: "rich",commandText) keep their documented behavior.Evidence
dispatch.preview-fallback(120),progress-blocks(31),stream-mode+streaming+monitor.tool-result, compositor (35), channel streaming — 246 green in the final run; fulltsgo0 errors; oxlint shards clean; SDK surface gate green (budget notes inscripts/plugin-sdk-surface-report.mjs).