Skip to content

feat(chat)!: Bind per-message actor provenance through runs, plugins, and memory - #785

Merged
dcramer merged 5 commits into
mainfrom
eval/multi-actor-provenance
Jul 8, 2026
Merged

dcramer merged 5 commits into
mainfrom
eval/multi-actor-provenance

Conversation

@dcramer

@dcramer dcramer commented Jul 7, 2026

Copy link
Copy Markdown
Member

A run's instructions can come from multiple people (batched mentions, mid-run steering, continuation), but identity was flattened to a single latest-wins requester at every projection boundary — by the time anything reached a plugin, the only author signal left was prompt text, which must never be treated as authority. Confirmed failure: Bob posts "I prefer terse code reviews" in Alice's thread and it lands as Alice's personal memory. This is the confused deputy problem tracked in #773; this PR is Track 1.

The runtime now records provenance ({ authority: "instruction" | "context", actor }) on every user-role message and carries it per-entry through the session log, projection resets, compaction, and the turn session record, failing closed to unattributed context for legacy entries. Memory extraction must cite evidence message indices, and a deterministic router verifies them: personal-scope writes require every cited entry to be a run-actor instruction (unproven preferences are dropped, never downgraded), while public thread messages now reach plugins as context-authority evidence so shared operational knowledge still becomes conversation-scope memory. Instruction entries in the plugin projection are stripped of embedded thread-context blocks so another user's text can never ride inside an instruction-authority citation.

This also lands the naming contract from specs/multi-actor-runs.md: one identity concept — actor — annotated per instruction. "requester" is retired vocabulary; the codebase-wide rename is #778.

Breaking plugin contract (@sentry/junior-plugin-api); all in-repo consumers are updated:

// before
{ "run": { "requester": {...} }, "transcript": [{ "type": "message", "role": "user", "text": "..." }] }

// after
{
  "run": { "actor": {...}, "actors": [{...}] },  // actors = everyone whose instructions joined the run
  "transcript": [{ "type": "message", "role": "user", "text": "...",
                   "provenance": { "authority": "instruction", "actor": {...} }, "isRunActor": true }]
}

The multi-actor evals were written first and red (packages/junior-evals/evals/memory/multi-actor-provenance.eval.ts); they pass deterministically with this change. Along the way both memory eval files turned out to have label-suffixed thread_ts fixtures that fail Slack timestamp parsing, which mis-keyed every stored memory and made all DB assertions silently vacuous — fixtures are repaired here, so those assertions are meaningful for the first time. Five workflows.eval.ts cases are now correctly red: they document the live memory write/forget tool paths failing, a pre-existing bug the vacuous fixtures had masked (#784). They are intentionally left red as evidence.

Review order: chat/state/session-log.ts (the provenance primitive) → chat/state/turn-session.ts → chat/plugins/task-runner.ts + junior-plugin-api/src/tasks.ts (the contract) → junior-memory/src/process-session.ts (the deterministic router) → specs/multi-actor-runs.md.

Refs GH-773
Refs GH-784

🤖 Generated with Claude Code

@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 8, 2026 3:23am

Request Review

@dcramer
dcramer marked this pull request as ready for review July 7, 2026 17:41
@github-actions github-actions Bot added the risk: high PR risk score: high label Jul 7, 2026
dcramer and others added 3 commits July 7, 2026 19:01
…and memory

Instructions from multiple people can join one run (batched mentions,
mid-run steering, continuation), but identity was flattened to a single
latest-wins requester at every projection boundary. By the time anything
reached a plugin, the only author signal left was prompt text — which
must never be treated as authority. Confirmed failure: another
participant's first-person preference stored as the requester's personal
memory.

Record provenance ({ authority: "instruction" | "context", actor })
on every user-role pi_message; project it per-entry through the session
log, projection resets, compaction, and the turn session record, failing
closed to unattributed context for legacy entries. Expose it on the
plugin run contract as run.actor (the actor the run executes as),
run.actors (all distinct instruction actors, a derived projection), and
per-entry provenance with isRunActor.

Memory extraction now cites evidence message indices and a deterministic
router verifies them: personal-scope memories require every cited entry
to be a run-actor instruction (unproven preferences are dropped, never
downgraded); public thread messages reach plugins as context-authority
evidence so conversation-scope knowledge still lands. Strip embedded
thread-context blocks from instruction entries in the plugin projection
so another user's text can never ride inside an instruction-authority
citation.

This also lands the actor naming contract (specs/multi-actor-runs.md):
one identity concept — actor — annotated per instruction; "requester"
is retired vocabulary with the codebase-wide rename tracked in #778.

Refs GH-773
Co-Authored-By: Claude Fable 5 <[email protected]>
The memory eval threads used label-suffixed thread_ts values (e.g.
"17000000.memory-bystander") that fail Slack timestamp parsing, so the
runtime keyed stored memories by per-message ts while assertions filtered
on the thread-based source key: every positive DB assertion could never
match and every no-store assertion passed vacuously. Replace them with
valid numeric timestamps in both memory eval files — the assertions are
now meaningful for the first time.

Sharpen the multi-actor rubrics to the precise harm (claiming another
participant's preference belongs to the requester) so the judge no longer
fails replies that correctly attribute or apply thread feedback, and give
the bystander-preference thread real retro content so the recap question
is satisfiable. Case 1's DB assertion becomes content-exclusion: whether
the requester owns a well-phrased memory of her own words is extraction
quality, not this eval's contract.

With fixtures fixed, five workflows cases stay correctly red: they
document the live memory write/forget tool paths failing, previously
masked by the vacuous assertions. Tracked in #784; the evals are the
evidence and must not be relaxed to green.

Refs GH-773
Refs GH-784
Co-Authored-By: Claude Fable 5 <[email protected]>
… actor records

Address three review findings against the per-message provenance work:

Turn-session records written before this deploy persist the bound identity
as 'requester'; rehydration now decodes that legacy field as the actor when
the new field is absent, so in-flight OAuth resumes and continuations keep
their bound user across the rollout. Malformed values still fail closed.

Mid-run steering checkpoints committed drained messages under the run
actor's default provenance, tagging another author's steered message as the
run actor's instruction. Steering commits now thread each drained message's
own provenance through resume and the session log as an explicit trailing
override, with alignment guards that throw instead of guessing.

Compaction recovered retained-message provenance through a sanitized-text
map, so two authors with identical wording collided and the later author
overwrote the earlier. Retained messages now keep their source projection
index and provenance is copied by index.

Refs GH-773
Co-Authored-By: Claude Fable 5 <[email protected]>
Address review findings on the provenance work:

Conversation-scope memory evidence now accepts attributed instruction
messages from participants other than the run actor. Text-dedup between
context and run entries could leave only the instruction copy of a
co-participant's message, which the router previously rejected — blocking
the shared-knowledge path this change set exists to keep open. Personal
scope still requires run-actor instruction citations only.

pluginRunContextSchema.actor is optional again: legacy completed records
predate first-class run actors, and a required field made ctx.run.load()
throw at parse time for them. Absent actor means unavailable authority.

Stale passive-extraction cache entries without evidenceMessageIndices are
discarded and re-extracted instead of failing the retried task until the
cache expires.

Also adds a regression test for Slack identity-key delimiter collisions
(already NUL-delimited on this branch; the reviewed commit predated the
rebase).

Refs GH-773
Co-Authored-By: Claude Fable 5 <[email protected]>

@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 7874c3c. Configure here.

The plugin transcript's public-thread context entries were read from
persisted thread state at task time with no cutoff, so messages posted
after the run completed could appear as that run's context-authority
evidence and be cited by passive memory extraction. Context entries are
now bounded to messages whose runtime timestamp is at or before the
record's completion time; messages without a usable timestamp are
excluded, since inclusion grants evidentiary standing.

Refs GH-773
Co-Authored-By: Claude Fable 5 <[email protected]>
@dcramer
dcramer merged commit 1dc781c into main Jul 8, 2026
19 checks passed
@dcramer
dcramer deleted the eval/multi-actor-provenance branch July 8, 2026 03:37

This branch was successfully deployed

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

Labels

risk: high PR risk score: high

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant