Skip to content

feat(pi): make /plannotator-last message anchoring optional - #1371

Open
ashish921998 wants to merge 1 commit into
backnotprop:mainfrom
ashish921998:feat/pi-optional-message-anchoring
Open

feat(pi): make /plannotator-last message anchoring optional#1371
ashish921998 wants to merge 1 commit into
backnotprop:mainfrom
ashish921998:feat/pi-optional-message-anchoring

Conversation

@ashish921998

Copy link
Copy Markdown
Contributor

Problem

/plannotator-last delivers message-annotation feedback with the original assistant response excerpted before it (up to 1,000 characters via anchorMessageFeedback() in apps/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.messageFeedback template 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 — new annotateMessageAnchoring config key (default true) + resolveAnnotateMessageAnchoring(), following the exact precedence pattern of the neighboring resolvers: PLANNOTATOR_ANNOTATE_MESSAGE_ANCHORING env var → config key → default true, with hand-edited "false"-as-string coercion (coerceConfigBoolean).
  • apps/pi-extension/annotate-outcome.ts — new pure shouldPrependMessageAnchor({ 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.
  • Docs — AGENTS.md env-var table row + Pi README "Annotate last message" section.

Tests

Four new cases in annotate-outcome.test.ts covering the full gating matrix: stale target anchors by default, config-off skips, fresh target skips, messages scope never anchors while message scope does.

Fixes #1334

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

Copy link
Copy Markdown
Contributor Author

@backnotprop can you review this PR?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Pi: make /plannotator-last message anchoring optional

1 participant