fix(web): mechanical repair of GFM tables with off-by-one separator rows
Summary
Adds a remark plugin (`remarkRepairTables`) that silently fixes the dominant broken-table pattern in agent output: the GFM separator row has fewer pipe-delimited cells than the header row.
`remark-gfm` follows the GFM spec and truncates the table to the separator column count, silently dropping header and data cells. This plugin reads the original source via `file.value` + `node.position` offsets, detects the column mismatch, pads the separator with `---` cells, and re-parses just that table block. Only broken tables are touched; valid tables, prose with pipes, and code spans are unaffected.
The plugin runs immediately after `remarkGfm` in both `MARKDOWN_PLUGINS` and `MARKDOWN_PLUGINS_WITH_BREAKS`, where `node.position` source offsets are still accurate.
Analysis of real session data: 975 apparent table blocks over 7 days; 879 flagged for separator mismatch; 744 (84.6%) were false positives (inline pipes in prose/shell). The separator off-by-one pattern accounted for ~94 of 135 confirmed broken tables.
Test plan
- [x] `bun typecheck` — clean (cli / hub / web)
- [x] `bun run test:web` — 10 new table-repair tests pass (valid pass-through, off-by-one, off-by-N, no surrounding pipes, alignment hints preserved, header-only table, multiple mixed tables, prose/code-span false-positive immunity), no regressions in 974 total tests
- [x] Structural column-count assertions on all repair test cases (not just content presence)
Disclosure
This PR was developed with assistance from Claude Sonnet 4.6 (claude-sonnet-4-6) acting as a peer agent in a multi-agent workflow.