Skip to content

fix(slack): Attribute current instructions by author - #772

Merged
dcramer merged 4 commits into
mainfrom
codex/slack-actor-attribution
Jul 7, 2026
Merged

dcramer merged 4 commits into
mainfrom
codex/slack-actor-attribution

Conversation

@dcramer

@dcramer dcramer commented Jul 7, 2026

Copy link
Copy Markdown
Member

Slack thread prompts now preserve the author on each current instruction, including mid-run steering, so first-person follow-ups in group threads are not implicitly attributed to the active requester. Passive skipped Slack messages are kept as recent thread context instead of being concatenated into the active instruction, and stale legacy prompt matching was removed.

The eval coverage exercises the user-visible actor-attribution behavior with Alice and Ryan giving conflicting first-person preferences. The deterministic integration coverage stays focused on runtime wiring: explicit follow-ups steer, passive queued text remains context, and passive text is no longer part of the active instruction.

Open concerns for follow-up:

  • Auth and credential binding still need a separate review for cross-actor Slack threads; this PR only changes model-facing attribution, not provider credential selection.
  • Memory extraction still needs to decide whose first-person statements are learnable, especially for passive thread context and plugin completed-session processing.
  • Multi-actor steering semantics remain intentionally narrow here. This PR does not define whether another user should interrupt an active actor, queue behind them, or create a parallel run.
  • Compaction/reporting still unwrap current-instruction tags for display/context cleanup. That parser can be revisited with the compaction work instead of expanding this slice.

Preserve Slack author metadata in model-facing current-instruction tags and keep passive queued thread messages as recent context instead of folding them into the active instruction. This avoids first-person follow-ups inheriting the wrong actor in group threads while keeping broader memory and auth behavior out of scope.

Add an eval for a cross-participant first-person follow-up and remove the legacy unwrapped prompt matching path.

Co-Authored-By: GPT-5 Codex <[email protected]>
@vercel

vercel Bot commented Jul 7, 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, Comment Jul 7, 2026 2:36am

Request Review

@dcramer
dcramer marked this pull request as ready for review July 7, 2026 01:58
@github-actions github-actions Bot added the risk: medium PR risk score: medium label Jul 7, 2026

@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.

Want reviews to match your repository better? Bugbot Learning can learn team-specific rules from PR activity. A team admin can enable Learning in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 7a147d5. Configure here.

Compute durable prompt history before appending queued instructions so fresh passive thread context is still included on first-turn batches. Treat recent-thread-messages as structured context instead of wrapping it as generic background.

Co-Authored-By: GPT-5 Codex <[email protected]>
Update CI-covered assertions for authored Slack steering. Queued explicit mentions are prompt history now, while the active instruction remains the latest message.

Remove obsolete legacy resume prompt expectations and keep exact current-instruction duplicate checks covered.

Co-Authored-By: GPT-5 Codex <[email protected]>
Return undefined instead of an empty string when no prompt context exists, and keep prepared conversation context available alongside durable Pi history.

Align the active-turn steering assertion with deferred passive follow-up behavior.

Co-Authored-By: GPT-5 Codex <[email protected]>
@dcramer
dcramer merged commit 322c146 into main Jul 7, 2026
19 checks passed
@dcramer
dcramer deleted the codex/slack-actor-attribution branch July 7, 2026 02:48
dcramer added a commit that referenced this pull request Jul 7, 2026
…ss support (#774)

Adds TDD eval coverage for the actor/instruction provenance work in
#773: four multi-user Slack thread scenarios where Alice is the run
requester and Bob is another participant, asserting against the memory
plugin's stored rows plus a reply-attribution rubric.

Two cases are **intentionally red** — they are the acceptance gates for
the provenance fix, not eval bugs:

- **Batched cross-actor mention**: when Bob's pending mention batches
into Alice's turn, the reply attributes his first-person preference to
Alice ("You asked for short bullet summaries" — she didn't). Reproduced
through the real mailbox batching path; whether it fails on a given run
depends on the model honoring prompt-text author labels from #772, which
is exactly the fragility the provenance fix removes.
- **Cross-author conversation knowledge** (fails deterministically):
operational knowledge stated by a passive participant never reaches
passive memory extraction today — it only exists in runtime context
blocks that `stripRuntimeTurnContext` removes from the plugin
transcript, so no conversation-scoped memory is ever created from it.

The two sequential-turn cases pass today and guard against
over-tightening: per-turn attribution already holds when each message
gets its own run, and the fix must not break that.

To make the batched arrangement expressible, the eval harness gains a
`batch()` event builder (`message_batch` event). Batch members persist
through the real Slack ingress boundary (`buildSlackInboundMessage` →
`appendAndEnqueueInboundMessage`) and are claimed by the real
conversation worker as one mailbox batch — the last message becomes the
live turn, earlier ones arrive as queued context, exactly the production
flow. Two harness seams support this: worker-claimed turns deliver
through the harness `TestThread` (the worker's restored thread has no
posting surface on the eval adapter), and the `FakeSlackAdapter` fixture
gains single-workspace internals (`botUserId`,
`defaultBotTokenProvider`) so `runWithSlackInstallation` treats it as a
default-token install. Non-batch events keep the existing direct
delivery path unchanged.

Review order: `src/helpers.ts` (the `batch()` builder),
`src/behavior-harness.ts` (the `message_batch` ingress path and worker
thread seam), then the eval file.

Refs #773

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Co-authored-by: Claude Fable 5 <[email protected]>

This branch was successfully deployed

1 active deployment
Preview – junior-docs — 0fdfff8e Deployed Jul 7, 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