Files
PaperClipAI/packages
Nicky LeachandPaperclip 0fe47882cf Allow configurable Runner listening ports (#15353)
## Thinking Path

> - Paperclip is the open source app people use to manage AI agents for
work.
> - Paperclip Runner supports authenticated provider ingress.
> - Each listening Runner currently binds port 43127.
> - Concurrent Runner processes on one computer need distinct listening
ports.
> - This pull request permits an explicit listening port and retains the
default.
> - Providers can route each run without changing the Runner protocol.

## Linked Issues or Issue Description

**Subsystem affected**

Paperclip Runner launch and durable transport.

**Problem or motivation**

Two listening Runner processes in one network namespace cannot bind the
same fixed port. The CLI accepts a port flag but rejects every value
except 43127.

**Proposed solution**

Accept `--listen-port` values from 1 through 65535. Default to 43127
when the flag is omitted. Preserve the wildcard bind address, exact run
path, PRP authentication, and secure frames. A warm attachment retains
its existing listening port.

**Alternatives considered**

Separate network namespaces or a shared Runner daemon need more changes.
Configurable launch ports preserve the existing process model.

**Roadmap alignment**

This extends existing Cloud / Sandbox agent support. The duplicate
search found no matching Runner listener-port change.

## What Changed

- Default an omitted listener port to 43127 and reject invalid values.
- Validate configurable ports in the durable transport.
- Reuse the selected port during warm attachment and reject port
changes.
- Cover default and explicit ports, invalid input, concurrent listeners,
and warm attachment.
- Update transport documentation. Daytona still uses its existing
default port.

## Verification

- Native `cargo test --locked --workspace` passed (two existing tests
ignored).
- Targeted listener and CLI tests passed, including executable launches
on two concurrent ports and warm listener retention.
- `pnpm -r typecheck` and `pnpm build` passed.
- Complete GitHub CI is green, including general and serialized test
suites, all browser shards, Runner Rust/Vitest lanes, builds, and
release checks.
- The additional full local `pnpm test:run` is still running; no final
local result is claimed.
- `git diff --check` passes.

## Risks

An explicit port can already be occupied. Runner fails its bind without
choosing a different port. Port allocation and ingress authorization
remain provider responsibilities. No schema or PRP wire format changes.
Existing explicit port 43127 callers continue to work.

## Model Used

OpenAI Codex, GPT-6 family, with reasoning, repository inspection, and
code execution. The session does not expose the exact model ID or
context window.

## 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 (only public GitHub `#NNN` / `github.com/paperclipai/paperclip`
URLs)
- [x] My branch name describes the change (e.g. `docs/...`, `fix/...`)
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>
2026-10-06 09:52:41 -07:00
..