Skip to content

fix(feishu): accept the documented markdown table mode - #147886

Closed
MarMarLabs wants to merge 363 commits into
openclaw:mainfrom
MarMarLabs:fix/feishu-markdown-tables
Closed

MarMarLabs wants to merge 363 commits into
openclaw:mainfrom
MarMarLabs:fix/feishu-markdown-tables

Conversation

@MarMarLabs

@MarMarLabs MarMarLabs commented Sep 14, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Fixes Feishu markdown.tables validation 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 off table messages settle as authored rich-text posts. In off, 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-opened block tables 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.mode and markdown.tableMode. Formatting-aware delivery converts whole logical tables before chunking. Core calls the channel's beforeSendAttempt hook 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. For off, display-only delimiter escaping leaves authored fallback and deduplication text alone. It declares block as Feishu's table default.

The generated channel baseline gains two entries, channels.feishu.markdown.tables and channels.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.2 at b8952d477f0c seeded channel markdown.mode: native and markdown.tableMode: ascii, an account's mode: escape and tableMode: simple, and two accounts without Markdown settings. Proof head effbf8c7a8ab used that state and main 29fc232d40be a copy, in fresh worktrees with separately packed Feishu plugins.

Check Stable Proof head Upstream main
Legacy config validates, keys and overrides read back unchanged Yes Yes, before and after migration Yes, before and after migration
Feishu config object on disk Seed Byte-identical Byte-identical
Stored session loads with the same key and ID, and a label update survives restart Created and patched here Yes Yes
Documented markdown.tables at channel and account scope Rejected, exit 1 Accepted, all four values Rejected, exit 1
Account override wins, unset accounts inherit the channel value Key rejected Yes Key rejected

Both Gateways exit 78 on the schema 24 agent database until openclaw doctor --fix migrates it to 26. Repair and shutdown then exit 1 with ERR_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 no src/state change or migration.

Table default

Upgrade proof at stable b8952d477f0c and main 29fc232d40be resolves code for unconfigured and legacy-only accounts, but auto routes pipe-bordered tables to raw cards with native grids. Legacy keys do not select the mode. Proof head effbf8c7a8ab resolves block, retaining those grids. Other modes convert before routing.

Standalone pipe-less and one-sided-pipe tables get cards on auto sends and non-streamed replies. In chat text, quoted and list-opened tables take posts. Messages needing multiple static cards also take posts, using code unless fences cannot survive the cut. The five-table limit excludes streams. Direct post sends and edits still resolve code. Comments convert raw rows to code.

A code default fences those grids in cards, shown at outbound.markdown-tables.test.ts:662 in 948b2088919. block also drops "Avoid Markdown tables." from Feishu group prompts, even with account code or bullets, because src/auto-reply/reply/groups.ts:126-131 reads the plugin default. Telegram and Matrix already declare block. Maintainers decide the default.

Current repair verification

Hosted CI on d56ccf17129e merged with main 0cc3586362cb passed 79 checks, with 52 skipped and neutral CodeQL. No hosted CI result is claimed for f1acbc1dfb87.

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 at cea11348420c. The generated-file checks passed on f1acbc1dfb87 with the matching install. Typed lint, formatting and tsgo:scripts last passed at ff39b7bb3adc. All ten ratchets against c50ff4fbe541 passed, 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 e7f29073f4dc with rendering files published at 34f132a1bb49 and were not retaken at effbf8c7a8ab. 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.

State Before After
Off-mode presentation Native table despite off mode Literal rows and retained button
Off-mode answer preview Native answer-preview table Literal answer-preview rows
Off-mode reasoning preview Reasoning-table rows missing Reasoning-table rows visible
Idle reuse of accepted answer Reasoning disappears after idle One answer and separate reasoning

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.

  • CLI at dbb422c85a5 rejected tables with exit 1 and refused Gateway startup with exit 78. At 08c0c469de4, validation passed, the Gateway reached ready and shut down with child exit 0, and Doctor kept the Markdown keys.
  • Gateway send RPC at 314ddb95, HTTPS Feishu stub, real SDK, renderMode unset. Accounts resolved code, bullets and off as configured across full, reply and default-account sends, all exit 0.
  • Authority proof at c311d8a5d53 comment, 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.
  • Lark client round at 9d52663f11b and d0f6e3a3ba0 comment, real SDK, 62 captures. Blockquote and list-opened tables became readable fenced posts, and a mixed message kept both tables.

@clawsweeper

clawsweeper Bot commented Sep 14, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation channel: feishu Channel integration: feishu size: S labels Sep 14, 2026
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Sep 14, 2026
@clawsweeper

clawsweeper Bot commented Sep 14, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: blocked before merge.

What this changes

Accept 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.

  • Before: Configuration validation rejects tables, preventing Gateway startup.
  • After: Configuration validates and the work account renders the row as Ada with Role: Lead.

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) Strong behavior evidence supports a useful repair with no established code finding; unresolved default direction caps overall readiness.
Proof confidence 🦞 diamond lobster (5/6) ✨ media proof bonus Sufficient (screenshot): Supplied CLI/Gateway runs exercise schema acceptance, inspected Lark screenshots show off-mode card rendering, and the registered-sender live SDK run proves allowed fanout and rejection after writer reassignment; newer settlement bookkeeping is supported by boundary regressions rather than refreshed client captures.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: Needs a maintainer decision · Fix scope: Complete
User problem: Using Feishu’s documented table option prevents Gateway startup, while table formatting must follow the account actually delivering the reply.
Reason: The repair has clear user value, but its additional default and group-prompt changes lack maintainer-confirmed direction.

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
Reviewed head: 93796760f386f1cff0bf3cc7c52512ed4f6e3c7c
Owner decision: Required. See Decision needed.

Decision needed

  • Question: Should Feishu declare block as its table default, including the resulting change to group-prompt table guidance?
  • Recommendation: Approve the block default: Keep native grids for ordinary unconfigured card messages and accept the documented routing and group-guidance changes.
  • Why: Block preserves the native grids existing automatic card delivery already shows, but it changes the resolved fallback, additional table-shape routing, comment formatting, and group instructions; no recorded owner decision settles that direction.

Before merge

  • Resolve maintainer decision - Resolve the maintainer decision shown above before merge.

Findings

None.

Agent review details

How this fits together

The 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]
Loading

Technical review

Best 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

  • Feishu Markdown configuration keeps the original intent (2267d58: The community-plugin replacement supplied the strict legacy Markdown schema; retaining its accepted keys preserves the shipped configuration contract.)
  • Automatic card and table routing changes intended behavior with a stated reason (88d6556: The refactor centralized the existing regex-based card promotion while preserving formatting; this PR explains parser-backed routing using captured missing-row failures and explicit table modes.)
  • Post normalization and chunk envelopes keeps the original intent (98e88ab: Post-only normalization preserves line breaks and converts tables before expansion; the new planners retain that ordering and prepared-post contract.)
  • Streaming settlement ownership keeps the original intent (c0e2dd7: The simplification deliberately replaced generation histories with one close promise and latest receipt; this PR keeps that lifecycle shape while tracking matching accepted table posts.)

Testing

Proof path: shipped entry point.

Security

None.

Evidence

What I checked:

Likely related people:

  • Peter Steinberger: Raw commit c0e2dd7 adds extensions/feishu/src/reply-dispatcher.ts:312 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: c0e2dd79845a; files: extensions/feishu/src/reply-dispatcher.ts)
  • Peter Lee: Raw commit 98e88ab adds extensions/feishu/src/markdown.ts:68 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: medium; commits: 98e88ab1a6b7; files: extensions/feishu/src/markdown.ts)
  • joshavant: Raw commit d8ea723 adds extensions/feishu/src/reply-dispatcher.ts:331 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: medium; commits: d8ea72394734; files: extensions/feishu/src/reply-dispatcher.ts)

PR surface

Source +1737, Tests +7383, Docs +9, Generated 0, Other -2. Total +9127 across 48 files. Added test files: 10.

View PR surface stats
Area Files Added Removed Net
Source 22 2395 658 +1737
Tests 20 7460 77 +7383
Docs 1 10 1 +9
Config 0 0 0 0
Generated 3 21 21 0
Other 2 0 2 -2
Total 48 9886 759 +9127

Review metrics

Metric Value Why it matters
Configuration surface Two optional schema leaves restored; plugin default changes from code fallback to block. The leaves implement an existing documented setting; the default has broader user-visible consequences requiring owner direction.

Labels

Label changes:

No label changes.

Label justifications:

  • P2: A documented advanced Feishu formatting setting currently invalidates configuration, with a limited channel-specific blast radius.
  • merge-risk: 🚨 compatibility: Unconfigured and legacy-only Feishu accounts resolve a different table default, and group prompts change regardless of account-specific table overrides.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦞 diamond lobster and patch quality is 🐚 platinum hermit.
  • proof: sufficient: Contributor real behavior proof is sufficient.
  • proof: 📸 screenshot: Contributor real behavior proof includes screenshot evidence.

Rating scale

6/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.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

History

Review history (172 earlier review cycles; latest 8 shown)
  • reviewed 2026-10-12T21:29:00.314Z sha 4ff5233 :: blocked before merge. :: none
  • reviewed 2026-10-13T00:37:02.940Z sha 1bd5d29 :: blocked before merge. :: none
  • reviewed 2026-10-13T02:30:19.232Z sha 30dc65e :: blocked before merge. :: none
  • reviewed 2026-10-13T04:00:53.434Z sha 4643cc3 :: blocked before merge. :: none
  • reviewed 2026-10-13T09:00:39.441Z sha cf49e1d :: blocked before merge. :: none
  • reviewed 2026-10-13T09:30:25.044Z sha cf49e1d :: blocked before merge. :: none
  • reviewed 2026-10-14T06:21:59.449Z sha 6399f66 :: blocked before merge. :: none
  • reviewed 2026-10-14T08:06:29.844Z sha a6eb497 :: blocked before merge. :: none

Reviewed October 14, 2026, 6:33 AM ET / 10:33 UTC (Revision 173).

@clawsweeper clawsweeper Bot added rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Sep 14, 2026
@MarMarLabs
MarMarLabs marked this pull request as ready for review September 14, 2026 12:55
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 14, 2026 •

Copy link
Copy Markdown
Contributor

Codex Review Summary

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

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-06T16:07:36.521287Z c5d1ee9 New commits
ℹ️ 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.

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

Copy link
Copy Markdown
Contributor

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: 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".

Comment thread extensions/feishu/src/outbound.ts Resolved
Comment thread extensions/feishu/src/send.ts Resolved

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

Copy link
Copy Markdown
Contributor

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: 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".

Comment thread extensions/feishu/src/outbound.ts Resolved
@clawsweeper clawsweeper Bot added merge-risk: 🚨 message-delivery 🚨 May drop, duplicate, misroute, suppress, or wrongly target messages. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. and removed rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Sep 14, 2026

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

Copy link
Copy Markdown
Contributor

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: 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".

Comment thread extensions/feishu/src/reply-senders.ts Resolved

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

Copy link
Copy Markdown
Contributor

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: 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".

Comment on lines +558 to +559
const at = blockOffset(remaining, text);
const before = (at < 0 ? remaining : remaining.slice(0, at)).trimEnd();

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P2 Badge 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 👍 / 👎.

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

Copy link
Copy Markdown
Contributor

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: 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".

Comment on lines +498 to +500
const keepsReasoning =
!tableNeedsPostPath(combined) &&
chunkFeishuCardMarkdown(cardChunkOptions(combined)).length === 1;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P2 Badge 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 👍 / 👎.

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

Copy link
Copy Markdown
Contributor

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: 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();

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P1 Badge 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 👍 / 👎.

Comment on lines +97 to +99
const first = text.slice(0, at).split("\n").length - 1;
if (lines.every((_, line) => code.has(first + line) === own.has(line))) {
return at;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P2 Badge 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 👍 / 👎.

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

Copy link
Copy Markdown
Contributor

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: 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(),

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P2 Badge 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 👍 / 👎.

Comment on lines +58 to +59
const answer = shown.slice(shown.includes(rule) ? shown.lastIndexOf(rule) + rule.length : 0);
return answer && prose.startsWith(answer) ? answer : "";

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P2 Badge 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 👍 / 👎.

@MarMarLabs

Copy link
Copy Markdown
Contributor Author

Closing this to keep my open queue small. Happy to reopen or redo it if it's still useful.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

channel: feishu Channel integration: feishu docs Improvements or additions to documentation merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. P2 Normal backlog priority with limited blast radius. proof: 📸 screenshot Contributor real behavior proof includes screenshot evidence. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. size: XL

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant