electric-fix-resolve-pending-shapes

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

it looks like pg replication slot lag is growing unbounded on prod stacks. the flush lsn we send back to the db just stops advancing. clients are still getting new data, storage is still writing, nothing crashes. lag keeps growing for hours until someone restarts the stack.
it always seems to happen right after a txn whose changes spanned multiple wal fragments.
find what's causing the global flush boundary to get stuck and fix it. note: the upstream tracker should only see flush acks at txn boundaries.

## General instructions

- The code repo is at /repo/electric.
- 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.001.0x5.04.0
GLM-5.2
3/30.670.4x3.02.0
Opus 4.7
3/30.330.5x3.02.0
Opus 4.8
3/31.000.5x3.02.0
Gemini 3.1 Pro
1/30.330.1x2.02.0
Gemini 3.5 Flash
1/30.33
GPT-5.4
1/30.331.1x4.02.0
GPT-5.5
1/30.331.3x4.02.0
Kimi K2.6
1/30.330.1x3.02.0
Sonnet 4.6
1/30.330.2x4.02.0
Sonnet 5
1/30.330.1x3.03.0
No-Op
1/30.33
Agent details

Verifier Tests

Gemini 3.1 Pro1/3

Rubric Criteria

Gemini 3.1 Pro1/3
Fail → Pass
flush_acknowledgement_deferred_during_pending_txn
all_terminal_txn_paths_emit_deferred_flush
Pass → Pass
single_fragment_flush_not_regressed

Taste Scores

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

Agent Patch