Repository navigation
fix(room-collab): watch defaults its presence name to the mxid's localpart - #4596
Conversation
…lpart `watch` called `set_presence` only when `--name` was given, so omitting it produced a connection that looked joined to the agent and absent to everyone else. A nameless peer is not rendered anywhere: the web client's `peersOf` skips an awareness state without a non-empty name, and the service's presence summary counts such a peer without naming it. That is the same silent-no-op shape as the `read`-instead-of-`watch` bug this follows — the command does not do the thing it appears to do, and nothing says so. An mxid already carries a usable name, and it is the one the summon hint fills in, so default to its localpart rather than requiring a flag nobody can tell they forgot. The derivation moves into `presence_name()` at module scope so it can be tested without a socket, rather than staying an inline expression inside `watch`'s connection loop. Verified: - tests/room-collab-presence-name-default.test.py — 10 cases: explicit name wins and is trimmed, blank falls through to the localpart, `@weird:host:port` takes only the localpart, and a malformed or empty id yields None so the caller skips `set_presence` rather than publishing an empty name the readers would drop anyway. Auto-discovered by scripts/discover-python-tests.sh, and it SKIPs cleanly where the room-collab deps are absent. - Two mutants killed: dropping the localpart branch fails "localpart: got None"; accepting any string as an mxid fails "malformed id: got 'ot-an-mxid'" — which is the exact garbage the `@`/`:` guard exists to reject. - review-checks and lint-workspace-resolution clean on the diff. Pairs with cinny-webclient #1190, whose summon hint passes `--name` explicitly; this is the floor for an agent that omits it. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
…test CI's old-collab-literals ratchet failed: the new test added one retired spelling (0 -> 1), and the ratchet forbids growth. The env var was not needed. It was defensive — room_doc.py makes its store directory at import — but this test loads the CLI module, whose client import sits inside functions, so nothing touches that path. Verified by running the test with and without the room-collab deps: both pass. One root cause, three red checks: the ratchet runs in 'python standalone tests (2/3)' and in typecheck's 'Lint skill manifests' step, and 'tsc + tests (clean install)' is the rollup that requires both. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
|
@cla-assistant check |
|
Blocking findings on
Changed files compile and Reviewed by Qingyun's Personal Codex. |
|
Current-head follow-up for The remaining blocker is still present in Formal request-changes is unavailable because this account authored the PR. Reviewed by Qingyun's Personal Codex. |
Coverage Gate✅ Diff coverage PASSES the 95% bar. Whole-tree (informational): 90%. Diff CoverageDiff: origin/main...HEAD, staged and unstaged changes
Summary
|
The problem
watchcalledset_presenceonly when--namewas given:Omit the flag and you get a connection that looks joined to the agent and absent to everyone else. A nameless peer is not rendered anywhere — the web client's
peersOfskips an awareness state without a non-empty name, and the service's presence summary counts such a peer without naming it.That is the same shape as the
read-instead-of-watchbug this follows: the command does not do the thing it appears to do, and nothing tells you. An mxid already carries a usable name — and it is the one the summon hint fills in — so the fix is to default to its localpart rather than require a flag nobody can tell they forgot.The change
The derivation moves to
presence_name()at module scope, so it is testable without a socket instead of being an inline expression insidewatch's connection loop:An explicit
--namestill wins. Nothing usable yieldsNone, and the caller then skipsset_presencerather than publishing an empty name the readers would drop anyway.Evidence
tests/room-collab-presence-name-default.test.py, 10 cases:Auto-discovered by
scripts/discover-python-tests.sh(confirmed: 1047 tests found, this one among them), and it SKIPs cleanly on a host without the room-collab deps rather than failing.Two mutants killed, because an assertion that cannot fail is not evidence:
The second is worth reading twice: without the
@/:guard,not-an-mxidbecomesot-an-mxid, which is precisely the garbage that guard exists to reject.review-checks: PASS (hardcoded-paths + root-artifacts + prose-cap clean).lint-workspace-resolution --diff: clean.Not verified
That the published name reaches a viewer end to end. The presence summary returns counts today, so a name is not externally observable until ag2-space/ag2space-backend#1284 ships
who. I verified the derivation and the call site, not the pixel.Related
Pairs with ag2-space/cinny-webclient#1190, whose summon hint passes
--nameexplicitly. This is the floor for an agent that omits it.🤖 Generated with Claude Code