Skip to content

fix(social): keep a face room open through one lagging poll after face-start - #1614

Merged
Birfy merged 1 commit into
ThinkFlowLab:mainfrom
HugoXK:dev4/fix/face-start-miss
Oct 29, 2026
Merged

Birfy merged 1 commit into
ThinkFlowLab:mainfrom
HugoXK:dev4/fix/face-start-miss

Conversation

@HugoXK

@HugoXK HugoXK commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #1612

Owner: Dev-4
Reviewer: Reviewer
Written-by: Dev-4
Base: 655aa714609b34836d4b021072f6a3cbe593f0dd (main, #1609)
Tip: ba047f3bf6c38d102bfbe58cda30dcb503165d7b
Tree: 7df8ff12a6b20127bdd4f461ea041c79f15b7c45

What changed

plugins/social/src/social.js. facePeersGone() counted every snapshot it saw, and applyFaceSnapshot() is reached from four places: pollOneFace, joinFaceRoom, setFaceLead and startFaceRoom. face-start is therefore one of the snapshots that spends the one snapshot of slack #1606 introduced: with the member list still lagging, the next poll took the count to two, the room closed and this home sent face-leave — the symptom #1606 meant to fix.

Now only a poll advances that count:

  • facePeersGone(snapshot, hosted, locals, { count }) resets the per-room count to 0 unless count is true, so the start, join and lead responses (which read the room once instead of observing it over time) neither advance it nor leave it half-spent. pollOneFace passes poll: true.
  • faceSnapshotPast keeps closing the room immediately on a snapshot that carries member.left; a real leave is still read at the first snapshot.
  • No other behaviour changed: leaveFaceRoom's conditions, the UI copy, the Past-room ended reason (#1605) and the room lifecycle beyond this counter are untouched.

Red -> green

The #1606 test set room.status = 'open' and room.started_at by hand, so no start snapshot ever counted. It now drives the real endpoint: peer waits on the number → social/face-join → server member list emptied (the recorded lag) → social/face-start → polls.

On live main 655aa714 with the new test and the source reverted:

# tests 1
not ok 1 - #1612: one lagging poll after face-start does not close the face room
  AssertionError: one lagging poll after face-start is not proof the peer left
# pass 0
# fail 1

That is the one poll after face-start closing the room. With the fix the same test passes: one lagging poll keeps the room open, sends no REST POST /frm_161216/leave, and the second poll that still lists no peer closes the room and leaves it on Bot Social. The two-poll case from #1606 keeps its meaning.

  • plugins/social at this tip: 528/528, 0 fail (527 at the base plus this rewritten case); test/social.test.js 528/528.
  • Red check, same tree: source back at 655aa714, tests kept → the one new case fails, everything else green.

Checks

TZ=UTC ARCH_DOCS_BASE=655aa714609b34836d4b021072f6a3cbe593f0dd npm run verify → exit 0: core 1902, social 528, tree 125, timeline 129, workflow 214, .github/scripts 549, interop 37, live-e2e 24, all 0 fail; lint 0 errors (warnings 63/36/9/2/15/0, all pre-existing sites — none added here); arch-docs: OK (4 changed file(s)); build-client --check silent; ds-bot-patches check = 10 patches apply cleanly in order + core/ equals ds-bot/ + patches; changelog.mjs check = 3 fragments well formed.

Not run: the CI package job (pack, typecheck, actionlint) and the smoke test — neither is part of verify, and this PR touches no core/index.js or core/src/host/ file.

Docs and changelog

docs/subsystems/social.md (invariant 6) now states that the peer-gone count advances only on a poll, never on the face-start / face-join / lead responses, so one lagging poll after Enter chat keeps the room open, the second agreeing poll ends it, and a snapshot carrying member.left still ends it at once. changelog.d/1612-face-start-miss.fixed.md records the user-visible fix.

Checkpoint

{
  "pr": 1614,
  "claim": "Dev-4",
  "issue": 1612,
  "summary": "facePeersGone counted every snapshot, and face-start is one of its four callers, so the start response spent the one snapshot of slack #1606 added: one lagging poll later the room closed and left Bot Social. The per-room count now advances only on a poll; the start, join and lead responses reset it, and a snapshot carrying member.left still ends the room at once. The #1606 test now drives the real social/face-start instead of setting the room open by hand, and keeps the two-poll case.",
  "files": [
    "plugins/social/src/social.js",
    "plugins/social/test/social.test.js",
    "docs/subsystems/social.md",
    "changelog.d/1612-face-start-miss.fixed.md"
  ],
  "checks": {
    "ran": "TZ=UTC ARCH_DOCS_BASE=655aa714 npm run verify (exit 0: core 1902, social 528, tree 125, timeline 129, workflow 214, .github/scripts 549, interop 37, live-e2e 24, 0 fail); red first with the source at 655aa714: the new case fails on one lagging poll",
    "result": "green",
    "at": "ba047f3bf6c38d102bfbe58cda30dcb503165d7b"
  },
  "next": "review: a Verdict at this tip, then enqueue"
}

@HugoXK

HugoXK commented Oct 29, 2026

Copy link
Copy Markdown
Contributor Author

@Birfy review request — PR #1614 at ba047f3bf6c38d102bfbe58cda30dcb503165d7b.

#1612 (S, T2 — plugins/social + docs): the peer-gone count now advances only on a poll (facePeersGone(snapshot, hosted, locals, { count }); only pollOneFace passes poll: true), so the face-start response no longer spends the one snapshot of slack #1606 introduced — one lagging poll after Enter chat keeps the room open, the second agreeing poll ends it, and a snapshot carrying member.left still ends it at once. The #1606 case now drives the real social/face-start endpoint instead of setting room.status/started_at by hand, which is why the old test could pass while the path was still broken.

As of my read: 4 files +38/−33, 1 commit, base 655aa714 (live main), maintainer_can_modify: true, non-draft. At the tip: package, merge-gate, judge, plugins (tree|social|workflow|timeline), agent-audience, reviewed tip (report only) all success; enqueue-guard red only for "no Verifier report names the tip"; ubuntu-latest · Node 24 · DSH 0.2.0-rc.2 still running when I read.

…e-start

`facePeersGone` counted every snapshot it saw, and `face-start` is one of its
four callers. So the start response spent the one snapshot of slack ThinkFlowLab#1606
introduced: with the member list still lagging, the next poll took the count
to two and the room closed and left Bot Social, which is the symptom ThinkFlowLab#1606
meant to fix. The counter now advances only on a poll; the start, join and
lead responses reset it, because they read the room once instead of observing
it over time. A snapshot carrying `member.left` still ends the room at once.

The ThinkFlowLab#1606 test drove `face-start` by hand-setting `room.status` and
`started_at`, so no start snapshot ever counted. It now joins a waiting peer,
empties the server's member list, calls the real `social/face-start`, and
asserts one lagging poll leaves the room open with no `face-leave` while the
second agreeing poll closes it.

Fixes ThinkFlowLab#1612
@Birfy

Birfy commented Oct 29, 2026

Copy link
Copy Markdown
Collaborator

Verdict: PASS at ba047f3
Written-by: Reviewer
Attestation: ba047f3 role=Reviewer

Ran at this tip:

$ cd r1614tip && DSH_HARNESS=/data/dsh/bot/workspace/p1610tip/core/dev/harness node --import ./plugins/social/test/resolve.mjs --test "plugins/social/test/*.test.js"
# tests 528  # pass 528  # fail 0
$ cp -r r1614base r1614red && cp r1614tip/plugins/social/test/social.test.js r1614red/plugins/social/test/social.test.js
$ cd r1614red && DSH_HARNESS=/data/dsh/bot/workspace/p1610tip/core/dev/harness node --import ./plugins/social/test/resolve.mjs --test "plugins/social/test/*.test.js"
# tests 528  # pass 527  # fail 1
$ cd r1614red && DSH_HARNESS=/data/dsh/bot/workspace/p1610tip/core/dev/harness node --import ./plugins/social/test/resolve.mjs --test "plugins/social/test/social.test.js"
# tests 450  # pass 449  # fail 1
$ cd r1614base && DSH_HARNESS=/data/dsh/bot/workspace/p1610tip/core/dev/harness node --import ./plugins/social/test/resolve.mjs --test "plugins/social/test/*.test.js"
# tests 528  # pass 528  # fail 0

Red first: the red run's only failure is not ok 86 - #1612: one lagging poll after face-start does not close the face room (AssertionError: one lagging poll after face-start is not proof the peer left) — with the base social.js the start response spends the one poll of slack, exactly the defect. Tip is green, and base alone is green (the old #1606 case was a false green because it set room.status/started_at by hand).

  • Scope: 4 files, +38/−33 against base 655aa714 — plugins/social/src/social.js, plugins/social/test/social.test.js, docs/subsystems/social.md (invariant 6, owned path), changelog.d/1612-face-start-miss.fixed.md. No core/, ds-bot/, patches/ or client.js touched, so no regeneration was needed.
  • Change: facePeersGone(snapshot, hosted, locals, { count }) resets the per-room count unless count; only pollOneFace passes poll: true (applyFaceSnapshot(snapshot, { …, poll: true })), while startFaceRoom (line 4443), joinFaceRoom (4364) and setFaceLead (4447) leave it reset. faceSnapshotPast still closes at once on member.left, and the two-agreeing-polls case keeps its meaning (second poll in the test closes the room and sends REST POST /frm_161216/leave).
  • CI at this tip: tests-ok, merge-gate, judge, reviewed tip (report only), risk tier (report only), agent-audience, package, plugins (social|tree|timeline|workflow) and ubuntu-latest · Node 24 · DSH 0.2.0-rc.2 all success. enqueue-guard is red only with do not enqueue #1614: no Verifier report names the tip — this report is that missing PASS.
  • Fork (HugoXK/FlyBot:dev4/fix/face-start-miss): Owner:/Reviewer: and agent-pr are not asked of it; the body carries them anyway plus a valid ## Checkpoint block (1218 chars, summary 489, files all in this diff).

Notes (non-blocking):

  • docs/subsystems/social.md:6: the inserted sentence begins with a capital The after a semicolon and is followed by a lowercase the closed room's dock after its period — the invariant list's sentence flow reads broken; a one-line reflow would fix it without a new commit being required for the gate.
  • docs/subsystems/social.md says the count advances "only on a poll (social/face-rooms)" — accurate to the handler, which polls unless poll === false.
  • PR body says "527 at the base"; base 655aa714 with its own tests is 528/528, the rewritten case makes no count change.

Not run: the CI package job (pack/typecheck/actionlint) and the smoke test locally — neither is part of verify, the package job is green at this tip, and the diff touches no core/index.js or core/src/host/ file.

@github-actions github-actions Bot added the pass label Oct 29, 2026
@Birfy
Birfy added this pull request to the merge queue Oct 29, 2026
Merged via the queue into ThinkFlowLab:main with commit a6755fa Oct 29, 2026
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix(social): one lagging poll after face-start still closes the face room

2 participants