Skip to content

fix(discord-bot): rewrite GFM tables to bullets for Discord - #357

Merged
patroza merged 2 commits into
fork/devfrom
fix/discord-strip-gfm-tables
Aug 6, 2026
Merged

fix(discord-bot): rewrite GFM tables to bullets for Discord#357
patroza merged 2 commits into
fork/devfrom
fix/discord-strip-gfm-tables

Conversation

@omegent-app

@omegent-app omegent-app Bot commented Aug 6, 2026

Copy link
Copy Markdown

Summary

Discord does not render GFM pipe tables. Agents (especially Grok) still emit them because they work on T3 web / GitHub. Dead asciiTables conversion was on disk but unwired, so Discord saw raw | grids.

Design (delivery-only):

  • Keep GFM tables in the agent transcript / T3 clients that render them
  • On Discord channel delivery only, rewrite complete pipe tables → bullet lists
  • Do not ban tables in agent-turn-rules.md (would punish every surface)

Base: fork/dev

Changes

  • Remove unused ASCII tableification modules
  • markdownTables.ts: detect GFM tables → bullets
  • Wire rewrite on stream tip, heartbeat, and finalize in ResponseBridge
  • Agent rules stay free of a table ban

Test plan

  • vp test run apps/discord-bot/src/presentation/markdownTables.test.ts
  • Deploy/smoke: table in Grok answer → Discord bullets; T3 web still has the table
  • Deploy/smoke: prose without tables unchanged

opened by joshuadima in chat thread Discord · Discord · T3

Co-authored by: MindfulLearner, patroza

@patroza
patroza marked this pull request as ready for review August 6, 2026 07:57
@patroza
patroza marked this pull request as draft August 6, 2026 08:01
@patroza

patroza commented Aug 6, 2026

Copy link
Copy Markdown
Owner

@omegent I guess the question is: when the agent is instructed not to use tables, why would we convert it?
also the question is if its important that other clients who can render tables, should still benefit from tables, in that case, perhaps the instruction should not include the note about not using tables, and we should only auto convert for Discord?

@omegent-app

omegent-app Bot commented Aug 6, 2026

Copy link
Copy Markdown
Author

T3 could not open a thread for this pull request. Check the server logs for details.

@omegent-app
omegent-app Bot force-pushed the fix/discord-strip-gfm-tables branch from 98150f5 to f4c849e Compare August 6, 2026 08:20
omegent-app Bot and others added 2 commits August 6, 2026 08:22
Discord never renders pipe tables; dead ASCII conversion stayed unwired
and Grok still posts raw grids. Drop asciiTables, convert complete GFM
tables to bullet lists on stream/finalize/heartbeat, and ban tables in
Discord agent-turn rules.

Co-authored-by: Joshua Dimaunahan <170177550+MindfulLearner@users.noreply.github.com>
Tables remain useful on T3 web and other clients that render them.
Discord-only delivery rewrites pipe tables to bullets; agents should
not be told to avoid tables globally.

Co-authored-by: Joshua Dimaunahan <170177550+MindfulLearner@users.noreply.github.com>
Co-authored-by: Patrick Roza <42661+patroza@users.noreply.github.com>
@omegent-app
omegent-app Bot force-pushed the fix/discord-strip-gfm-tables branch from f4c849e to 58e0946 Compare August 6, 2026 08:22
@omegent-app
omegent-app Bot changed the base branch from fork/discord to fork/dev August 6, 2026 08:22
@patroza
patroza marked this pull request as ready for review August 6, 2026 08:33
@patroza
patroza enabled auto-merge (squash) August 6, 2026 08:33
@patroza
patroza disabled auto-merge August 6, 2026 08:43
@patroza
patroza enabled auto-merge (squash) August 6, 2026 08:43
@patroza
patroza disabled auto-merge August 6, 2026 08:49
@patroza
patroza enabled auto-merge (squash) August 6, 2026 08:49
@patroza
patroza marked this pull request as draft August 6, 2026 08:49
auto-merge was automatically disabled August 6, 2026 08:49

Pull request was converted to draft

@patroza
patroza marked this pull request as ready for review August 6, 2026 08:49
@omegent-app omegent-app Bot closed this Aug 6, 2026
@omegent-app omegent-app Bot reopened this Aug 6, 2026
patroza added a commit that referenced this pull request Aug 6, 2026
Fixes the cause of [#357](#357)
sitting on four required checks
that could never report.

## What happened

`pull_request` defaults to the activity types `opened`, `synchronize`,
`reopened`. #357's timeline:

| Event | Activity type | Result |
| --- | --- | --- |
| force-pushed while base was `fork/discord` | `synchronize` |
**filtered** — #348 removed the overlay bases from this workflow's
`branches` list |
| base changed `fork/discord` → `fork/dev` | `edited` | **not** a
default type |
| marked ready for review | `ready_for_review` | **not** a default type
|

So the PR never emitted a watched event while sitting on a watched base.
Zero `fork-ci` runs existed
for its head SHA, the four required checks stayed `Expected — Waiting
for status to be reported`, and
auto-merge waited on something that had no way to arrive. Toggling
draft/ready and re-enabling
auto-merge could not help, because none of those are trigger types
either.

## Change

List the activity types explicitly and add both missing ones:

```yaml
types: [opened, synchronize, reopened, ready_for_review, edited]
```

`edited` also fires for **title and body edits**, which happen
constantly here and must not spend a
full CI run including a macOS runner. `github.event.changes.base` is
populated only when the base
actually changed, so each job skips an edit that did not move the base.

## Unblocking #357 itself

Closed and reopened it — `reopened` **is** a default type, so it fires
against the current base
without adding a commit to the branch. Checks are running there now.

## Scope

I checked every open PR on `fork/dev`: only #357 was affected. The
others were based on
`fork/changes`, which is still in the `branches` list, so their pushes
did produce runs. This was
specifically a PR that had been sitting on an overlay base when those
bases were removed — a
transitional hazard from the drain, but one worth closing since a
required check that can never
report is indistinguishable from a hung CI system.

Co-authored by [@patroza](https://github.com/patroza)

opened by [Patrick Roza](https://discord.com/users/95218063095377920) in
chat thread **Discord** ·
[Discord](https://discord.com/channels/1083767712431480922/1534783738322485399/1534783738322485399)
· [T3](https://t3vm/?thread=584a9ad3-243e-4308-8a13-49acdd758b17)

Co-authored-by: omegent-app[bot] <306514130+omegent-app[bot]@users.noreply.github.com>
Co-authored-by: Patrick Roza <42661+patroza@users.noreply.github.com>
@patroza
patroza merged commit 9ba9b1d into fork/dev Aug 6, 2026
10 checks passed
patroza added a commit that referenced this pull request Aug 6, 2026
Reverts the `edited` half of
[#359](#359). **My change, my
bug** — and it is a merge-gate bypass, so it should go in ahead of the
other open PRs.

## What I got wrong

#359 added `edited` to the `pull_request` activity types so retargeting
a PR would run CI, with a
job-level `if` guard skipping edits that did not move the base. I
reasoned the guard would keep the
cost down. It does — but a **skipped job still publishes a check run**,
GitHub counts a skipped
required check as **satisfied**, and the skipped run **supersedes** the
real one.

So editing the title or body of a PR whose checks had *failed* replaces
those failures with skipped
runs and leaves it mergeable.

Observed live on #364 — I edited the body, and:

```
Check                          skipping
Mobile Native Static Analysis  skipping
Release Smoke                  skipping
Test                           skipping
```

with `mergeable: MERGEABLE`, `mergeStateStatus: CLEAN`. Every required
check satisfied by a run that
executed nothing.

## Change

Drop `edited` and the four job guards. Keep `ready_for_review`, which is
what actually fixed the case
#359 was opened for: #357 had been retargeted and then **marked ready**,
and nothing fired.

## What this gives up

Retargeting without a push no longer triggers CI. That is rarer now that
overlays are gone and
everything targets `fork/dev`, and it is recoverable — close and reopen
fires `reopened`, which is
watched. That is how #357 was unblocked in the first place.

A gap that needs a deliberate action to work around beats a bypass that
needs a title edit to
trigger.

Co-authored by [@patroza](https://github.com/patroza)

opened by [Patrick Roza](https://discord.com/users/95218063095377920) in
chat thread **Discord** ·
[Discord](https://discord.com/channels/1083767712431480922/1534783738322485399/1534783738322485399)
· [T3](https://t3vm/?thread=584a9ad3-243e-4308-8a13-49acdd758b17)

Co-authored-by: omegent-app[bot] <306514130+omegent-app[bot]@users.noreply.github.com>
Co-authored-by: Patrick Roza <42661+patroza@users.noreply.github.com>
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.

1 participant