Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,28 @@

> **Note:** Versions 0.3.26 – 0.3.55 were released as git tags without changelog entries. Changelog resumes at 0.3.56 below.

## 0.5.5

### Fixed

- **Stale-prior threshold lowered from 10s to 1s.** v0.5.3+v0.5.4
introduced lastSeen-aware stale detection in the inbound-connection
and `_createPeer` dedup paths, with the threshold tied to
`_heartbeatInterval` (default 10s). Field testing showed this was too
lenient: when a peer process was killed and quickly relaunched, the
old run had typically sent a CMB seconds before death, so `lastSeen`
was still within the 10s window. The dedup logic then rejected the
legitimate redial as a same-direction-duplicate, producing
`connection ready → immediate disconnect` with no handshake-complete
on the dialing side.

Lowered to a hardcoded 1s threshold in both dedup paths.
Sub-second TCP-retry races during initial handshake still keep prior
(the case the same-direction-duplicate rule was designed for); peer
restarts with ≥1s between kill and re-dial now recover within the
application layer instead of being blocked until OS keepalive reaps
the underlying socket (~100s).

## 0.5.4

### Fixed
Expand Down
10 changes: 9 additions & 1 deletion lib/node.js
Original file line number Diff line number Diff line change
Expand Up @@ -549,8 +549,16 @@ class SymNode extends EventEmitter {
// restarting peer reconnects within seconds, long enough that
// a momentary lull during initial handshake doesn't trip it.
const staleByFlag = !prev || prev._closed;
// 1-second threshold (NOT _heartbeatInterval=10s). When a peer
// process is killed and quickly relaunches, its old run sent a
// CMB seconds before death, so lastSeen is still recent. A 10s
// threshold misses this and the dedup-reject path kills the
// legitimate redial. 1s tolerates sub-second TCP-retry races
// during initial handshake while letting normal peer-restart
// (≥1s gap between kill and re-dial) recover within the
// application layer.
const staleByLastSeen = existingPeer.lastSeen
&& (Date.now() - existingPeer.lastSeen) > this._heartbeatInterval;
&& (Date.now() - existingPeer.lastSeen) > 1000;
const stalePrior = staleByFlag || staleByLastSeen;
if (!stalePrior) {
// Determine prior direction. The peer's `isOutbound` field reflects
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@sym-bot/sym",
"version": "0.5.4",
"version": "0.5.5",
"description": "Infrastructure and protocol for multi-agent collective intelligence",
"main": "lib/node.js",
"bin": {
Expand Down