Skip to content

Configure the Bot Social server in Settings - #341

Merged
Birfy merged 2 commits into
mainfrom
feat/337-social-server-settings
Oct 18, 2026
Merged

Birfy merged 2 commits into
mainfrom
feat/337-social-server-settings

Conversation

@Birfy

@Birfy Birfy commented Oct 18, 2026

Copy link
Copy Markdown
Collaborator

Fixes #337

Settings → Bot Social shows the Bot Social server FlyBot uses and its connection, and switches to another server without editing cordis.patch.yml or restarting.

  • Page. Server, where it comes from (Settings / profile default / not set), status (Connected as @handle, connecting, error, no server), and the features <server>/v1/platform lists. Change server → address → Check → warning → Switch to this server. zh strings are in i18n.js. It is a plugin page: new slot flybot.settings.page (after Connectors; gets the host t, Section, Row), so the page exists only when the social plugin does.
  • Validation. https:// (http:// only for localhost / 127.0.0.1 / [::1]); no user name, query or fragment. The host probes /v1/platform (no credentials, 8 s, redirects refused) before saving; server-set repeats the checks, so skipping Check gains nothing.
  • New server = new identity. The warning says so, and that the old sign-in is kept and never deleted. Each server has its own credentials file (default server: unchanged path; others: flybot-social.json.<tag>, the suffix startSocial already used for backups), settings file, and parked per-Bot identities/grants/Auto-send marks (flybot-social-bots.<tag>.json, no token), so a stale grant to @bob.home cannot apply to a different Bob on the new server. Switching back restores them with no second onboarding.
  • Persisted in flybot-social-server.json (0600) beside the credentials; config.server stays the default/fallback. Nothing configured: behaviour unchanged (same start failure as before; the page says "No server set").
  • Live, with a way back. The plugin restarts its social layer (no app restart). If the start fails or takes over 45 s, the previous server's files, identities and choice are put back and the error says so; a start that finishes late is disposed.
  • No token is returned, logged or put in diagnostics (social/server carries none; tests assert it).
  • social/server-check / social/server-set are writes for the access rules (no read-only host, no team of several members).

Not in scope: Bot Social itself; face-to-face rooms already hosted from the old server stay as local transcripts (nothing polls them).

Tier. T3 (plugins/social/index.js, src/**, cordis.patch.yml): needs an independent PASS and the maintainer; not enabling auto-merge.

Ran at the tip: ARCH_DOCS_BASE=origin/main TZ=UTC npm run verify green (core 869, social 230, tree 56, timeline 80, github scripts 86, interop 37, live-e2e 16). New tests: server address validation, probe, switch/restore/rollback/timeout/read-only (plugin), the Settings page states and zh coverage (plugin), the flybot.settings.page slot in the Settings dialog (core).

Not run: a real browser (the page was rendered with real React to static HTML and driven through scripted states, not clicked); the smoke bench (dev/bench.sh, no deepseek-harness checkout here); a real Bot Social server (a mocked fleet was used).

Birfy added 2 commits October 18, 2026 20:13
Settings → Bot Social shows the server, where it comes from and the connection,
and switches to another server live. The address is validated (https, http only
for localhost) and checked against /v1/platform before anything is saved; a
switch needs a confirm that says a new server is a new identity. Each server has
its own credentials, settings and per-Bot identities; the old credentials file
is kept, never deleted, and switching back restores it. A failed switch puts the
previous server back. cordis.patch.yml stays the default.

Plugins add Settings pages through the new flybot.settings.page slot.
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 18, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-18T12:23:51.141015Z 865e9a8 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@Birfy
Birfy added this pull request to the merge queue Oct 18, 2026

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 865e9a876c

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

current = previous
lastProbe = undefined
// launch() has already recorded the failure (state, error, the unavailable answers); the message below reports it.
await launch(previous).catch(() => undefined)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Dispose timed-out starts before relaunching the previous server

When a new server gets through createSocial() but hangs in registerAll() for longer than 45 seconds, that pending start already owns the social API handlers and middleware, while the controller cannot dispose it until the promise settles. Relaunching the previous server here therefore collides with those registrations and fails, leaving Social unavailable until restart instead of restoring the previous server. The timed-out start must be cancelled or allowed to settle and dispose before relaunching.

Useful? React with 👍 / 👎.

if (!server) return { ...base }
const key = serverKey(server)
const name = displayName ?? base.displayName
if (key === defaultKey) return { ...base, server, ...(name ? { displayName: name } : {}) }

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Reuse credentials when an override becomes the profile default

If the profile's config.server is changed to a server that was previously selected in Settings, this branch starts using the base credentials path even though that server's credentials are stored in the tagged path. The base file still belongs to the old default, so startSocial() treats it as a mismatch and onboards a second identity; existing friends disappear, and restored member IDs may be invalid under the new token. Select or migrate the existing credentials that match the server before assigning the default path.

Useful? React with 👍 / 👎.

const info = await probe(address, { fetch: base.fetch })
const previous = current
const target = { server: address, displayName: name, source: serverKey(address) === defaultKey ? 'config' : 'settings' }
stop()

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Clear the old server's remote roster during a switch

On a server switch, stop() disposes the old social instance but does not clear the core's published remote-Bot list. The new startSocial() refreshes that list asynchronously and suppresses refresh failures, so the switch can return while friends from the old server remain visible—and they remain indefinitely if list_remote_bots keeps failing—even though subsequent actions use the new server's transport. Clear the social remote roster as part of the identity switch before exposing the new connection.

Useful? React with 👍 / 👎.

Merged via the queue into main with commit d6203fd Oct 18, 2026
8 checks passed
@Birfy
Birfy deleted the feat/337-social-server-settings branch October 18, 2026 12:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Configure the Bot Social server in Settings

1 participant