Skip to content

FE-1187: Make cancelled exchanges self-describing#331

Open
lunelson wants to merge 51 commits into
ln/fe-1196-platform-debtfrom
ln/fe-1187-remediation-3
Open

FE-1187: Make cancelled exchanges self-describing#331
lunelson wants to merge 51 commits into
ln/fe-1196-platform-debtfrom
ln/fe-1187-remediation-3

Conversation

@lunelson

Copy link
Copy Markdown
Contributor

FE-1187: Make cancelled exchanges self-describing

FE-1187: Guide standalone ask cancellation

fix(dev): make introspection notices actionable

fix(dev): only advertise written prompt mirror

FE-1187: Add sweep debt tripwire

fix(probes): document tripwire source invocation

FE-1187: Scope consolidated outer checkpoint

fix(probes): judge latest closed sweep interval

test(probes): pin malformed sweep JSONL diagnostics

fix(probes): parse tripwire options strictly

docs(plan): retire tripwire correction scope

fix(exchanges): canonicalize cancellation terminal

lunelson commented Jul 14, 2026

Copy link
Copy Markdown
Contributor Author

Warning

This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
Learn more

This stack of pull requests is managed by Graphite. Learn more about stacking.

@lunelson lunelson marked this pull request as ready for review July 14, 2026 10:46
Copilot AI review requested due to automatic review settings July 14, 2026 10:46
@cursor

cursor Bot commented Jul 14, 2026

Copy link
Copy Markdown

PR Summary

Low Risk
Changes are fixtures and canonical docs/plan text with no application code in this diff; main risk is reviewers treating the new web/review contracts as already implemented rather than design targets.

Overview
This PR is mostly documentation, planning, and fixtures around the FE-1187 walkthrough closure lane—not the cancellation/introspection/tripwire code hinted at in the PR title (those changes aren’t in this diff).

Walkthrough evidence: Two new workspace-alpha-grounding seeds—advisory-pending (settled vs advisory harmonization tension) and contradictory (mutually exclusive settled orientation requirements)—plus TESTING_PLAN routing-probe rows and expanded seed suggestions. TESTING_FINDINGS gains a large 2026-07-14 checkpoint (R5–R13): fixed cancellation guidance and continuation non-repetition/scratchpad disclosure; open items for exchange terminal visuals, digest choreography, questionnaires, large review sets, footer model chrome, and zero-readiness entry menus; Execute O7–O9 ownership moved to the KA stream.

Product/design direction: New WEB_UI_ARCHITECTURE.md defines standalone browser mode, a cwd-scoped multi-session host, Brunch JSON-RPC (not raw Pi RPC), durable JSONL hydration + live overlay, and a first end-to-end tracer scope. MULTI_SESSION_DAEMON_ARCHITECTURE and SESSION_HOST_DECISION_CANDIDATE are marked superseded. REVIEW_SETS.md and STRUCTURED_EXCHANGE_ANSWERING_PATHS.md now describe one shared local/RPC review settlement and D125-L-complete headless ask coverage via the live registry (not per-mode broker gaps).

Planning & process: memory/PLAN.md is trimmed; FE-1187 next work emphasizes compact review presentation and transcript-ledger-rendering folded into exchange-visual-design; Later frontiers archived in PLAN_HISTORY. ln-execute.md adds memory/REFACTOR.md as a first-class execution artifact (serial commit items, no ln-scope translation). pi-native-integration-opportunities.md reassigns P2 ledger rendering to FE-1187 visual design.

Reviewed by Cursor Bugbot for commit 60c740c. Bugbot is set up for automated code reviews on this repo. Configure here.

@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 9f6a59e. Configure here.

Comment thread src/probes/sweep-debt-tripwire.ts

Copilot AI 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.

Pull request overview

This PR makes “cancelled” structured exchanges self-describing and easier to interpret (for both humans and the agent), while also adding a CLI “tripwire” probe to detect capture-sweep debt in session JSONL and improving dev-mode /introspect legibility.

Changes:

  • Canonicalize cancellation rendering via a shared CANCELLED_TERMINAL string and update formatters/tests/snapshots accordingly.
  • Add a sweep-debt tripwire probe (src/probes/sweep-debt-tripwire.ts) with strict CLI argument parsing and comprehensive Vitest coverage.
  • Improve Pi dev-mode introspection output (top-level field summaries + actionable mirror pointer) and add standalone ask cancellation status guidance in the Pi exchange extension.

Reviewed changes

Copilot reviewed 23 out of 23 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
src/probes/sweep-debt-tripwire.ts New CLI/library probe to assess sweep debt from session JSONL.
src/probes/tests/sweep-debt-tripwire.test.ts Tests for sweep-debt assessment, JSONL parsing diagnostics, and CLI exit behavior.
src/probes/tests/structured-exchange-ordering-proof.test.ts Updates ordering proof to include the new ui:setStatus event.
src/agents/contexts/exchanges/request-response/review.ts Uses canonical cancellation terminal for request-review rendering.
src/agents/contexts/exchanges/request-response/choices.ts Uses canonical cancellation terminal for request-choices rendering.
src/agents/contexts/exchanges/request-response/choice.ts Uses canonical cancellation terminal for request-choice rendering.
src/agents/contexts/exchanges/request-response/answer.ts Uses canonical cancellation terminal for request-answer rendering.
src/agents/contexts/exchanges/option-echo.ts Introduces CANCELLED_TERMINAL shared cancellation terminal text.
src/agents/contexts/exchanges/ask.ts Renders ask cancellation via CANCELLED_TERMINAL and elides cancelled.message.
src/agents/contexts/exchanges/tests/request-response.test.ts Asserts all request-response cancellations render as the canonical terminal.
src/agents/contexts/exchanges/tests/ask.test.ts Asserts ask cancellation uses canonical terminal (and not trailing italic).
src/agents/contexts/exchanges/snapshots/review-set-tuples.md Snapshot updates reflecting canonical cancellation terminal text.
src/agents/contexts/exchanges/snapshots/question-tuples.md Snapshot updates reflecting canonical cancellation terminal text.
src/agents/contexts/exchanges/snapshots/digest-tuples.md Snapshot updates reflecting canonical cancellation terminal text.
src/agents/contexts/exchanges/snapshots/ask-tuples.md Snapshot updates reflecting canonical cancellation terminal text.
src/.pi/extensions/exchanges/TOPOLOGY.md Documents revised standalone cancellation guidance and lifecycle.
src/.pi/extensions/exchanges/ask.ts Sets/clears a brunch.ask status hint on standalone cancellation/answer.
src/.pi/extensions/dev-mode/introspection/TOPOLOGY.md Documents more actionable /introspect output (field-level + mirror pointer).
src/.pi/extensions/dev-mode/introspection/index.ts Implements top-level summarization + conditional mirror pointer output.
src/.pi/extensions/tests/exchanges-present-request.test.ts Verifies standalone cancellation sets status hint and clears on next answer.
src/.pi/extensions/tests/dev-mode-introspection.test.ts Tests new /introspect output shape and mirror pointer gating.
memory/PLAN.md Updates progress tracking and execution pointer for FE-1187 remediation tranche.
memory/cards/walkthrough-remediation-2--consolidated-outer-checkpoint.md Adds a human-gated consolidated checkpoint card for outer verification.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +60 to +72
export function parseSessionJsonl(source: string): readonly TranscriptEntryLike[] {
return source
.split(/\r?\n/u)
.filter((line) => line.trim().length > 0)
.map((line, index) => {
try {
return requireEntry(JSON.parse(line) as unknown);
} catch (error) {
const detail = error instanceof Error ? error.message : String(error);
throw new Error(`Invalid session JSONL at line ${index + 1}: ${detail}`);
}
});
}
Copilot AI review requested due to automatic review settings July 14, 2026 11:46
@lunelson lunelson force-pushed the ln/fe-1196-platform-debt branch from e72e030 to e6730fc Compare July 14, 2026 11:46
@lunelson lunelson force-pushed the ln/fe-1187-remediation-3 branch from 9f6a59e to 06cb306 Compare July 14, 2026 11:46

Copilot AI 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.

Pull request overview

Copilot reviewed 31 out of 38 changed files in this pull request and generated 4 comments.

Comment thread src/.pi/extensions/dev-mode/introspection/index.ts
Comment thread testing/walkthroughs/2026-07-14/remediations-3a.md Outdated
Comment thread testing/walkthroughs/2026-07-14/remediations-3a.md Outdated
Comment thread testing/walkthroughs/2026-07-14/remediations-3a.md Outdated
Copilot AI review requested due to automatic review settings July 14, 2026 12:50
@lunelson lunelson force-pushed the ln/fe-1187-remediation-3 branch from 06cb306 to 9b78289 Compare July 14, 2026 12:50

Copilot AI 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.

Pull request overview

Copilot reviewed 34 out of 42 changed files in this pull request and generated 4 comments.

Comment thread src/.pi/extensions/dev-mode/introspection/index.ts
Comment thread testing/walkthroughs/2026-07-14/remediations-3a.md Outdated
Comment thread testing/walkthroughs/2026-07-14/remediations-3a.md Outdated
Comment thread testing/walkthroughs/2026-07-14/remediations-3a.md Outdated
Copilot AI review requested due to automatic review settings July 14, 2026 18:54

Copilot AI 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.

Pull request overview

Copilot reviewed 79 out of 87 changed files in this pull request and generated 3 comments.

Comment thread src/.pi/extensions/__tests__/exchanges-present-request.test.ts Outdated
Comment thread testing/walkthroughs/2026-07-14/remediations-3a.md Outdated
Comment thread testing/walkthroughs/2026-07-14/remediations-3a.md Outdated
Copilot AI review requested due to automatic review settings July 14, 2026 20:31

Copilot AI 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.

Pull request overview

Copilot reviewed 104 out of 112 changed files in this pull request and generated 3 comments.

Comment on lines 116 to +120
if ('digest' in details) {
return {
exchangeId: details.exchange_id,
lens: 'intent',
mode: 'review',
mode: 'text',
Comment on lines 73 to 77
export const zAskContinuationParams = z
.object({
body: zNonBlankMarkdown,
options: z.array(zAskContinuationOption).min(1),
options: z.array(zAskContinuationOption).min(1).optional(),
multiple: z.boolean().optional(),
Comment on lines +99 to +100
if (question.kind === 'multi-select' && this.#multi.size)
answer = { questionId: question.id, kind: 'multi-select', optionIds: [...this.#multi] };
Sort top-level field keys and exclude arrays from the record guard so
`/introspect` output is stable and never mislabels an array payload as a
numeric-index record. Drop the digest false-proof from the continuation
picker test (digest routes to the editor, not a decision picker; the
editor path is already proven separately) and fix walkthrough-note typos.

Co-authored-by: Cursor <cursoragent@cursor.com>
Copilot AI review requested due to automatic review settings July 14, 2026 20:43

Copilot AI 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.

Pull request overview

Copilot reviewed 104 out of 112 changed files in this pull request and generated 1 comment.

Comment on lines +99 to +100
if (question.kind === 'multi-select' && this.#multi.size)
answer = { questionId: question.id, kind: 'multi-select', optionIds: [...this.#multi] };
Copilot AI review requested due to automatic review settings July 14, 2026 21:38

Copilot AI 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.

Pull request overview

Copilot reviewed 112 out of 120 changed files in this pull request and generated 3 comments.

Comment on lines +87 to +93
return acceptedTextResponse(
pending.exchangeId,
answerText,
'request_answer',
formatRequestAnswer(details),
details,
);
Comment on lines 79 to 83
body: zNonBlankMarkdown,
options: z.array(zAskContinuationOption).min(1),
options: z.array(zAskContinuationOption).min(1).optional(),
multiple: z.boolean().optional(),
allowOther: z.boolean().optional(),
allowNone: z.boolean().optional(),
Comment on lines 58 to 61
toolResultMessage: {
role: 'toolResult',
toolName: 'ask',
toolName: 'request_answer',
content: [{ text: '## Answer\n\nA local product specification workspace.' }],
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.

2 participants