Make context snapshot text rendering consistent (#44976)

## What changed

- Use the same text rendering for model instructions in request settings and Responses Lite developer content.
- Make `rewrite_known_segments` emit plain tags for recognized guidance, including collaboration and multi-agent instructions. Check message roles and complete tag boundaries so lookalike user or tool content stays visible, and retain generated compaction summaries.
- Normalize working-directory, workspace-root, and temporary paths in permission guidance while preserving policy differences.
- Separate text clipping from normalization and retain eight lines at each end of long sections, with fingerprints for omitted content. Update affected snapshots.

## Testing

Add regression coverage for instruction rendering across transports, literal and rewritten guidance, malformed and lookalike tags, compaction summary preservation, and permission path normalization that keeps policy changes detectable.

GitOrigin-RevId: 33b052911323c73b0387d650478f9cc3370fd001
This commit is contained in:
pakrym-oai authored and copyberry committed 2026-09-12 05:04:11 +00:00
1 parent aee8a55ab6
commit c4017a87aa
31 files changed
+973 -753

No files matched your search

@@ -9,11 +9,11 @@ Scenario: First request after fork when startup preserves the parent baseline, t
00:message/developer:
<PERMISSIONS_INSTRUCTIONS>
01:message/user:
<ENVIRONMENT_CONTEXT:cwd=<CWD>>
<ENVIRONMENT_CONTEXT>
02:message/user:
fork seed
03:message/developer[2]:
[01] <PERMISSIONS_INSTRUCTIONS>
[02] <collaboration_mode>Fork turn collaboration instructions.</collaboration_mode>
[02] <COLLABORATION_MODE>
04:message/user:
after fork