Compaction: preserve opaque identifiers in summaries#25553
Compaction: preserve opaque identifiers in summaries#25553Takhoffman merged 5 commits intoopenclaw:mainfrom
Conversation
CHANGELOG.md
Outdated
| - Ollama/Qwen: handle Qwen 3 reasoning field format in Ollama responses. (#18631) Thanks @mr-sk. | ||
| - OpenAI/Transcripts: always drop orphaned reasoning blocks from transcript repair. (#18632) Thanks @TySabs. | ||
| - Fix types in all tests. Typecheck the whole repository. | ||
| - Agents/Compaction: harden summarization prompts to preserve opaque identifiers verbatim (UUIDs, IDs, tokens, host/IP/port, URLs), reducing post-compaction identifier drift and hallucinated identifier reconstruction. |
There was a problem hiding this comment.
Changelog entry in released version section
This new entry is placed under the 2026.2.17 section (an already-released version) rather than Unreleased or 2026.2.23 (Unreleased) at the top. Is this intentional for the PR stack ordering, or should it be moved to the unreleased section?
Prompt To Fix With AI
This is a comment left during a code review.
Path: CHANGELOG.md
Line: 624
Comment:
**Changelog entry in released version section**
This new entry is placed under the `2026.2.17` section (an already-released version) rather than `Unreleased` or `2026.2.23 (Unreleased)` at the top. Is this intentional for the PR stack ordering, or should it be moved to the unreleased section?
How can I resolve this? If you propose a fix, please make it concise.There was a problem hiding this comment.
Good catch. I moved this entry from the released 2026.2.17 block to 2026.2.24 (Unreleased) under ### Fixes
e279efb to
2e50696
Compare
7cc85d1 to
15ef409
Compare
|
@greptileai can you re verify and update the PR description? |
42cc7fb to
140b9be
Compare
Additional Comments (1)
When This won't break anything at runtime, but the redundant header is noisy. Consider either:
Prompt To Fix With AIThis is a comment left during a code review.
Path: src/agents/compaction.ts
Line: 338-340
Comment:
**Duplicate "Additional focus:" header in merge path**
When `params.customInstructions` is set and the split+merge path fires, `mergeInstructions` is built with an `"Additional focus:\n"` wrapper (line 339), then passed as `customInstructions` to `summarizeWithFallback` → `summarizeChunks` → `buildCompactionSummarizationInstructions`, which adds a second `"Additional focus:\n"` wrapper (line 27). The resulting prompt looks like:
```
Preserve all opaque identifiers exactly as written …
Additional focus:
Merge these partial summaries into a single cohesive summary. …
Additional focus:
<user's custom instructions>
```
This won't break anything at runtime, but the redundant header is noisy. Consider either:
- Having `buildCompactionSummarizationInstructions` handle the merge case too (accepting a structured options object), or
- Wrapping the merge instructions through `buildCompactionSummarizationInstructions` explicitly and appending merge-specific text separately.
How can I resolve this? If you propose a fix, please make it concise. |
|
Thanks @greptileai, I added a regression test with your suggestion. Please edit the PR description after you have verified again. |
…penclaw#25553) Hardens summarization prompts to retain UUIDs, IDs, tokens, host/IP/port, URLs, and file names verbatim, reducing post-compaction identifier drift and hallucinated identifier reconstruction. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
PR #25553 - Compaction: preserve opaque identifiers in summaries (#25553) Merged via squash.
Thanks @rodrigouroz! |
… thanks @rodrigouroz Verified: - pnpm install --frozen-lockfile - pnpm build - pnpm check - pnpm test:macmini Co-authored-by: rodrigouroz <384037+rodrigouroz@users.noreply.github.com> Co-authored-by: Tak Hoffman <781889+Takhoffman@users.noreply.github.com>
… thanks @rodrigouroz Verified: - pnpm install --frozen-lockfile - pnpm build - pnpm check - pnpm test:macmini Co-authored-by: rodrigouroz <384037+rodrigouroz@users.noreply.github.com> Co-authored-by: Tak Hoffman <781889+Takhoffman@users.noreply.github.com>
… thanks @rodrigouroz Verified: - pnpm install --frozen-lockfile - pnpm build - pnpm check - pnpm test:macmini Co-authored-by: rodrigouroz <384037+rodrigouroz@users.noreply.github.com> Co-authored-by: Tak Hoffman <781889+Takhoffman@users.noreply.github.com>
… thanks @rodrigouroz Verified: - pnpm install --frozen-lockfile - pnpm build - pnpm check - pnpm test:macmini Co-authored-by: rodrigouroz <384037+rodrigouroz@users.noreply.github.com> Co-authored-by: Tak Hoffman <781889+Takhoffman@users.noreply.github.com>
… thanks @rodrigouroz Verified: - pnpm install --frozen-lockfile - pnpm build - pnpm check - pnpm test:macmini Co-authored-by: rodrigouroz <384037+rodrigouroz@users.noreply.github.com> Co-authored-by: Tak Hoffman <781889+Takhoffman@users.noreply.github.com>
… thanks @rodrigouroz Verified: - pnpm install --frozen-lockfile - pnpm build - pnpm check - pnpm test:macmini Co-authored-by: rodrigouroz <384037+rodrigouroz@users.noreply.github.com> Co-authored-by: Tak Hoffman <781889+Takhoffman@users.noreply.github.com> (cherry picked from commit 3b0f73e)
… thanks @rodrigouroz Verified: - pnpm install --frozen-lockfile - pnpm build - pnpm check - pnpm test:macmini Co-authored-by: rodrigouroz <384037+rodrigouroz@users.noreply.github.com> Co-authored-by: Tak Hoffman <781889+Takhoffman@users.noreply.github.com> (cherry picked from commit 3b0f73e)
… thanks @rodrigouroz Verified: - pnpm install --frozen-lockfile - pnpm build - pnpm check - pnpm test:macmini Co-authored-by: rodrigouroz <384037+rodrigouroz@users.noreply.github.com> Co-authored-by: Tak Hoffman <781889+Takhoffman@users.noreply.github.com> (cherry picked from commit 3b0f73e)
… thanks @rodrigouroz Verified: - pnpm install --frozen-lockfile - pnpm build - pnpm check - pnpm test:macmini Co-authored-by: rodrigouroz <384037+rodrigouroz@users.noreply.github.com> Co-authored-by: Tak Hoffman <781889+Takhoffman@users.noreply.github.com>
… thanks @rodrigouroz Verified: - pnpm install --frozen-lockfile - pnpm build - pnpm check - pnpm test:macmini Co-authored-by: rodrigouroz <384037+rodrigouroz@users.noreply.github.com> Co-authored-by: Tak Hoffman <781889+Takhoffman@users.noreply.github.com>
… thanks @rodrigouroz Verified: - pnpm install --frozen-lockfile - pnpm build - pnpm check - pnpm test:macmini Co-authored-by: rodrigouroz <384037+rodrigouroz@users.noreply.github.com> Co-authored-by: Tak Hoffman <781889+Takhoffman@users.noreply.github.com>
… thanks @rodrigouroz Verified: - pnpm install --frozen-lockfile - pnpm build - pnpm check - pnpm test:macmini Co-authored-by: rodrigouroz <384037+rodrigouroz@users.noreply.github.com> Co-authored-by: Tak Hoffman <781889+Takhoffman@users.noreply.github.com>
… thanks @rodrigouroz Verified: - pnpm install --frozen-lockfile - pnpm build - pnpm check - pnpm test:macmini Co-authored-by: rodrigouroz <384037+rodrigouroz@users.noreply.github.com> Co-authored-by: Tak Hoffman <781889+Takhoffman@users.noreply.github.com>
… thanks @rodrigouroz Verified: - pnpm install --frozen-lockfile - pnpm build - pnpm check - pnpm test:macmini Co-authored-by: rodrigouroz <384037+rodrigouroz@users.noreply.github.com> Co-authored-by: Tak Hoffman <781889+Takhoffman@users.noreply.github.com>
… thanks @rodrigouroz Verified: - pnpm install --frozen-lockfile - pnpm build - pnpm check - pnpm test:macmini Co-authored-by: rodrigouroz <384037+rodrigouroz@users.noreply.github.com> Co-authored-by: Tak Hoffman <781889+Takhoffman@users.noreply.github.com>
… thanks @rodrigouroz Verified: - pnpm install --frozen-lockfile - pnpm build - pnpm check - pnpm test:macmini Co-authored-by: rodrigouroz <384037+rodrigouroz@users.noreply.github.com> Co-authored-by: Tak Hoffman <781889+Takhoffman@users.noreply.github.com>
… thanks @rodrigouroz Verified: - pnpm install --frozen-lockfile - pnpm build - pnpm check - pnpm test:macmini Co-authored-by: rodrigouroz <384037+rodrigouroz@users.noreply.github.com> Co-authored-by: Tak Hoffman <781889+Takhoffman@users.noreply.github.com>
… thanks @rodrigouroz Verified: - pnpm install --frozen-lockfile - pnpm build - pnpm check - pnpm test:macmini Co-authored-by: rodrigouroz <384037+rodrigouroz@users.noreply.github.com> Co-authored-by: Tak Hoffman <781889+Takhoffman@users.noreply.github.com>
… thanks @rodrigouroz Verified: - pnpm install --frozen-lockfile - pnpm build - pnpm check - pnpm test:macmini Co-authored-by: rodrigouroz <384037+rodrigouroz@users.noreply.github.com> Co-authored-by: Tak Hoffman <781889+Takhoffman@users.noreply.github.com>
Summary
Describe the problem and fix in 2–5 bullets:
Change Type (select all)
Scope (select all touched areas)
Linked Issue/PR
User-visible / Behavior Changes
Security Impact (required)
No)No)No)No)No)Yes, explain risk + mitigation:Repro + Verification
Environment
Steps
pnpm vitest run src/agents/compaction.identifier-preservation.test.tspnpm tsgoExpected
Actual
pnpm tsgopassed.Evidence
Attach at least one:
Human Verification (required)
What you personally verified (not just CI), and how:
Compatibility / Migration
Yes)No)No)Failure Recovery (if this breaks)
src/agents/compaction.tsRisks and Mitigations
List only real risks for this PR. Add/remove entries as needed. If none, write
None.Greptile Summary
This PR hardens compaction summarization to preserve opaque identifiers (UUIDs, IDs, tokens, hostnames, IPs, ports, URLs, file names) by prepending identifier-preservation instructions to all summarization prompts.
Key changes:
buildCompactionSummarizationInstructions()helper that always prepends identifier-preservation guidance before any custom instructionssummarizeChunks()to usebuildCompactionSummarizationInstructions()instead of passing rawcustomInstructionssummarizeInStages()to avoid duplicating "Additional focus:" headers<string>toSetinui/src/ui/external-link.ts:7Confidence Score: 5/5
Last reviewed commit: c4bf3ff