Repository navigation
fix(feishu): accept the documented markdown table mode - #147886
MarMarLabs wants to merge 363 commits into
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: blocked before merge. What this changesAccept Feishu’s documented markdown.tables setting and apply the delivering account’s mode across messages, comments, presentations, and streaming replies. Example: Set channels.feishu.accounts.work.markdown.tables to "bullets" and send a table containing Name=Ada and Role=Lead through work.
Review scores
ProductKind: Bug fix · Worth it: Needs a maintainer decision · Fix scope: Complete Merge readiness⛔ Blocked before merge - 1 item remains This PR fixes a documented Feishu configuration failure that remains on current main; no introduced correctness defect was established, but the proposed table default needs an owner decision. Priority: P2 Decision needed
Before merge
FindingsNone. Agent review detailsHow this fits togetherThe Feishu plugin receives configured accounts and outbound reply payloads, selects their table representation, chunks physical messages, and returns provider receipts through the shared delivery lifecycle. flowchart TD
A[Config and account] --> B[Shared table mode resolver]
C[Messages and reply payloads] --> D[Feishu formatting owner]
B --> D
D --> E[Cards posts and comments]
E --> F[Authorized Lark transport]
F --> G[Receipts and settlement]
Technical reviewBest possible solution: Restore the documented setting and account-aware delivery with an explicitly chosen Feishu table default. Do we have a high-confidence way to reproduce the issue? Yes: current-main and latest-stable strict schemas omit tables, matching the supplied CLI validation and Gateway-startup failures; this review executed no target code. Is this the best way to solve the issue? The shared schema and existing table resolver are appropriate owners, and conversion before chunking addresses the delivery defect; choosing block as the default remains a product decision. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against c500bb7635df. Provenance checked
TestingProof path: shipped entry point. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource +1737, Tests +7383, Docs +9, Generated 0, Other -2. Total +9127 across 48 files. Added test files: 10. View PR surface stats
Review metrics
LabelsLabel changes: No label changes. Label justifications:
Rating scale6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior. WorkflowClawSweeper edits this one comment on every review. Comment HistoryReview history (172 earlier review cycles; latest 8 shown)
Reviewed October 14, 2026, 6:33 AM ET / 10:33 UTC (Revision 173). |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 08c0c469de
ℹ️ 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".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 314ddb954e
ℹ️ 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".
…nd trim overlapping rows
…send one that maps to nothing
… at a soft line break
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 78b8a8b6e3
ℹ️ 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".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 8f44f2446c
ℹ️ 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".
| const at = blockOffset(remaining, text); | ||
| const before = (at < 0 ? remaining : remaining.slice(0, at)).trimEnd(); |
There was a problem hiding this comment.
Reconcile synthetic headers before posting table continuations
With markdown.tables: "off" and both block and preview streaming enabled, a table exceeding the block chunk size arrives in continuation payloads with repeated headers. Fresh evidence beyond the earlier prefix/occurrence fixes is findTableContinuationHeader() in src/agents/embedded-agent-block-chunker.tables.ts:120-136, which adds those headers without adding them to the cumulative source. After the first block is consumed, this lookup therefore returns -1, and the remaining data rows are treated as before prose and prepended to the continuation, duplicating its rows. A four-row table cut at 64 characters reproduces duplicate continuation rows in the physical posts, which subsequent preview updates cannot retract. Reconcile using the block's source rows or source metadata, excluding synthetic header framing.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: d56ccf1712
ℹ️ 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".
| const keepsReasoning = | ||
| !tableNeedsPostPath(combined) && | ||
| chunkFeishuCardMarkdown(cardChunkOptions(combined)).length === 1; |
There was a problem hiding this comment.
Project reasoning before retaining the opening-prose card
With markdown.tables: "block", reasoning previews and block streaming, a compact reasoning table with long headers can exceed textChunkLimit only after projection, so previewReasoningMessage stores its authored form. If a quoted/list-opened answer table is then posted behind opening prose, this check accepts the raw reasoning because it fits one card and tableNeedsPostPath is off-only. Fresh evidence beyond the whole-card close fix is that this retained-prose branch uses finalizedReasoningText directly and suppresses supplementalReasoningText. formatReasoningPrefix puts the raw table inside a blockquote, which Feishu cannot draw, and no post carries those reasoning rows. Re-project the reasoning or move it to the supplement before retaining this card.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: fe59c2e21a
ℹ️ 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".
| // cancellation only stops the next payload. Ahead of the catch below, so the abort | ||
| // reaches the caller as an abort rather than as a send failure; each chunk already | ||
| // accepted was reported as it was sent. | ||
| signal?.throwIfAborted(); |
There was a problem hiding this comment.
Preserve accepted receipts when cancellation stops a fanout
When cancellation arrives after a physical chunk has been accepted, this check bypasses the partial-delivery catch. Fresh evidence beyond the earlier cancellation fix is a sendFormattedText call with signal but without the optional onDeliveryResult: one message is sent, then the caller receives only AbortError, with no receipt or accepted content. The same pattern occurs in comment fanout and between a caption and its attachment. Preserve accumulated acceptance in a partial-delivery error, retaining cancellation as its cause, rather than relying on an optional callback; this also preserves the "write-capable work settlement" required by AGENTS.md.
AGENTS.md reference: AGENTS.md:L97-L97
Useful? React with 👍 / 👎.
| const first = text.slice(0, at).split("\n").length - 1; | ||
| if (lines.every((_, line) => code.has(first + line) === own.has(line))) { | ||
| return at; |
There was a problem hiding this comment.
Exclude inline-code copies when matching accepted table blocks
With markdown.tables: "off" and both block and preview streaming enabled, a multiline inline-code example containing the same rows as a later posted table is still selected as the accepted occurrence. Fresh evidence beyond the fenced-example repair is that the new codeBlockLines() filter excludes only fenced/indented blocks, so this comparison accepts a copy inside a single- or double-backtick code span. Settling then retains only the prose through the example's opening backtick on the preview and posts its closing backtick plus the actual table as the tail, breaking the authored sample across messages. Exclude inline-code ranges too, or match the parsed table's source occurrence before adopting its receipt.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 8f69889a2b
ℹ️ 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".
| // What this sends is owned from here on: a later walk finds it and sends only what | ||
| // follows, and a partly accepted one keeps the chunks that went out. | ||
| const tail = sendChunkedTextReply({ | ||
| text: remaining.trimStart(), |
There was a problem hiding this comment.
Preserve code indentation when posting the undispatched tail
With markdown.tables: "off" and block/preview streaming enabled, an accepted table followed by an indented code block reaches this remainder send. The block separator has already been removed, but trimStart() also removes the first code line's indentation: SELECT ...\n WHERE ... is sent as SELECT ...\n WHERE .... This changes the authored code block into mixed prose/code; an indented literal fence can likewise become an unmatched opener. Remove only separating newlines rather than content indentation.
Useful? React with 👍 / 👎.
| const answer = shown.slice(shown.includes(rule) ? shown.lastIndexOf(rule) + rule.length : 0); | ||
| return answer && prose.startsWith(answer) ? answer : ""; |
There was a problem hiding this comment.
Distinguish authored horizontal rules from the reasoning separator
When block/preview streaming retains opening prose and its final rewrite is rejected, an authored \n\n---\n\n in the accepted preview is mistaken for the reasoning/answer separator—even when there was no reasoning. For example, if the card accepted two paragraphs separated by a horizontal rule and the requested opening prose adds another sentence, this extracts only the second paragraph, fails the prefix comparison, and returns "". leadingBlockProse().settle() consequently sends the entire opening prose again beside the still-visible card instead of sending only the missing suffix. Strip a separator only when it belongs to an actual reasoning prefix, or retain the answer offset explicitly.
Useful? React with 👍 / 👎.
|
Closing this to keep my open queue small. Happy to reopen or redo it if it's still useful. |
What Problem This Solves
Fixes Feishu
markdown.tablesvalidation at startup and applies the setting to sends, replies, presentations and previews.User impact
Channel and account table settings are accepted, including the delivering/default account. Ordinary
offtable messages settle as authored rich-text posts. Inoff, presentations keep controls and show literal rows in card text and live previews. When idle close reuses a posted answer, reasoning stays with opening prose on the preview card when both fit, and otherwise follows the answer once. With block and preview streaming on, quoted and list-openedblocktables after prose post once in tested batches. A fenced example of the table no longer splits the card.With tables off, a partly accepted fallback or recovery prose card lets later text send without replaying its content. A final whose remainder is rejected whole reports accepted receipts and sends its attachment. Only the idle close keeps that failure bare, so the matching final still sends only the remainder. A thrown close can leave a stale preview visible and unreported. The unchanged post renderer draws authored Markdown tables as grids.
In
block, the table post names retained prose and tail at close. A later extension, final, block or retry sends only what follows an accepted prose tail, and a later final or block that repeats it names it. A preview that ends the run with no later final or block reports its late post to no caller. Block post receipts carry their image. A recovery card carries only added prose. Receipts list IDs in creation order. After settlement, a new message keeps its equal tail and repeated prefix. An overlapping message boundary can lose or interleave preview text. A retry after a rejected late chunk keeps prose accepted before a soft line break. An accepted converted table repeats on retry. A new row checks the following sentence arrives once. With tables off, idle does not retry the rest. Plain-table early drains repeat preview text. Main's #192482 owns the double tail of a completed card, and this PR keeps that behavior. With tables off, preview-only closes still omit receipts.Why this change was made
Feishu's strict schema gains the shared table option and keeps the legacy
markdown.modeandmarkdown.tableMode. Formatting-aware delivery converts whole logical tables before chunking. Core calls the channel'sbeforeSendAttempthook before recording a formatted send as started, so recovery can resend after a stop during Feishu's first runtime load. Presentations and reasoning degrade undrawable block-mode tables to readable lists. Foroff, display-only delimiter escaping leaves authored fallback and deduplication text alone. It declaresblockas Feishu's table default.The generated channel baseline gains two entries,
channels.feishu.markdown.tablesandchannels.feishu.accounts.*.markdown.tables. The core and plugin counts are main's. This exception is not maintainer approval. The allocation covers 7,153 net test lines for table conversion, chunking, receipts and recovery. The PR leaves the shared scalar alone. Baseline cuts consume headroom.Evidence
Upgrade proof
Published stable
2026.10.2atb8952d477f0cseeded channelmarkdown.mode: nativeandmarkdown.tableMode: ascii, an account'smode: escapeandtableMode: simple, and two accounts without Markdown settings. Proof headeffbf8c7a8abused that state and main29fc232d40bea copy, in fresh worktrees with separately packed Feishu plugins.markdown.tablesat channel and account scopeBoth Gateways exit 78 on the schema 24 agent database until
openclaw doctor --fixmigrates it to 26. Repair and shutdown then exit 1 withERR_SPAWN_BROKER_UNAVAILABLE. Both databases stay readable. The cause is undiagnosed. This proves compatibility, not a clean upgrade. Credentials were synthetic, with Feishu accounts and transports disabled. Only the Feishu config object stays byte-identical. Maintenance changed other config. The diff adds nosrc/statechange or migration.Table default
Upgrade proof at stable
b8952d477f0cand main29fc232d40beresolvescodefor unconfigured and legacy-only accounts, butautoroutes pipe-bordered tables to raw cards with native grids. Legacy keys do not select the mode. Proof headeffbf8c7a8abresolvesblock, retaining those grids. Other modes convert before routing.Standalone pipe-less and one-sided-pipe tables get cards on
autosends and non-streamed replies. In chat text, quoted and list-opened tables take posts. Messages needing multiple static cards also take posts, usingcodeunless fences cannot survive the cut. The five-table limit excludes streams. Direct post sends and edits still resolvecode. Comments convert raw rows tocode.A
codedefault fences those grids in cards, shown atoutbound.markdown-tables.test.ts:662in948b2088919.blockalso drops "Avoid Markdown tables." from Feishu group prompts, even with accountcodeorbullets, becausesrc/auto-reply/reply/groups.ts:126-131reads the plugin default. Telegram and Matrix already declareblock. Maintainers decide the default.Current repair verification
Hosted CI on
d56ccf17129emerged with main0cc3586362cbpassed 79 checks, with 52 skipped and neutral CodeQL. No hosted CI result is claimed forf1acbc1dfb87.Local runs passed 1,533 Feishu tests and the extension type lanes at
d56ccf17129e, and 272 Feishu database-worker tests and 179 core delivery tests atcea11348420c. The generated-file checks passed onf1acbc1dfb87with the matching install. Typed lint, formatting andtsgo:scriptslast passed atff39b7bb3adc. All ten ratchets againstc50ff4fbe541passed, test-lines with 163 lines of slack. The PR adds 7,153 lines and matching credit. Main's seven #192482 rows pass. Five upstream rows fail with old test setups. Updated rows preserve their assertions.Lark before/after rendering
Comparison and limits cover four byte-identical synthetic fixture pairs through production send, reply and streaming components with the real SDK. They compare plugin source
e7f29073f4dcwith rendering files published at34f132a1bb49and were not retaken ateffbf8c7a8ab. Later merges retain those rendering files and the off-mode projection. The idle row's settlement bookkeeping changed, so that row rests on regression tests rather than these captures.Both runs exited 0. Idle settlement adds one reasoning-only post and keeps two receipts without replaying the accepted answer. All three dispatcher cases keep byte-identical authored final-post payloads. The captures used no Gateway or mainland Feishu client. Lark still joins adjacent quoted paragraphs in the reasoning preview, not addressed here.
Historical evidence
Results apply to the named commits.
dbb422c85a5rejectedtableswith exit 1 and refused Gateway startup with exit 78. At08c0c469de4, validation passed, the Gateway reached ready and shut down with child exit 0, and Doctor kept the Markdown keys.314ddb95, HTTPS Feishu stub, real SDK,renderModeunset. Accounts resolvedcode,bulletsandoffas configured across full, reply and default-account sends, all exit 0.c311d8a5d53comment, real SDK. Allowed sent four of four with every receipt. Revoked after one of four was accepted, kept its receipt and exact content in the partial-delivery envelope, and the claim guard refused the pending terminal rather than replay it.9d52663f11bandd0f6e3a3ba0comment, real SDK, 62 captures. Blockquote and list-opened tables became readable fenced posts, and a mixed message kept both tables.