feat(pi): make /plannotator-last message anchoring optional - #1371
Open
ashish921998 wants to merge 1 commit into
Open
feat(pi): make /plannotator-last message anchoring optional#1371ashish921998 wants to merge 1 commit into
ashish921998 wants to merge 1 commit into
Conversation
The Pi extension prepends up to 1,000 characters of the target assistant response when delivering message-annotation feedback. For the normal /plannotator-last flow the model already holds the response in its own context, so the excerpt is redundant overhead (backnotprop#1334). Add an annotateMessageAnchoring config seam (default true, preserving current behavior) resolved by resolveAnnotateMessageAnchoring in packages/shared/config.ts, overridable via PLANNOTATOR_ANNOTATE_MESSAGE_ANCHORING. Gate the anchor through a new pure shouldPrependMessageAnchor helper so the decision is unit-tested alongside the existing annotate-outcome cases. Fixes backnotprop#1334
Contributor
Author
|
@backnotprop can you review this PR? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
/plannotator-lastdelivers message-annotation feedback with the original assistant response excerpted before it (up to 1,000 characters viaanchorMessageFeedback()inapps/pi-extension/index.ts). In the normal last-message flow the model already holds that response in its own conversation context, so the excerpt is redundant token overhead that makes even short feedback verbose (#1334).As the issue notes, the existing
prompts.annotate.runtimes.pi.messageFeedbacktemplate cannot disable this — the excerpt is prepended before the template is applied, so{{feedback}}only shapes the wrapper, never the anchor.Change
Adds an opt-out seam with default behavior unchanged:
packages/shared/config.ts— newannotateMessageAnchoringconfig key (defaulttrue) +resolveAnnotateMessageAnchoring(), following the exact precedence pattern of the neighboring resolvers:PLANNOTATOR_ANNOTATE_MESSAGE_ANCHORINGenv var → config key → defaulttrue, with hand-edited"false"-as-string coercion (coerceConfigBoolean).apps/pi-extension/annotate-outcome.ts— new pureshouldPrependMessageAnchor({ feedbackScope, anchoringEnabled, targetMayBeStale })helper: message-scope feedback (the multi-message picker) never anchors; otherwise anchoring requires both the config seam and the existing possibly-stale-target condition (shouldAnchorLastMessageFeedback: different session, or entries added after the target).apps/pi-extension/index.ts— the feedback construction routes through the helper; nothing else changes.Tests
Four new cases in
annotate-outcome.test.tscovering the full gating matrix: stale target anchors by default, config-off skips, fresh target skips,messagesscope never anchors whilemessagescope does.Fixes #1334