mirror of
https://github.com/paperclipai/paperclip.git
synced 2026-10-06 21:05:21 +02:00
## Thinking Path
> - Paperclip is the open source app people use to manage AI agents for
work.
> - The server manages duplex channels that carry data between workers
and hosts.
> - The aggregate byte-ledger ceiling test can race the channel bind.
> - The race can make channel open fail before the test checks the
ceiling rejection.
> - This pull request writes one byte after the open call binds the
channel.
> - The test now checks the post-bind rejection and the retained-byte
count.
> - The benefit is a stable test that checks the intended byte-ledger
behavior.
## Linked Issues or Issue Description
**What happened?**
The duplex aggregate byte-ledger ceiling test scripted data during
channel open. Under load, the host could process the data notification
before the open continuation bound the route. The test then saw
`DUPLEX_CHANNEL_OPEN_FAILED` instead of the intended post-bind
rejection.
**Expected behavior**
The test must open the channel first. It must then write one byte and
confirm that the serialized host-to-worker frame exceeds the four-byte
ceiling. The route must reject the write and retain no bytes.
**Steps to reproduce**
1. Run the focused server test file.
2. Repeat the test several times under load.
3. Observe that the old test can fail during channel open.
4. Run the updated test and confirm the post-bind rejection.
**Paperclip version or commit**
b64fbcd5b2
**Deployment mode**
Built from source with the server test runner.
**Installation method**
Built from source.
**Agent adapter(s) involved**
Not adapter-specific (core test).
**Database mode**
Not database-related.
**Additional context**
The change keeps the test-only scope to one file. A previous dependency
change used a separate pull request. This pull request covers the duplex
byte-ledger test fix only.
## What Changed
- Open the duplex channel without scripted data.
- Write one byte after the open call resolves.
- Update the test name and comments to describe the two reservations.
- Keep the change limited to
`server/src/__tests__/plugin-worker-manager-duplex-byte-ledger.test.ts`.
## Verification
- The focused test file passed five consecutive runs before this pull
request opened.
- The test passed with the four-byte ceiling.
- A control run with a 4096-byte ceiling failed only in this test case.
- GitHub Actions must pass the server test suite and all required gates.
- Greptile must return 5/5 with no open findings.
## Risks
Low risk. The change updates one test file and adds no production code.
The test now depends on the open call completing before the write, which
matches the route bind contract.
## Model Used
OpenAI Codex, GPT-5, tool use and code execution. The execution platform
manages the exact context window details.
## Checklist
- [x] I have included a thinking path that traces from project context
to this change
- [x] I have specified the model used (with version and capability
details)
- [x] I have checked ROADMAP.md and confirmed this PR does not duplicate
planned core work
- [x] I have searched GitHub for duplicate or related PRs and linked
them above
- [x] I have either (a) linked existing issues with Fixes: # / Closes: #
/ Refs: # OR (b) described the issue in-PR following the relevant issue
template
- [x] I have not referenced internal/instance-local Paperclip issues or
links
- [x] My branch name describes the change and contains no internal
Paperclip ticket id or instance-derived details
- [x] I have run tests locally and they pass
- [x] I have added or updated tests where applicable
- [x] I have updated relevant documentation to reflect my changes
- [x] I have considered and documented any risks above
- [x] All Paperclip CI gates are green
- [x] Greptile is 5/5 with no open P2s, recommendations, or follow-ups
- [x] I will address all Greptile and reviewer comments before
requesting merge
Co-authored-by: Paperclip <noreply@paperclip.ing>