feat(plugins): Add prompt hook contributions#621
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
| pluginPrompt.sessionState, | ||
| ), | ||
| }; | ||
| }), |
There was a problem hiding this comment.
Parallel steering plugin hooks race
Medium Severity
When several steering messages are injected in one batch, drainSteeringMessages runs getPluginUserPromptContributions for each message concurrently via Promise.all. Each hook reads the same plugin session snapshot and can emit identical prompt text and session appends before a single checkpoint, so bookkeeping and model context can disagree with sequential steering.
Reviewed by Cursor Bugbot for commit b072c14. Configure here.
Add generic plugin prompt hooks for system and user prompt context so runtime plugins can contribute bounded prompt text without owning prompt rendering. The public API now exposes platform-only system prompt context, request-scoped user prompt context, and bounded JSON session appends for deterministic prompt continuity. Core collects and validates plugin contributions, renders them under Junior-owned wrappers, and commits accepted session appends with the same durable input checkpoint as the model-visible prompt. Follow-up and steering user prompts run the same userPrompt hook path, and focused integration coverage exercises generateAssistantReply with only the Pi/model boundary faked. Co-authored-by: GPT-5 Codex <codex@openai.com>
b072c14 to
03ed059
Compare
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 2 potential issues.
There are 3 total unresolved issues (including 1 from previous review).
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 03ed059. Configure here.
| ? { contributions: [], sessionState: [] } | ||
| : await getPluginUserPromptContributions({ | ||
| context: toolRuntimeContext, | ||
| isFirstPrompt: needsBootstrapContext, |
There was a problem hiding this comment.
isFirstPrompt conflates bootstrap flag
Medium Severity
getPluginUserPromptContributions receives isFirstPrompt: needsBootstrapContext, but that flag only reflects whether prior Pi history includes a runtime turn-context block. Local (and other) flows strip that block from reused history while keeping earlier user turns, so follow-up messages still get isFirstPrompt: true even though they are not the first model-visible user prompt in the projection.
Reviewed by Cursor Bugbot for commit 03ed059. Configure here.
| value: PluginJsonValue; | ||
| }>, | ||
| pluginName, | ||
| }); |
There was a problem hiding this comment.
Session appends skipped without ID
Medium Severity
When a userPrompt hook returns accepted contributions and sessionState, core still renders the contributions if conversationId is missing, but it omits those appends from the durable checkpoint payload. session.list stays empty while the model already saw the prompt text, breaking bookkeeping that should commit together with accepted contributions.
Reviewed by Cursor Bugbot for commit 03ed059. Configure here.


Runtime plugins can now contribute bounded system and user prompt context through generic prompt hooks instead of memory-specific core APIs. The public plugin API exposes a platform-only system prompt context, request-scoped user prompt context, bounded JSON session appends, and shared validation schemas so plugin authors see the same contract core enforces.
Core renders accepted plugin prompt text inside Junior-owned wrappers and commits matching plugin session appends in the same durable input checkpoint as the model-visible prompt. Initial, follow-up, and steering user prompts run the same userPrompt path; the focused integration test exercises generateAssistantReply with only the Pi/model boundary faked, alongside unit coverage for validation, prompt rendering, and session-log projection behavior.