Skip to content

Polish invites and friend chats: friend Bot placeholder, one invite control, Add friend auto-close, Sharing hint - #504

Merged
Birfy merged 4 commits into
ThinkFlowLab:mainfrom
Birfy:fix/499-invite-friendchat-polish
Oct 20, 2026
Merged

Birfy merged 4 commits into
ThinkFlowLab:mainfrom
Birfy:fix/499-invite-friendchat-polish

Conversation

@Birfy

@Birfy Birfy commented Oct 20, 2026

Copy link
Copy Markdown
Collaborator

Fixes #499

What / why (owner decision 2026-10-20, option (a): all four polish items)

  1. Friend's Bot placeholder (regression of Friend's Bot chat on the receiving home: 'Tool removed' line, turns/steps/tok/s footer, composer placeholder flips to coding copy #419). The shell picks its composer copy by phase before it knows whose chat it is (hero copy on first open, coding copy after a send). HeaderPill now holds Message <Bot (owner)> through a new core/src/client/composer-label.js in a layout effect (before the first paint). It writes both aria-label and data-placeholder (before, only aria-label) and rewrites them inside the MutationObserver callback, with no rAF delay. On cleanup it gives back the shell's latest value.
  2. One invite control (inviteControls in plugins/social/client.js) in Add friend → Invite a friend and in Bot settings → Sharing. Before a link exists there is one button, Copy invite link for Chief, which makes the link and copies it. After that the link shows with Copy link / Copy with instructions / New link. Every copy note names the Bot: Invite link for Chief copied. / Invite for Chief copied with instructions.
  3. Add friend. The paste box is now a wrapping textarea, so the whole link shows; Enter still accepts. Typing clears a failed accept's error. After an accept that shared a Bot, the result shows for about 1.8 s, then the panel closes and opens the new friend's Bot if it is already listed. A join with no Bot, or a sent request, stays open until Done.
  4. Sharing hint. It reads Invite grants Chief only. and adds Revoke anytime in People with access. only once People with access lists someone. The empty list now reads Nobody has this Bot yet. Copy an invite link above and send it to a friend. People with access only gained an onGrants count callback; its grant logic is unchanged.

Tests

  • core/test/composer-label.test.js (jsdom): a friend's Bot composer reads Message Chief (SelfA1233) from the first paint (hero copy), after a send (coding copy) and after a remount, with no build/commands/@ files/sessions wording; it hands back on cleanup. looks.test.js checks that the header uses a layout effect.
  • plugins/social/test/social.test.js: the same control and Bot-named copy notes in Add friend and Sharing; the error clears when you type in the paste box; Enter accepts; auto-close plus opening the friend's Bot (only when a Bot was shared); the Revoke hint; wrapping paste box.

Ran at the tip: ARCH_DOCS_BASE=origin/main TZ=UTC npm run verify passed (core 1079, social 299, tree 80, timeline 83, scripts 93, interop 37, live-e2e 16; plugin lint OK). Not run: live Mac instances, browser smoke.

Generated files were rebuilt: core/client.js, patches/ds-bot (0003/0008/0012 and new files/), changelog fragment changelog.d/499-invite-friendchat-polish.fixed.md. Docs: README (en/zh), docs/subsystems/social.md, docs/subsystems/core-client.md.

Risk tier: T2 (estimate; the controller sets the label)

…t, one invite control, Add friend auto-close, Sharing hint (ThinkFlowLab#499)
@Birfy Birfy added the agent-pr Pull request opened by an agent label Oct 20, 2026
@Birfy Birfy self-assigned this Oct 20, 2026
@Birfy Birfy added enhancement New feature or request area:social Friends, invites, grants, Bot Social area:ui Web/desktop UI and copy self-test Filed by the product self-test routine (issues only) labels Oct 20, 2026
@Birfy

Birfy commented Oct 20, 2026

Copy link
Copy Markdown
Collaborator Author

Self-review: PASS
Tip SHA: c74a857
Ran:

  • ARCH_DOCS_BASE=origin/main TZ=UTC npm run verify: passed (core lint + arch-docs OK, plugin lint OK, build-client --check OK, ds-bot-patches check OK; core 1079/1079, social 299/299, tree 80/80, timeline 83/83, scripts 93/93, interop 37/37, live-e2e 16/16). An earlier run had one flaky failure in the unrelated connectors.test.js (it passed 3 of 3 times alone and in the full rerun).
  • node .github/scripts/changelog.mjs check: 18 fragments well formed.
  • CI at the tip: tests-ok, test, plugins (social/tree/timeline), package, risk tier, reviewed tip all pass.
  • Diff reviewed against the owner design rules: English UI; per-Bot grants and People with access grant logic unchanged (only an onGrants count callback was added); no publish; no approval by typed reply; friend chats keep no turn limit or Extend; one + menu unchanged; hooks unconditional (ManageAccess effect before its early return, Sharing state in a new OwnBotSharing).
    Not run:
  • Live Mac instances or the production Bot Social server (not touched).
  • Browser smoke on two live homes (clipboard permission, wrapping textarea at sidebar width, auto-close timing); these are covered only by the unit tests and jsdom.

@Birfy Birfy added the awaiting-approval PR is green and waits for the maintainer's approval (T2/T3) or a review PASS at its tip label Oct 20, 2026
@github-actions github-actions Bot added the risk:T3 Risk tier T3 (needs a human approval), set by the controller from the diff label Oct 20, 2026
…ThinkFlowLab#481/ThinkFlowLab#501/ThinkFlowLab#505)

Keep ThinkFlowLab#499 composer-label / data-placeholder docs with ThinkFlowLab#481 phone hold-card targets.
Regenerated client bundle patch after merge.
@Birfy

Birfy commented Oct 20, 2026

Copy link
Copy Markdown
Collaborator Author

Self-review: PASS
Tip SHA: ebc484a
Ran:

Resolve social.md and social client with main's Share with a friend (ThinkFlowLab#500/ThinkFlowLab#516)
kept under OwnBotSharing alongside ThinkFlowLab#499 inviteControls and revoke hint.
Regenerate core client bundle and ds-bot patches. Update ThinkFlowLab#499 test for the
extra ShareWithFriend child.
@Birfy

Birfy commented Oct 20, 2026

Copy link
Copy Markdown
Collaborator Author

Self-review: PASS
Tip SHA: eaed3f1
Ran:

  • ARCH_DOCS_BASE=origin/main TZ=UTC npm run verify (pass)
  • reviewed diff at tip vs owner design rules
    Not run:
  • live Mac instances / production Bot Social

…chat-polish

# Conflicts:
#	patches/ds-bot/0008-client-bundle.patch
@Birfy

Birfy commented Oct 20, 2026

Copy link
Copy Markdown
Collaborator Author

Self-review: PASS
Tip SHA: 347f18e
Ran:

  • git merge origin/main (eb91742, after Remind about approvals waiting 15 min, switch each notification kind, one notification per chat #492 and Social: neutral 'You already have …' on a re-accepted invite; clearer Remove confirm #503) into the branch, no rebase or force-push; only conflict was the generated patches/ds-bot/0008-client-bundle.patch
  • generated files regenerated, not hand-merged: took main's patches/ds-bot, then (cd core && npm run build), node scripts/ds-bot-patches.mjs generate, then check: ok (10 patches apply cleanly; core/ = ds-bot/ + patches)
  • ARCH_DOCS_BASE=origin/main TZ=UTC npm run verify (core lint + arch-docs, plugin lint, build-client --check, ds-bot-patches check, all suites): pass, 0 failures (core 1100, social 312, tree 80, timeline 92, .github scripts 93, interop 37, live-e2e 16)
  • CI on this tip: all checks pass (tests-ok, Node 24 · DSH 0.2.0-rc.2, plugins social/timeline/tree, package, risk tier, reviewed tip); mergeable MERGEABLE, mergeStateStatus CLEAN
  • re-read the diff against main at this tip: changelog.d fragment kept, no CHANGELOG.md or ds-bot/ edits, owner design rules kept (approvals only via UI buttons, English UI, no separate Friends' Bots section, no turn limit or Extend in friend chats, connector tokens only at /mcp)
    Not run:
  • live Mac instances / production Bot Social

@Birfy
Birfy added this pull request to the merge queue Oct 20, 2026
Merged via the queue into ThinkFlowLab:main with commit 8c68aa7 Oct 20, 2026
8 checks passed
@Birfy
Birfy deleted the fix/499-invite-friendchat-polish branch October 20, 2026 11:08
github-merge-queue Bot pushed a commit that referenced this pull request Oct 20, 2026
…515)

Fixes #506.

## What
After #499/#504 renamed the Sharing control to **Copy invite link for
&lt;Bot&gt;**, host refusal text, the new-chat invite failure note, and
zh i18n still said **Bot settings → Invite to this Bot**. This PR
retargets those user-visible strings (and matching docs/comments/tests)
to **Bot settings → Sharing → Copy invite link**.

Based on `fix/499-invite-friendchat-polish` (#504) with `origin/main`
merged in so the leftover copy lands on top of the rename.

## Why
Those messages pointed at a button that no longer exists once #504
lands.

## Test
- `ARCH_DOCS_BASE=origin/main TZ=UTC npm run verify` — pass (0 failures)
at tip
- `core/test/remote-room.test.js` ungranted-local assertion updated to
`Sharing → Copy invite link for Writer A`

## Risk tier
Risk tier: T2 (estimate; the controller sets the label) — copy/docs/i18n
only, no grant or transport behavior change.

Tip SHA: 6e7e9e6

Docs-not-needed: copy-only string and comment updates in owned files
(core-client, core-host, plugin-runtime, tree); no subsystem doc names
the old "Invite to this Bot" control, and social.md / team.md carry the
doc change.

---------

Co-authored-by: Birfy <15378933+Birfy@users.noreply.github.com>
@Birfy Birfy removed awaiting-approval PR is green and waits for the maintainer's approval (T2/T3) or a review PASS at its tip agent-pr Pull request opened by an agent labels Oct 21, 2026
HugoXK added a commit to HugoXK/FlyBot that referenced this pull request Oct 27, 2026
…ands alone (ThinkFlowLab#1392)

fix(issue-ref): read a bare ThinkFlowLab#1234 only when the number stands alone

Fixes ThinkFlowLab#1391
Owner: Dev2
Reviewer: Reviewer
Written-by: Dev-2
Tip SHA: `0a0887327804685aae28a977fde7a26d0833f894`
Base: `10884b8b` (`main`, `ThinkFlowLab#1385`)
Tree: `cfee808d8b6e9deeac63b16c54abb5b8ea92274c`

## What changed

`core/src/shared/issue-ref.js` guarded only the character *after* the
digits (`#(\d{1,7})(?![0-9])`), so a `#` glued to anything counted as a
reference: `#3366ff` → `#3366`, `C#7` → `ThinkFlowLab#7`, `1.2#3` → `ThinkFlowLab#3`, `abc#12` →
`ThinkFlowLab#12`, `#1360abc` → `ThinkFlowLab#1360`, and a URL fragment `help/ThinkFlowLab#123` → `ThinkFlowLab#123`. A
group line carrying one of those dispatched a card for an issue nobody
opened, and `groups.js` empties `speakers` once a card is written, so
the line got no answer.

The matcher now keeps three separate shapes.

- A **bare** `#N` counts only with a separator in front —
`(?<![\w./-])`, so a word character, `.`, `-` or `/` glues it to
something else — and a non-word character behind (`(?![\w])`, which also
refuses `#1360abc`).
- **`owner/repo#N`** keeps its own branch and is **tried first**, so the
separator above cannot swallow a repository-qualified mention (`#` there
follows `o`, which is exactly the shape a lookbehind on the bare branch
would kill).
- **`github.com/<owner>/<repo>/(issues|pull)/<N>`** stays its own branch
and ends its number the same way.

`MENTION` (`cardMentions`, and `withoutMentions` in `work-dispatch.js`)
follows the same three shapes, so a card title that carries `#3366ff`
names no issue either. `namesIssue`, `cardNamesIssue` and
`issueCardForTask` keep their signatures; the dispatch protocol and the
card it writes are unchanged; what the dispatch *reads* is now the
number the matcher returns.

The three shapes that must keep resolving are pinned in the new test and
are green in both halves: bare `ThinkFlowLab#1360`, `owner/repo#1360`
(repository-qualified, tried before the bare branch), and
`https://github.com/o/r/issues/1360`.

`core/src/host/work-dispatch.js` took the id from the raw match (`'#' +
(match[1] ?? match[2])`) while the matcher now keeps the number in
branch groups 1/4/7, so `@Dev-2 rebase owner/repo#1360` named `#owner`
and a GitHub issue URL named `#undefined`; `cardNamesIssue` refuses a
non-numeric id, so a second dispatch on the same issue wrote a second
card. Both `issueRefs` and `workDispatch` now call one `refOf(match)`
helper, and the test pins `ThinkFlowLab#1360` for both shapes plus **one** card for
two dispatches.

**Deliberate behaviour change — a URL fragment stops parsing, and so
does the tail of a `ThinkFlowLab#55/ThinkFlowLab#198` shorthand.** `…/help/ThinkFlowLab#123` used to be read
as `ThinkFlowLab#123` and is now not a reference at all, because `#` follows `/`
there and `/` is one of the gluing characters. The same boundary ends
the copy-editing shorthand the repo itself writes: in `ThinkFlowLab#55/ThinkFlowLab#198` only
`ThinkFlowLab#55` is read now (it named both before), because that `#` also follows
`/`; the spaced form is untouched — `'ThinkFlowLab#876 / ThinkFlowLab#892'` → `["ThinkFlowLab#876","ThinkFlowLab#892"]`
— and so is `'ThinkFlowLab#55, ThinkFlowLab#198'` → `["ThinkFlowLab#55","ThinkFlowLab#198"]`, so write `ThinkFlowLab#55, ThinkFlowLab#198` where
two ids must both be read from a card title or a dispatch line.
Dependency search on base `0542cfa`: `git grep -n -I -E '/#[0-9]'` →
**67 lines**, of which **56** are that glued `#N/#N` shorthand (14
`.github/**`, 14 `docs/**`, 12 `plugins/**`, 4 `core/src`, 3
`core/test`, 2 root `*.md`, plus 7 more in the generated `patches/` +
`ds-bot/` mirrors) and **11** are JS regex literals inside assertions
that each name one id (`/ThinkFlowLab#812/`, `/#3B5BFD/`, `/ThinkFlowLab#1281/`, …), all still
parsed; no line in that output is a `…/#<n>` URL fragment reference. Two
readers, not one: `.github/**` never imports `issue-ref.js` —
`enqueue-rules.mjs` carries its own `const ISSUE_REF =
/^[\s>#-]*(?:fixes|closes)…/im` (`:30`), and `merge-gate.mjs` /
`enqueue-guard.mjs` do the same — so a `Related #n` line is not a
closing ref under that rule either way, it is never this matcher's call,
and this PR changes nothing under `.github/`. No test imports
`core/src/shared/issue-ref.js`; the only consumer under test is
`core/test/work-dispatch.test.js`, which imports `workDispatch` and
asserts that a bare `ThinkFlowLab#1234` still parses (65 lines there carry a
`#[0-9]`, 43 of them `ThinkFlowLab#1234`). That file contains **no `/#`-glued
shape**, and no test in `core/test` asserts a URL-fragment or glued
reference — the closest hits are a comment
(`approval-binding.test.js:5`, `ThinkFlowLab#49/ThinkFlowLab#48`) and colour literals
(`branding.test.js:40-41`, `/#3B5BFD/`). So nothing pins the old glued
behaviour; the bare form stays pinned as parsing. The prose that does
use the shorthand — `docs/subsystems/core-host.md:267` (`ThinkFlowLab#55/ThinkFlowLab#198`),
`docs/autonomous-dev.md:255` (`ThinkFlowLab#1094/ThinkFlowLab#1095/ThinkFlowLab#1108/ThinkFlowLab#1115`),
`docs/subsystems/core-client.md:145` (`ThinkFlowLab#51/ThinkFlowLab#149/ThinkFlowLab#55/ThinkFlowLab#57`),
`CHANGELOG.md:389` (`ThinkFlowLab#499/ThinkFlowLab#504`), `AGENTS.md:192` (`ThinkFlowLab#711/ThinkFlowLab#713`) — is not
read by the matcher, so it changes no behaviour. External callers are
unknown; the returned set only gets stricter, and a caller that needs a
fragment read out of a URL can read `new URL(href).hash` itself.

## Red first, same command in both halves

`cd core && TZ=UTC node --import ./test/harness-resolve.mjs --test
test/issue-ref.test.js`

Half (a): this tree with the new test but the old `issue-ref.js` (base
`0542cfa`):

```
not ok 1 - a hex colour is not an issue reference
  error: |-
    @dev-2 set the accent colour to #3366ff
    + actual - expected
    + [ '#3366' ]
    - []
not ok 2 - a language version is not an issue reference          C#7       -> [ 'ThinkFlowLab#7' ]
not ok 3 - a version string is not an issue reference            1.2#3     -> [ 'ThinkFlowLab#3' ]
not ok 4 - an identifier is not an issue reference               abc#12    -> [ 'ThinkFlowLab#12' ]
not ok 5 - a number running into letters is not an issue ref     #1360abc  -> [ 'ThinkFlowLab#1360' ]
not ok 6 - a URL fragment is not an issue reference              help/ThinkFlowLab#123 -> [ 'ThinkFlowLab#123' ]
not ok 14 - namesIssue answers the same question, so a colour cannot name an issue
not ok 15 - a card whose title only carries a colour names no issue
# tests 15
# pass 7
# fail 8
```

Half (b): the same command on this tip — the same 8 green, plus the 7
that must keep working:

```
ok 7 - a bare number still names the issue: ThinkFlowLab#1360
ok 8 - a repository-qualified number still names the issue: owner/repo#1360
ok 9 - a github issue URL still names the issue: https://github.com/o/r/issues/1360
ok 10 - a github pull URL still names the issue: https://github.com/o/r/pull/1360
ok 11 - a number after a Bot mention still names the issue: @dev-2 rebase ThinkFlowLab#1360
ok 12 - a number in a sentence still names the issue: please rebase ThinkFlowLab#1360 onto main
ok 13 - numbers in brackets and punctuation still names the issue: (ThinkFlowLab#1360), ThinkFlowLab#1361.
# tests 15
# pass 15
# fail 0
```

### The dispatch consumer, same command, two states

`cd core && TZ=UTC node --import ./test/harness-resolve.mjs --test
test/work-dispatch.test.js`

At this tip (`0a088732`): **19/19 green**. With
`core/src/shared/issue-ref.js` and `core/src/host/work-dispatch.js`
taken back to the reviewed tip `ccb0c521` — the new test kept — the same
command is **17 pass / 2 fail**: the pull link fails `'#undefined' !==
'ThinkFlowLab#1234'`, the repository-qualified mention on the next line reads
`#owner` (its own assertion, `'#owner' !== 'ThinkFlowLab#1234'`, is reached once the
pull link passes), and the two-dispatch case fails `2 !== 1`.

```
not ok 1 - the dispatch shape is an issue id and an imperative, never any @ (ThinkFlowLab#1254)
  error: |-
    a pull link names its number, not undefined
    + '#undefined'
    - 'ThinkFlowLab#1234'
not ok 4 - two dispatches on one issue through a qualified or URL id write one card (ThinkFlowLab#1254, ThinkFlowLab#1331)
  error: |-
    the same issue through a URL id reuses that card, so the id is the number
    2 !== 1
# tests 19
# pass 17
# fail 2
```

## Knife

Removing only the bare branch's left separator (keeping the right-hand
rule) on this same tree: **5 red / 10 green** — `C#7`, `1.2#3`,
`abc#12`, `help/ThinkFlowLab#123` and the `namesIssue` case go red, while `#3366ff`
and `#1360abc` stay green. Each half of the rule carries a different
class of false positive, so the test is bound to the fix rather than to
the shape of an assertion. Restored: **15/15 green**.

## Counts at this base

Core at this tip (`0a088732`): **1822/1822**; at base `10884b8b`:
**1805/1805** — the 17 added tests are 15 in `issue-ref.test.js` and 2
in `work-dispatch.test.js`. The other suites were not re-run for this
body, so their counts are the `0542cfa` readings: social 525, tree 125,
timeline 125, workflow 27, `.github/scripts` 543, interop 37, live-e2e
24.

## What I ran

- `TZ=UTC npm run verify` at this tree
(`cfee808d8b6e9deeac63b16c54abb5b8ea92274c`, base `10884b8b`): **exit
0**; `arch-docs: OK (8 changed file(s))`.
- `node core/scripts/build-client.mjs --check`: exit 0.
- `node scripts/ds-bot-patches.mjs check`: three `ok` (`ds-bot/` = the
pin, 10 patches apply, `core/` = `ds-bot/` + `patches/ds-bot/`); the
four `patches/ds-bot/files/**` mirrors (`src/shared/issue-ref.js`,
`src/host/work-dispatch.js`, `test/issue-ref.test.js`,
`test/work-dispatch.test.js`) come from `generate`, never by hand.
- The red/green pair above, and the knife.

## What I did not run

- `core/dev/bench.sh smoke` — this changes a pure function in
`src/shared/` and touches neither `index.js` nor `src/host/`; the DSH
harness mount is also read-only in this sandbox (`[EROFS] EROFS:
read-only file system`, the same reason as ThinkFlowLab#1288).
- Live rooms and a real Bot round.

Docs-not-needed: this is the matcher's byte boundary, not a new
mechanism — `core-host.md` describes `issue-ref.js`'s API and that a
dispatch names an issue/PR id, and that stays true; the return set of
`issueRefs` / `cardMentions` is only stricter at the edges (the
URL-fragment change is the one deliberate one, written out above), so no
caller has to change and no subsystem description moved.

`.github/**` is untouched.

## Checkpoint

<!-- flybot:checkpoint -->
```json
{"pr":1392,"claim":"Dev2","issue":1391,"summary":"`issue-ref.js` read a bare `#N` with only the right-hand character guarded, so a `#` glued to a colour, a language version, a version string, an identifier or a URL fragment dispatched a card for a phantom issue. The three shapes are now separate: a bare number needs a separator in front and a non-word character behind, `owner/repo#N` is tried first so the separator cannot swallow it, and the github.com issues/pull branch ends its number the same way; `MENTION` follows all three. A URL fragment (`help/ThinkFlowLab#123`) deliberately stops parsing.","files":["core/src/shared/issue-ref.js","core/src/host/work-dispatch.js","core/test/issue-ref.test.js","core/test/work-dispatch.test.js","patches/ds-bot/files/src/shared/issue-ref.js","patches/ds-bot/files/src/host/work-dispatch.js","patches/ds-bot/files/test/issue-ref.test.js","patches/ds-bot/files/test/work-dispatch.test.js"],"checks":{"ran":"TZ=UTC npm run verify; node core/scripts/build-client.mjs --check; node scripts/ds-bot-patches.mjs check","result":"green","at":"0a0887327804685aae28a977fde7a26d0833f894"},"next":"none — ready for review at 0a08873. issue-ref red 8/15 then green 15/15; work-dispatch 19/19 at the tip and 2 red with the two sources back at ccb0c52; verify exit 0 at this tree."}
```
<!-- /flybot:checkpoint -->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:social Friends, invites, grants, Bot Social area:ui Web/desktop UI and copy enhancement New feature or request risk:T3 Risk tier T3 (needs a human approval), set by the controller from the diff self-test Filed by the product self-test routine (issues only)

Projects

None yet

1 participant