turborepo-fix-preserve-package-json

Based on#12376
SegmentInvestigate-and-fix
Typebug
## Task

running `turbo prune` on a monorepo with pnpm patches gives us a pruned output we can ship to docker, but builds inside that pruned output always miss the upstream cache. every build acts like a cold rebuild, even when nothing about the package's deps actually changed. we seem to only see this when pnpm patches are in the mix. repos without patches seem to prune and cache just fine. diagnose and ship a fix.

## General instructions

- The code repo is at /repo/turborepo.
- You are inside of a Docker container. You may not be able to perform all operations you would normally be able to do on a local machine. Dependencies have not been pre-installed, and you may need to install them yourself.
- You are expected to act autonomously as a software engineer to complete tasks you are given.
- Do not stop until you feel you have completed the task and your code changes can be merged.
- You may need to use software engineering skills like analyzing the codebase, researching technologies, running services, analyzing logs, etc. to complete the task. Not all tasks will be solvable by reading source code alone.

Agent Results

AgentTastefulBasicVerifierValidationRubricBloatPractTasteCheated
Oracle
3/31.0x5.04.0
GLM-5.2
1/30.6x3.02.0
GPT-5.4
1/30.5x4.02.0
Opus 4.7
1/31.1x3.02.0
Gemini 3.1 Pro
0/30.3x3.02.0
Gemini 3.5 Flash
0/30.0x5.03.0
GPT-5.5
0/30.8x4.02.0
Kimi K2.6
Opus 4.8
0/32.5x3.02.0
Sonnet 4.6
0/31.0x3.02.0
Sonnet 5
No-Op
0/3
Agent details

Verifier Tests

Gemini 3.1 Pro0/3

Taste Scores

Patch Bloat0.3x
28 agent / 108 oracle SLOC, 1 / 2 files(raw: 2.6x)
Practice Alignment — 3.0/5
3
style consistency
3
pattern adherence
4
library usage
3
abstraction level
2
documentation fit
Relative Taste — 2.0/5
3
minimality
2
approach quality
2
hygiene
3
fluency
2
craftsmanship

Agent Patch