Skip to content

Save the owner's keys for all of the owner's Bots by default - #547

Merged
Birfy merged 4 commits into
ThinkFlowLab:mainfrom
Birfy:fix/owner-secrets-all-bots
Oct 20, 2026
Merged

Birfy merged 4 commits into
ThinkFlowLab:mainfrom
Birfy:fix/owner-secrets-all-bots

Conversation

@Birfy

@Birfy Birfy commented Oct 20, 2026 •

Copy link
Copy Markdown
Collaborator

Fixes #545

Owner decision 2026-10-20 20:21 (Asia/Shanghai), per #359 / AGENTS.md hard rule 4: the owner's connectors and secrets are on by default for all of the owner's own Bots.

Root cause. connector-connect (core/src/host/connectors.js) saved GITHUB_TOKEN / COMPOSIO_API_KEY with scope: [] on a first connect, so the Secrets page and list_secrets showed "No Bot" and no Bot's shell got the token. An empty scope list could not be told apart from an owner's choice.

Change.

Risk tier: touches core/src/host/secrets.js (secret exposure) → expect T2/T3; see the controller's label.

Verification (tip 2f484fe)

  • Red at base b6e89d2 (tests only): connectors.test.js 2 fail (scope [] ≠ 'all'), secrets.test.js 2 new fail (migration, explicit No Bot), tool-cells.test.js fails (no three-way ScopeEditor). Red at c0d189f (first commit): the shared-Bot shell test and the shared-Bot capability test.
  • DSH_HARNESS=core/dev/harness ARCH_DOCS_BASE=origin/main TZ=UTC npm run verify: exit 0 — core 1117/1117, social 312/312, tree 83/83, timeline 93/93, .github scripts 93/93, interop 37/37, live-e2e 16/16; lint + arch-docs + build-client --check + ds-bot-patches check ok.
  • Smoke: dev/bench.sh smoke545 3196 8896 reset && node dev/smoke.mjs smoke545 3196 against deepseek-harness dsh-v0.2.0-rc.2: all 42 steps passed. (Bench trap: pnpm 11 did not link ds-bot into the bench profile; linked profiles/web/node_modules/ds-bot by hand.)
  • CI at 2f484fe: tests-ok green.

Not run: Desktop app; real-model run; the owner's running instance.

A connector saved GITHUB_TOKEN and COMPOSIO_API_KEY for no Bot, so the
owner's Bots could not use the key the owner connected (owner decision
2026-10-20, ThinkFlowLab#359). A key is now for all of the owner's Bots unless the
owner narrows it; a chosen scope carries scopeSet, and an empty list
without it (the old connector default) moves to all Bots once. The
Secrets page offers All my Bots, Chosen Bots or No Bot.

Fixes ThinkFlowLab#545
@Birfy Birfy added bug Something isn't working agent-pr Pull request opened by an agent area:automation Scheduled tasks and automation area:security Auth, grants, approvals, secrets labels Oct 20, 2026
@Birfy Birfy self-assigned this Oct 20, 2026
Self-review of ThinkFlowLab#545: with connector keys now for all Bots, a friend's
turn on a shared Bot could read GITHUB_TOKEN in the shell or have a Bot
save a capability that sends it elsewhere. A shell gets keys only on the
owner's own turn (or, outside a known turn, on a Bot shared with nobody),
and a capability on a shared Bot gets only a key whose list names it,
the same fail-closed rule as the connector tools (ThinkFlowLab#359).
@Birfy

Birfy commented Oct 20, 2026

Copy link
Copy Markdown
Collaborator Author

Self-review (review-pr) — PASS

Tip SHA: 2f484fe7a8dc22768bdcc2a918d575b19d4be1b3
Ran:
- DSH_HARNESS=core/dev/harness ARCH_DOCS_BASE=origin/main TZ=UTC npm run verify — exit 0 (core 1117/1117, social 312/312, tree 83/83, timeline 93/93, .github scripts 93/93, interop 37/37, live-e2e 16/16; lint, arch-docs, build-client --check, ds-bot-patches check ok)
- node scripts/ds-bot-patches.mjs generate && node scripts/ds-bot-patches.mjs check — ok
- CONTEXT_WINDOW=100000 CHECK_RATIO=0.45 dev/bench.sh smoke545 3196 8896 reset && node dev/smoke.mjs smoke545 3196 — 42/42 passed (deepseek-harness dsh-v0.2.0-rc.2)
- red at base b6e89d2 with only the tests: connectors.test.js 2 fail, secrets.test.js 2 fail, tool-cells.test.js fail; red at c0d189f: shared-Bot shell test and shared-Bot capability test fail
- node .github/scripts/risk-gate.mjs --pr 547 — T3 (path core/src/host/secrets.js)
- CI at this tip: tests-ok green
Not run:
- Desktop app, real-model run, the owner's running instance
Verdict: PASS

Checked line by line (secrets.js, connectors.js, secret-card.js, i18n.js, tests, docs):

  • No secret value is printed, logged or returned: secretView has no value; load/persist warnings log only an error code; tests assert the value is absent from the state view, state.json and notes.
  • Default on only for the owner's own use: shell env needs the owner's turn (settled), or, with no known turn, a Bot shared with nobody; a friend's Bot (remote) never. Capabilities on a shared Bot get only a key whose list names the Bot. Matches connector-access (Connector tools: on by default for the owner's own use of every Bot, also on shared Bots; other people's use is a separate opt-in #369/Connector tools on by default for your own Bots; sharing a Bot doesn't take them away; others need your opt-in #370) and AGENTS.md hard rule 4.
  • Migration never widens a scope that names Bots; an empty list with scopeSet stays empty. Known limitation: an empty list the owner chose before this PR (or left empty when its last picked Bot was deleted before this PR) carries no marker and is widened to all Bots — documented in core-host.
  • Connector tokens: GitHub/Composio keys still go to their MCP server only in request headers, never into the DSH profile; no Bot Social /mcp route or connector-token handling is touched.
  • Risk accepted by the owner's decision: an owner-turn shell can now use $DSH_SECRET_GITHUB_TOKEN (a prompt-injected owner turn could send it out). list_secrets still says "you may use it" on a friend's turn although the shell withholds it (cosmetic follow-up).

Not merge authority: T3 needs the maintainer's approval through GitHub.

@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
@Birfy
Birfy added this pull request to the merge queue Oct 20, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to a conflict with the base branch Oct 20, 2026
@Birfy

Birfy commented Oct 20, 2026

Copy link
Copy Markdown
Collaborator Author

Self-review (review-pr, Birfy reviewer agent, 2026-10-20 21:20 Asia/Shanghai): PASS (merge-main conflict fix; no feature change)

Tip SHA: 37c9688
Ran:

  • git merge origin/main (11f80dd, after Show every Bot at work in a group as one row with its step #548 group work rows) into the branch, no rebase or force-push → pass. The only conflict was the generated patches/ds-bot/0001-core-fixes.patch; no real source conflicted
  • generated files regenerated, not hand-merged: git checkout origin/main -- patches/ds-bot, then this PR's topics.json entry restored by hand (src/client/secret-card.js in 0014-flybot-branding; main's file drops it), (cd core && npm run build), node scripts/ds-bot-patches.mjs generate, check → pass (10 patches apply cleanly; core/ = ds-bot/ + patches)
  • ARCH_DOCS_BASE=origin/main TZ=UTC npm run verify (core lint + arch-docs OK with 16 changed files, plugin lint, build-client --check, ds-bot-patches check, all suites) → pass, 0 failures (core 1121, social 313, tree 83, timeline 93, .github scripts 93, interop 37, live-e2e 16)
  • smoke (PR touches core/src/host/): CONTEXT_WINDOW=100000 CHECK_RATIO=0.45 dev/bench.sh smoke547 3496 9196 reset && node dev/smoke.mjs smoke547 3496 against DSH 0.2.0-rc.2 → pass, all 42 steps; bench stopped afterwards
  • CI on this tip → all checks pass (tests-ok, ubuntu-latest · Node 24 · DSH 0.2.0-rc.2, plugins social/timeline/tree, package, risk tier, reviewed tip); MERGEABLE / CLEAN
  • re-read the diff against main at this tip: same 11 source/test/doc files as before the merge plus generated client.js and patches; one changelog.d fragment (545-secrets-all-my-bots.fixed.md); no CHANGELOG.md, version or ds-bot/ edits; no node_modules links committed
    Not run:
  • live Mac instances / DSH Desktop / real-model live-e2e (no key; mock model only)
  • production Bot Social (not in scope)
    Verdict: PASS

Findings: none to act on. This review does not authorize a merge: it still needs the maintainer's approval (the owner queues it).

@Birfy
Birfy added this pull request to the merge queue Oct 20, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to a conflict with the base branch Oct 20, 2026
Generated patches regenerated from the merged core/; topics.json keeps
main's src/host/approvals.js and this branch's src/client/secret-card.js.
@Birfy

Birfy commented Oct 20, 2026

Copy link
Copy Markdown
Collaborator Author

Self-review (review-pr, Birfy reviewer agent, 2026-10-20 Asia/Shanghai): PASS (merge-main conflict fix; no feature change)

Tip SHA: 1974ed7
Ran:

  • git merge origin/main (17af764, after Add Always allow for a Bot or a group to tool approval cards #544 Always allow) into the branch, plain merge, no rebase or force-push → pass. Conflicts only in generated patches/ds-bot/0001-core-fixes.patch and 0008-client-bundle.patch; no real source conflicted
  • generated files regenerated, not hand-merged: git checkout origin/main -- patches/ds-bot, then topics.json restored with both sides (main's src/host/approvals.js and this PR's src/client/secret-card.js in 0014-flybot-branding), (cd core && npm run build), node scripts/ds-bot-patches.mjs generate, check → pass (10 patches apply cleanly; core/ = ds-bot/ + patches)
  • ARCH_DOCS_BASE=origin/main TZ=UTC npm run verify (core lint + arch-docs OK with 16 changed files, plugin lint, build-client --check, ds-bot-patches check, all suites) → pass, 0 failures (core 1129, social 313, tree 83, timeline 93, .github scripts 93, interop 37, live-e2e 16)
  • smoke (PR touches core/src/host/): CONTEXT_WINDOW=100000 CHECK_RATIO=0.45 dev/bench.sh smoke547m 3596 9296 reset && node dev/smoke.mjs smoke547m 3596 against DSH 0.2.0-rc.2 → pass, all 42 steps; bench stopped afterwards
  • CI on this tip → all checks pass (tests-ok, ubuntu-latest · Node 24 · DSH 0.2.0-rc.2, plugins social/timeline/tree, package, risk tier, reviewed tip); MERGEABLE / CLEAN
  • re-read the diff against main at this tip: same source/test/doc files as before the merge plus generated client.js and patches (16 files); one changelog.d fragment (545-secrets-all-my-bots.fixed.md); no CHANGELOG.md, version or ds-bot/ edits; no node_modules links committed
    Not run:
  • live Mac instances / DSH Desktop / real-model live-e2e (no key; mock model only)
  • production Bot Social (not in scope)
    Verdict: PASS

Findings: none to act on. This review is not merge authority by itself; the maintainer's approval is recorded separately.

@Birfy

Birfy commented Oct 20, 2026

Copy link
Copy Markdown
Collaborator Author

Owner approval in chat 2026-10-20 21:46 Asia/Shanghai: merge.

@Birfy
Birfy added this pull request to the merge queue Oct 20, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Oct 20, 2026
@Birfy
Birfy added this pull request to the merge queue Oct 20, 2026
Birfy added a commit to Birfy/FlyBot that referenced this pull request Oct 20, 2026
…kFlowLab#551)

A Bot that works on something handed out in a group (a member there
sends it the work with `message_bot`) runs it in a hidden turn of its
own chat. Its `ask_user` card therefore landed in the Bot's private
chat, and an answer there never went back to the group. Now the card
sits in that group's composer dock, named for the Bot that asks. The
answer reaches the Bot as a hidden request from the member that handed
the work over, so the Bot's reply goes back to the group the same way
the work does. The group shows a quiet notice of the answer, and the
Bot's private chat gets no card and no visible turn.

Fixes ThinkFlowLab#550

- `tools.js`: `ask_user` in a turn that answers a group member's request
(`senderRoomId`, not `audience: 'user'`, not a friend's) writes
`state.questions[<room>]` (`header`, `botId`, `replyTo`, the turn's
`origin`, `allowCustom`). Only one card per group: while one is open, a
second Bot is told to ask in its reply. `rt.answerGroupQuestion`
delivers the answer and posts the notice.
- `channel.js` `answer-question`: routes a room card to it.
`delivery.js`: a header for it (`answeredIn`). `turns.js`: a typed group
line no longer clears the group's card.
- `authz.js`: only the asking Bot's owner or the room's owner sees or
answers such a card. A non-owner's answer carries `origin: other`.
- `roster.js`: deleting the room or the Bot drops the card. Face-to-face
rooms use the same path on the local home.
- Docs: `core-host.md`. Changelog fragment
`550-group-questions.fixed.md`.

Not changed: `ask_user` inside a group Session is still refused (the Bot
asks in its reply, which already shows in the group). Secret cards stay
private. `reply_to: "user"` hand-offs are still answered in the Bot's
own chat by design.

## Verification (tip 6dfe7ba)

- The second commit, 6dfe7ba, runs the answerer's display name through
`cleanName` before it goes into the group notice.
- Red at base: 11f80dd with only `test/group-work.test.js` and
`test/authz.test.js` copied in gives 4 fail / 27 pass. The 4 new ThinkFlowLab#550
tests fail and the own-chat guard test passes. At the tip they all pass.
- `ARCH_DOCS_BASE=origin/main TZ=UTC npm run verify` passes: core
1121/1121, social 313, tree 83, timeline 93, scripts 93, interop 37,
live-e2e 16; arch-docs OK; patches check ok. oxlint warnings are 53 at
both base and tip.
- On the first verify run (at 368b4fb), `tasks.test.js` "an untagged
hold stamps the latest working task…" failed once under full-suite load.
It passed 3 of 3 alone and the rerun was fully green. That test uses
millisecond timestamps, and this PR does not touch that code.
- DSH smoke (`dev/bench.sh` + `dev/smoke.mjs`, DSH 0.2.0-rc.2, mock
model) passes all 42 steps at 6dfe7ba.

Not run: Desktop app, a real model, a live two-home face-to-face run,
and a browser check of the group dock rendering. The client is
unchanged: `QuestionDock` already reads `questions[sessionId]` for the
open conversation and shows `header`.

File overlap with open PRs: ThinkFlowLab#544 touches `authz.js`, `channel.js`,
`topics.json`, `core-host.md` and the 0001/0005 patches; ThinkFlowLab#547 touches
`0001-core-fixes.patch`, `topics.json` and `core-host.md`. The source
hunks are in different places. `topics.json` adds
`test/group-work.test.js` to topic 0001.

---------

Co-authored-by: Birfy <15378933+Birfy@users.noreply.github.com>
Merged via the queue into ThinkFlowLab:main with commit 6824c61 Oct 20, 2026
8 checks passed
@Birfy
Birfy deleted the fix/owner-secrets-all-bots branch October 20, 2026 14:14
@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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:automation Scheduled tasks and automation area:security Auth, grants, approvals, secrets bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Owner's connector keys and secrets default to 'No Bot'; make them available to all of the owner's Bots (#359)

1 participant