Skip to content

feat(context): add CPG-10 large text-part tool-result projection - #26

Open
Wibias wants to merge 9 commits into
agent/context-projection-cp09-deferredfrom
agent/context-projection-cp10
Open

feat(context): add CPG-10 large text-part tool-result projection#26
Wibias wants to merge 9 commits into
agent/context-projection-cp09-deferredfrom
agent/context-projection-cp10

Conversation

@Wibias

@Wibias Wibias commented Aug 16, 2026

Copy link
Copy Markdown
Owner

Summary

  • Start CPG-10 on top of CPG-09: project a large tool-result when Codex wraps the output as a single text part instead of a bare string.
  • Mixed image+text tool results and empty string results stay unprojected.
  • This does not yet cover Codex empty/redacted file reads. It only recognizes large text that already survived parsing as tool-result content parts.

Verification

  • bun test tests/context-projection-projector.test.ts tests/context-projection-recovery-live.test.ts tests/context-projection-duplicate-live.test.ts
  • 34 pass / 0 fail

Checklist

  • Scope stays focused and avoids unrelated cleanup.
  • Docs or release notes were updated when needed.
  • Security-sensitive changes were reviewed for secrets, auth, and unsafe defaults.

@github-actions

Copy link
Copy Markdown

Deterministic PR hygiene checks passed.

@coderabbitai

coderabbitai Bot commented Aug 16, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

🗂️ Base branches to auto review (2)
  • ^dev$
  • ^preview$

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 87aabe20-722a-427e-b13f-88db9c949479

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions github-actions Bot added the enhancement New feature or request label Aug 16, 2026
@Wibias
Wibias force-pushed the agent/context-projection-cp09-deferred branch from cb8ff73 to 99e0ede Compare August 16, 2026 23:22
Wibias added 7 commits August 17, 2026 01:22
CPG-10 first slice: Codex sometimes wraps file/tool output as a single text part instead of a bare string. Project that part when it is the only content, and leave mixed image+text or empty results untouched.
Codex probe A never delivered the 184KiB inventory as parsed tool text. Keep empty results and Responses file placeholders unprojected so CPG-10 cannot invent bytes that are not in context.
CPG-10 second slice: Codex may wrap file output as input_file instead of a bare string. Preserve that UTF-8 text so the projector can see it, and keep base64/data-URL attachments as placeholders.
When a likely file-read tool result parses empty, record only type and length metadata. This gives CPG-10 evidence for the next Codex probe without storing file contents.
The first Codex file-read probe produced an empty tool result but no capture line. Log type and length for any empty function_call_output, not only guessed file-read tool names.
…olders

The Codex file-read turn produced an empty result but no capture line on function_call_output. Also inspect custom_tool_call_output and short file/encrypted placeholders so the next probe logs a wire shape.
Codex empty file-reads produced no function_call_output capture. Summarize the last input item types and output lengths before schema parse, with no file contents, so the next Codex probe can show the actual wire shape.
@Wibias
Wibias force-pushed the agent/context-projection-cp10 branch from bd3cd91 to 26a29d9 Compare August 16, 2026 23:23
@Wibias
Wibias marked this pull request as ready for review August 17, 2026 03:30
output: unknown,
): void {
const emptyContent = content === "" || (Array.isArray(content) && content.length === 0);
const placeholder = typeof content === "string" && content.length > 0 && content.length < 80 && (content.startsWith("[file:") || content.startsWith("[encrypted"));

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The check content.startsWith("[encrypted") is incomplete and will incorrectly match unintended strings.

The condition checks for strings starting with "[encrypted" without completing the word or adding a delimiter. This would match unintended strings like "[encryptedXXX" or "[encryptedfile.txt]".

Looking at parser.ts line 258, the actual placeholder text is "[encrypted content omitted]". The check should match the actual format:

const placeholder = typeof content === "string" && content.length > 0 && content.length < 80 && (content.startsWith("[file:") || content.startsWith("[encrypted "));

This ensures consistency with the "[file:" check (which includes the colon) and prevents false positives.

Suggested change
const placeholder = typeof content === "string" && content.length > 0 && content.length < 80 && (content.startsWith("[file:") || content.startsWith("[encrypted"));
const placeholder = typeof content === "string" && content.length > 0 && content.length < 80 && (content.startsWith("[file:") || content.startsWith("[encrypted "));

Spotted by Graphite

Fix in Graphite


Is this helpful? React 👍 or 👎 to let us know.

Wibias added 2 commits August 17, 2026 07:27
Identify the live 47-char custom_tool_call_output without storing file dumps. Record that Codex exec strips the 184 KiB inventory before /v1/responses.
Match the parser marker [encrypted content omitted] and ignore adjacent words like [encryptedfile.txt].
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant