Skip to content

Add guided Feishu application integration - #2527

Merged
zy95-12 merged 1 commit into
ThinkFlowLab:delivery/ai-centric-development-servicefrom
zhaozhaozz:feishu-integration
Nov 5, 2026
Merged

zy95-12 merged 1 commit into
ThinkFlowLab:delivery/ai-centric-development-servicefrom
zhaozhaozz:feishu-integration

Conversation

@zhaozhaozz

@zhaozhaozz zhaozhaozz commented Nov 5, 2026 •

Copy link
Copy Markdown

No tracking issue. Builds on the Feishu connector work of #1266 (webhook sender and inbound long connection).

What changed

Before: Feishu was a custom group webhook plus an inbound long-connection row. After: an owner can connect a Feishu application and have a local Bot answer in Feishu chats.

  • Guided setup. One Connect entry on the Feishu connector row and on the shared Connections page. The long-connection guide has six steps and the HTTP event-address guide has seven. It shows a permission JSON to import, live connection state and event status.
  • Credentials. Kept in an encrypted per-instance vault (feishu-credentials.json, mode-0600 host key). They never enter state projections, Bot schemas or Bot environments. The long connection uses the official SDK. HTTP mode uses a separate event-only listener with no console routes.
  • Messages. Inbound messages are persisted before acknowledgement, deduplicated across restarts, routed per chat to a local Bot and answered in their thread through a durable outbox. Get reactions mark accepted requests.
  • Cards and files. feishu_card cards bind the original message and the actual linked clicker. feishu_file sends Session attachments within the Feishu limits (images 10 MB, files 30 MB) and fails as a tool error beyond them. No console links are sent into Feishu.
  • Tools. feishu_tool gives per-Bot, per-product access to calendar, documents, tables, sheets, meetings and tasks. Ask-mode writes go through the native approval seam.
  • Gateway. The authenticated feishu endpoint is added to scripts/api-contracts.mjs and the OpenAPI artifact.
  • Docker. The image now installs ds-bot's runtime dependencies. A link: profile installs none of them, and the Feishu SDK import is lazy, so the container started healthy and only the dial failed. The build now fails when a declared dependency is missing. The image grows from about 1.6 GB to 2.7 GB, mostly the Claude and Codex executor binaries; the Feishu SDK is about 29 MB. docker/compose.local.yaml publishes the console on all interfaces and requires FLYBOT_TRUSTED_HOST, so browser API requests are admitted.
  • Diagnostics. A dial that cannot import the SDK is reported as a missing install, not as a network or credential failure.
  • Docs. docs/feishu.md, the core-host, core-client, project-workbench and backend-service subsystem docs, the Docker guide (en/zh) and the third-party integration counts. Changelog fragments are in changelog.d/.

Verification at the tip

Tip SHA: 8a8d8d0 (base e11ba3b)
Ran:

  • npm run verify: exit 0, 5120 tests, 0 failures. It covers core lint with arch-docs, plugin lint, the client and workbench bundle checks, the ds-bot patch check and canonical form, the core and plugin suites, the .github/scripts tests, and the interop, live-e2e and demo checks.
  • docker compose -f compose.yaml -f docker/compose.local.yaml build and up --wait at this tip: both containers healthy. Against a real Feishu application, the long connection reports ready. Unauthenticated API requests from the published address still return 401.
  • On the same branch before the rebase:
    • A real inbound message arrived over the long connection. The sender allow-list refused it, as designed.
    • The setup path (Connect → credentials step → subscription step) was driven in headless Chromium against the local instance, with 0 page errors.
  • New regressions fail without their change: the missing-SDK diagnosis, the Docker dependency check, and the feishu_file limits with no console address.

Not run (and why):

  • A full Feishu round trip (Bot reply, card callback, product tools) against a real tenant, and HTTP event-address mode behind a public HTTPS address: no allowed sender or public address has been set up yet.
  • The smoke test (dev/smoke.mjs) and real-model runs.
  • CI and the Docker workflow: they have not run on this fork PR yet.
  • Independent review: none yet.

Checkpoint

{
  "pr": 2527,
  "claim": "zhaozhaozz",
  "issue": 0,
  "summary": "Connect a Feishu application to the existing Feishu channel: guided long-connection or HTTP setup, an encrypted credential vault, persisted and deduplicated inbound messages answered in thread through a durable outbox, cards bound to the linked clicker, and per-Bot product tools behind native approvals. The Docker image now carries ds-bot's runtime dependencies so the long connection can load its SDK.",
  "files": ["core/src/host/feishu-service.js", "core/src/host/feishu-sdk.js", "core/src/host/feishu-tools.js", "core/src/host/feishu-vault.js", "core/src/client/feishu-setup.js", "Dockerfile", "docker/profile.mjs", "docs/feishu.md"],
  "checks": { "ran": "npm run verify", "result": "green", "at": "8a8d8d09abd67f98a01c9c59a8da10c74e769d4b" },
  "next": "none — ready for review"
}

Feishu was only a custom group webhook. Owners who want a Bot to answer
in Feishu chats, use cards and work with calendars or documents had no
supported path.

Extend the existing Feishu channel with application connections:

- A six-step long-connection guide (seven for an HTTP event address)
  behind one Connect entry, with permission import JSON, live
  connection state and polled event status.
- Credentials kept in an encrypted per-instance vault, never in state
  projections or Bot environments. The long connection uses the
  official SDK; HTTP mode uses a separate event-only listener.
- Inbound messages persisted before acknowledgement, deduplicated
  across restarts, routed per chat to a local Bot and answered in
  their thread through a durable outbox with Get reactions.
- Cards bound to the original message and the actual linked clicker.
- Per-Bot, per-product calendar, document, table, sheet, meeting and
  task tools. Ask-mode writes go through the native approval seam.
- The gateway admits the authenticated `feishu` endpoint, documented in
  the OpenAPI contract.

Docker: install ds-bot's runtime dependencies in the image, because
`link:` installs none of them and the Feishu SDK import is lazy, and
fail the build when a declared dependency is missing. The local
override publishes the console on all interfaces and requires an
explicit trusted host so browser API requests are admitted.

A dial that cannot import the SDK is reported as a missing install,
not as a network or credential failure. No console links are sent
into Feishu: an attachment over the Feishu limits fails as a tool error.
@zy95-12
zy95-12 merged commit 056cb55 into ThinkFlowLab:delivery/ai-centric-development-service Nov 5, 2026
5 of 6 checks passed
@zhaozhaozz
zhaozhaozz deleted the feishu-integration branch November 5, 2026 14:27
zy95-12 added a commit that referenced this pull request Nov 5, 2026
Written-by: Codex

Fixes #2526 (follow-up to #2537). Target:
`delivery/ai-centric-development-service`.

After Chief revised a Task to rev3/rev4, its already merged rev2 Attempt
could never be accepted: both the advisory precheck and execution
applied whole-Task requirement equality. Scoped acceptance now judges
the pinned Attempt definition and its exact
code/test/Review/provider-merge evidence while leaving the Task open.
Settlement records both original and current revisions; an explicitly
chosen next Attempt uses the current requirements. Historical parent
settlement also looks up the original durable child admission using the
pinned parent revision; child evidence and the committed admission
remain mandatory. Whole-Task closure retains its independent
current-goal checks.

Chief/TaskView receive the same bounded comparison: revisions, changed
fields, prior values, and the existing paged requirement source. Changes
after a Chief snapshot use existing stale-snapshot correction. Prior
refusal messages describe past outcomes, not current action legality.
Candidate evidence, identity, permissions, execution generations, exits,
pending writes and replay/rollback guards remain strict. No new
workflow, timer, store, migration or automatic human escalation.

Validation:
- Fresh base `056cb557`: the corrected persisted-Task fixture fails the
real Git/Runtime rev2→rev4 settlement/next-delivery path, actual Chief
loop and advisory projection on the old requirement-equality guard; all
three pass after the fix.
- Final-head related suites: **281 passed / 0 failed**; the final actual
Chief loop also passes with four historical same-fact refusal records.
It sees legal scoped acceptance, accepts rev2, keeps Task open and
explicitly starts rev4. New stale-judgement regression returns
correction without blocking the Task or consulting a human.
- Preserved negative coverage for mutated candidate/evidence,
provider/rights/exit failures, changed requirements during I/O and
incomplete whole-Task acceptance. Role budget **6/0**, API/OpenAPI
**10/0**. Self-review also reproduced and repaired the child-admission
revision barrier; targeted parent/evolution/Chief/negative admission
regressions: **5/0**. **Final-head full root verification: 5167 passed /
0 failed**, including **8 actual DSH runtime checks**. [GitHub Test
42053449199](https://github.com/ThinkFlowLab/FlyBot/actions/runs/42053449199),
attempt1: final-head Node24 / tests-ok both success.
- Measured broad coverage (whole modules): shared helper **100% lines /
99.25% branches / 100% functions**; Chief 96.96/85.56/80.18; Delivery
96.91/79.74/86.67. This is not a 100% added-branch claim; unexecuted
helper ranges include queue.reason null fallback, direct
missing-candidate shortcircuit, and the new advisory prior-value
empty-string fallback. The latter cannot authorize an action and the
original full requirement remains queryable. No added source line
appears in the Node uncovered-line list; that is not proof of every
added branch combination. No exclusions or weakened evidence assertions.
- Updated compact long-term memory, delivery/Chief/backend architecture,
API/OpenAPI, decision, changelog and canonical mirrors. Original context
cap/source list unchanged. Broader mandatory-context slimming stays
separately deferred.
- Pairing self-review covered correctness, security and conventions; no
independent Verifier PASS claimed. Final source:
`1f8cff3abcaad9ccf91ebb0a7b0980c4307deae0`.

Not run: live OpenToday deployment/restart/state or binding edits,
external provider writes, paid model inference, or a real vendor
SDK/model on this new evolution path. Runtime/SDK-protocol subprocess
fixtures do not establish onsite acceptance. Source preserves #2527
Feishu integration.
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.

2 participants