Skip to content

fix(codex): bound parent subagent previews - #4150

Closed
dwaxe wants to merge 1 commit into
getpaseo:mainfrom
dwaxe:dwaxe/bound-codex-subagent-snapshots
Closed

fix(codex): bound parent subagent previews#4150
dwaxe wants to merge 1 commit into
getpaseo:mainfrom
dwaxe:dwaxe/bound-codex-subagent-snapshots

Conversation

@dwaxe

@dwaxe dwaxe commented Sep 1, 2026

Copy link
Copy Markdown

Refs #2300

This removes the quadratic parent-copy path for Codex provider subagents.

  • keep canonical child activity in the provider-subagent timeline
  • limit parent snapshots to the latest 200 activities, 4 KiB per activity, and 32 KiB total
  • preserve UTF-8 boundaries and nested-parent updates without copying complete descendant logs

Regression coverage exercises large, nested, and multibyte child histories.

@dwaxe
dwaxe force-pushed the dwaxe/bound-codex-subagent-snapshots branch from a3f53f5 to 1851e48 Compare September 3, 2026 11:23
@greptile-apps

greptile-apps Bot commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

The PR bounds Codex parent sub-agent previews while retaining canonical child activity in provider-subagent timelines.

  • Limits parent previews by activity count, per-item UTF-8 byte size, and aggregate log size.
  • Rebuilds tool-call previews without serializing potentially large structured payloads.
  • Adds coverage for large prompts, errors, nested histories, recent-activity selection, and multibyte text.

Confidence Score: 4/5

The PR appears safe to merge after the non-blocking test-shape issue is cleaned up.

The production bounding path preserves canonical child activity and no concrete runtime regression remains, but two new regression tests violate the repository’s deterministic, conditional-free test-body convention.

Files Needing Attention: packages/server/src/server/agent/providers/codex-app-server-agent.test.ts

Important Files Changed

Filename Overview
packages/server/src/server/agent/providers/codex-app-server-agent.ts Adds UTF-8-safe truncation and bounded parent-preview projection while preserving separate canonical child events.
packages/server/src/server/agent/providers/codex-app-server-agent.test.ts Adds broad regression coverage for bounded previews, with two new test bodies using prohibited inline conditionals.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart LR
  C[Canonical child timeline] --> P[Select latest 200 activities]
  P --> I[Bound each activity to 4 KiB]
  I --> L[Curate parent log]
  L --> B[Bound parent log to 32 KiB]
  B --> R[Emit root parent snapshot]
  C --> S[Emit full provider-subagent activity]
Loading

Reviews (1): Last reviewed commit: "fix(codex): bound parent subagent previe..." | Re-trigger Greptile

Comment on lines +2730 to +2732

test("bounds the root sub-agent prompt in the complete emitted snapshot", () => {
const session = createSession();

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P2 Conditional test-body guards

These inline if guards mix assertion mechanics with branching and repeat the repository-prohibited conditional test-body pattern. Move snapshot narrowing into a helper or use deterministic assertions so failures remain direct.

Rule Used: # Code Review Pattern Reference: Slop, Tests, Feat... (source)

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

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.

1 participant