Skip to content

fix: improve compaction diagnostics and embedded plugin surfaces - #1278

Merged
vastsa merged 2 commits into
mainfrom
fix/issue-1164-compaction-diagnostics
Oct 1, 2026
Merged

vastsa merged 2 commits into
mainfrom
fix/issue-1164-compaction-diagnostics

Conversation

@vastsa

@vastsa vastsa commented Oct 1, 2026

Copy link
Copy Markdown
Owner

Summary

  • add bounded, privacy-safe request-shape diagnostics for compaction failures
  • remove the default document frame from embedded plugin work-panel views
  • cover both changes with targeted regression tests and synchronized specs

Validation

  • pnpm check:pr-base
  • pnpm --filter @pi-desktop/agent-runtime typecheck
  • pnpm --filter @pi-desktop/agent-runtime exec vitest run src/compaction-diagnostics.test.ts src/compaction-request.test.ts src/runtime.test.ts --testNamePattern='compaction|Compaction'
  • node --test test/plugin-work-panel-views.test.mjs test/plugins-page-style.test.mjs (from apps/desktop)

Fixes #1164
Fixes #1168

vastsa added 2 commits October 1, 2026 17:02
Add bounded session diagnostics for failed context compaction requests so provider errors can be investigated without writing prompt content, tool schemas, or credentials. Keep the diagnostics outside the transcript and classify them with the session logs.
Embedded plugin documents are composited inside the host work panel, so their default document edge must not add an unconfigurable frame. Reset only the embedded root and body surface chrome while leaving detached plugin windows unchanged.
Copilot AI balanced review requested due to automatic review settings October 1, 2026 09:34

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.

Copilot review overview

🟡 Changes recommended

Compaction diagnostics currently have stale state, incomplete fields, and incorrect retry correlation.

Review effort: Balanced
Findings: 2 Medium severity · 1 Low severity

Open (3)
What changed in this PR

Adds privacy-conscious compaction diagnostics and removes default framing from embedded plugin panels.

Changes:

  • Routes compaction failure/request-shape diagnostics to session logs.
  • Resets embedded plugin document chrome.
  • Adds targeted tests and updates runtime/UX specifications.
File Description
packages/​agent-runtime/​src/​sidecar.ts Relays runtime diagnostics.
packages/​agent-runtime/​src/​runtime.ts Produces compaction diagnostics.
packages/​agent-runtime/​src/​compaction-request.ts Observes outgoing request shape.
packages/​agent-runtime/​src/​compaction-request.test.ts Tests shape observation.
packages/​agent-runtime/​src/​compaction-diagnostics.ts Builds bounded shape metadata.
packages/​agent-runtime/​src/​compaction-diagnostics.test.ts Tests metadata sanitization.
apps/​desktop/​electron/​main/​runtime/​sidecar.ts Writes diagnostics to session logs.
apps/​desktop/​electron/​preload/​plugin-panel.ts Removes embedded document framing.
apps/​desktop/​test/​plugin-work-panel-views.test.mjs Checks embedded surface resets.
docs/​spec/​03-runtime/​09-logging-and-observability.md Documents compaction records.
docs/​spec/​04-ux/​08-component-spec.md Documents frameless plugin views.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment on lines +11 to +12
const MAX_FIELDS = 32;
const FIELD_RE = /^[a-zA-Z][a-zA-Z0-9_]{0,63}$/;
Comment on lines +6457 to +6461
private emitCompactionFailureDiagnostic(
requestId: string,
reason: CompactionFailureReason,
tokensBefore: number | undefined,
error: unknown,
} satisfies AgentEventEnvelope);
}
}
if (method === "agent.diagnostic") {
@vastsa
vastsa merged commit df90312 into main Oct 1, 2026
5 checks passed
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.

[Bug] 边框去掉一下,左下右都有边框 [Feature] 记录压缩摘要失败时的请求形状,并把该日志行归入 session 分类

2 participants