Repository navigation
feat(scripts): --peer runs two peered live-test servers - #555
Merged
Merged
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Merged
5 of 7 tasks
Jacksondr5
force-pushed
the
j5code/live-test-peer
branch
from
October 12, 2026 04:05
4a6b2e7 to
32130b1
Compare
Jacksondr5
force-pushed
the
j5code/live-test-peer
branch
from
October 12, 2026 04:06
32130b1 to
0055f90
Compare
Jacksondr5
force-pushed
the
j5code/live-test-peer
branch
from
October 12, 2026 04:09
0055f90 to
d82f7db
Compare
Jacksondr5
added a commit
that referenced
this pull request
Oct 12, 2026
…nd reports peering honestly Review fixes for #555: - Local's and Remote's homes, and their state directories, must resolve to different places before anything is started. - One time budget covers the builds, both server waits and the peering attempts, so a start returns inside a two-minute shell call. - The output says the two are peered only when peering succeeded on the start they are running from, and says how to redo it when it did not. - A failed peering attempt reports what the peer command said. Part of #546. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A start or rebuild with --peer builds two homes, each with the test project, and runs two dev servers named Local and Remote. Remote is server-only on its own port. The script peers them through the server's own peer commands, both ways, or with --poll so that Remote polls Local. It prints both servers and a link that adds Remote to a browser already paired with Local. Every command acts on both servers, each proved by its leader's identity as before. Part of #546. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…nd reports peering honestly Review fixes for #555: - Local's and Remote's homes, and their state directories, must resolve to different places before anything is started. - One time budget covers the builds, both server waits and the peering attempts, so a start returns inside a two-minute shell call. - The output says the two are peered only when peering succeeded on the start they are running from, and says how to redo it when it did not. - A failed peering attempt reports what the peer command said. Part of #546. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The output says the two are peered when each server's own peer list names the other, and otherwise says they are not peered yet and gives the start command that finishes the job. Remote's repository must also be a different directory from Local's. Part of #546. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…the browser A rebuild gives both servers new ids, and the browser keeps the old Remote entry, so adding the new one made a duplicate with a mismatch error. Part of #546. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Jacksondr5
force-pushed
the
j5code/live-test-peer
branch
from
October 12, 2026 04:46
de18fe9 to
c0fa7c0
Compare
The environment-id requests and the peer commands are given the time that is left, and the deadline is checked before each one, so a server that accepts and never answers cannot hold the command past its budget. The budget is 100 seconds, leaving room to mint the pairing URLs afterwards, and a start that has just peered the servers does not ask them again before printing. Part of #546. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The refusal said both servers were running, which is wrong when peering failed because one of them had just gone. Part of #546. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A server that accepts and never answers could hang status in peer mode. A list that does not arrive within fifteen seconds counts as no evidence of peering. Part of #546. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This was referenced Oct 12, 2026
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Peering and cross-server messaging had almost no live coverage, because standing up two servers and peering them took a hand-built rig each time. Part of #546 (stage 3, second of five stacked PRs; based on #554).
What changed
A start or
rebuildtakes--peer, or--peer --poll:home/andtest-repo/for Local,remote/home/andremote/test-repo/for Remote, all under.j5code/live-test/. Remote's paths get the same containment checks as Local's on every command.dev:server), on its own port: it gets a dev instance named after the worktree, so it does not derive Local's ports and two worktrees do not collide. They are named withJ5CODE_SERVER_NAME. Remote allows Local's web origin (T3CODE_DEV_ALLOWED_ORIGINS) so the browser can reach it.a2a peer credentialandpeer addagainst each home, the stepsscripts/j5/pr-env.sh --peeruses, with its retry (five attempts, three seconds apart) because a server that is seconds old can miss the first hello. With--poll, only Remote holds a credential: Local stores its messages and Remote polls for them. Peering is repeated on every start; it rotates the credential and the record, so it leaves one clean pair.stopclassifies both before signalling either.statusprints the full block only when both are running.<local web>/pair?host=<remote origin>&label=Remote#token=<a token minted for Remote>).A loopback server offers no peer addresses in the UI. That does not matter here, because peering is done from the command line.
Live testing
On 2026-10-11, from this branch's worktree, through the Browser panel.
Exercised:
rebuild --peer: 78 s for two builds, two starts and peering. Both servers report their names; each lists the other as "sends directly both ways".Paired a clean incognito tab with Local, then opened the printed add-Remote link: Settings > Connections shows Remote "Connected" under Environments and under Peer servers.
An agent on Local reached an agent on Remote. A Claude Haiku 4.5 thread on Local called
j5_list_participantsand reported 40 participants across two servers, with Remote's marked "Remote". It then sent "hello from Local, reply with the word PONG" to Remote's "Replay fixture: multi_turn (Codex)". Remote's event log shows the message arriving at 03:35:39 with the envelope "... on Local", a run ongpt-6-luna, and the reply "PONG" at 03:35:46.status,restart(28 s, re-peers),stopfor both servers; both ports free afterwards.--peer --pollon a--peerbuild is refused with the two commands.rebuild --peer --poll: Local lists Remote as "polls this server for its messages", online; Remote lists Local as "this server polls it".The default mode still builds, starts and stops after the restructure.
A message in poll mode. On a
--peer --pollbuild, a GPT-6-Luna thread on Local sent "poll mode hello from Local, reply with the word POLLPONG" to Remote's "multi_turn (Codex)". Remote's event log shows it arriving at 04:20:17 with the "on Local" envelope and the reply "POLLPONG" at 04:20:22 ongpt-6-luna.I removed Remote's peer record by hand while both servers ran:
statussaid "NOT peered yet" and named the start command; running it re-peered them andstatussaid peered again.Not exercised live:
Found while testing, not caused by this PR:
ListAgentstool, which returned real Claude sessions on this machine, not the test servers' participants. It messaged none of them. A test agent can see, and could message, real sessions that way. It needed the J5 tool named before it usedj5_list_participants.Checklist
FORK.md(case text and file-table row) in this PR (none edited)docs/j5/product/upstream.md(none)AGENTS.md). Local and loopback only;stopandrebuildare the way out. Claude sent and Codex received.docs/j5/product/and user docs rewritten where this changes them (the skill text is in docs(j5): agents live-test with one setup script, the Browser panel and a testing skill #549)Tests:
vp test run scripts/j5/setup-agent-live-test.test.ts(29 pass): flag parsing for both peer modes and the combinations that are refused, thepeer credentialandpeer addarguments for both directions and for poll mode, the add-Remote link, and the containment check on Remote's home. Typecheck and lint are clean on the touched files.Built with Claude Opus 5.5 in Claude Code.
🤖 Generated with Claude Code