electric-fix-classify-admission-control

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

We've had reports of the sync service having problems throttling under load.

The first problem we've seen is whenever a stack is redeployed or restarted, the clients
that reconnect to shapes they were already subscribed to start getting
`503` "concurrent request limit exceeded" responses in large numbers, but these
reconnections are supposed to be cheap.

The second problem seems to be with the safeguard that is meant to cap how
many new shape subscriptions can be set up at once doesn't always hold.
Some requests that really do spin up a new subscription manage to slip
past the cap.

Can you look into these and implement a fix?

## 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
5/51.001.0x5.04.0
Opus 4.8
5/51.000.4x4.03.0
Gemini 3.1 Pro
5/50.750.1x3.02.0
GPT-5.4
5/51.000.3x3.02.0
GPT-5.5
5/51.000.3x3.02.0
Opus 4.7
5/50.1x3.02.0
Gemini 3.5 Flash
4/51.000.1x3.02.0
GLM-5.2
3/50.3x4.02.0
Kimi K2.6
3/50.500.1x3.02.0
Sonnet 4.6
3/50.500.1x3.03.0
Sonnet 5
No-Op
3/50.50
Agent details

Verifier Tests

Gemini 3.1 Pro5/5

Rubric Criteria

Gemini 3.1 Pro3/4
Fail → Pass
root_cause_identified
Pass → Pass
no_request_handle_mutation
ets_startup_race_resilience
permit_released_all_paths

Taste Scores

Patch Bloat0.1x
22 agent / 264 oracle SLOC, 1 / 1 files
Practice Alignment — 3.0/5
3
style consistency
2
pattern adherence
3
library usage
2
abstraction level
3
documentation fit
Relative Taste — 2.0/5
2
minimality
2
approach quality
2
hygiene
2
fluency
2
craftsmanship

Agent Patch