Skip to content

Support Markdown tables in session server#1507

Merged
gjkim42 merged 1 commit into
mainfrom
agent/session-markdown-tables
Jul 17, 2026
Merged

Support Markdown tables in session server#1507
gjkim42 merged 1 commit into
mainfrom
agent/session-markdown-tables

Conversation

@kelos-bot

@kelos-bot kelos-bot Bot commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

What type of PR is this?

/kind feature

What this PR does / why we need it:

Adds GFM-style pipe table support to the Session web chat Markdown renderer.

The renderer recognizes valid header and delimiter rows, applies optional column alignment, preserves inline Markdown inside cells, and handles escaped pipes and pipes inside code spans. Tables continue to use safe DOM construction rather than HTML injection, and wide tables scroll horizontally on narrow screens.

This also adds behavioral and safety coverage for aligned tables, optional outer pipes, uneven row widths, malformed table input, inline links and code, and raw HTML escaping.

Which issue(s) this PR is related to:

N/A

Special notes for your reviewer:

Validation:

  • make verify
  • env -u CODEX_HOME -u CODEX_AUTH_JSON make test
  • git diff --check

The Codex variables are unset for the unit suite because the agent environment injects them globally, while entrypoint isolation tests expect them to be absent.

Does this PR introduce a user-facing change?

Session web chat now renders Markdown pipe tables with column alignment and horizontal scrolling for wide tables.

Summary by cubic

Add GFM-style pipe table support to the Session web chat Markdown renderer. Tables render safely with alignment, horizontal scrolling, and a 10k-cell cap.

  • New Features
    • Parse and render Markdown pipe tables (outer pipes optional).
    • Apply column alignment (left/center/right) from the delimiter row.
    • Preserve inline Markdown in cells; handle escaped pipes and code spans.
    • Escape raw HTML; ignore extra cells; leave missing cells blank; non-tables with pipes stay prose.
    • Add table styles and horizontal scrolling; cap rendering at 10,000 cells (oversized tables stay plain text).

Written for commit 812aa10. Summary will update on new commits.

Review in cubic

@github-actions github-actions Bot added kind/feature Categorizes issue or PR as related to a new feature needs-triage needs-priority needs-actor release-note labels Jul 16, 2026
@gjkim42
gjkim42 marked this pull request as ready for review July 17, 2026 12:09
@gjkim42

gjkim42 commented Jul 17, 2026

Copy link
Copy Markdown
Collaborator

/kelos review

@kelos-bot

kelos-bot Bot commented Jul 17, 2026

Copy link
Copy Markdown
Contributor Author

🤖 Kelos Task Status

Task kelos-reviewer-issue-comment-dd709b4f5ce5 has succeeded. ✅

@kelos-bot

kelos-bot Bot commented Jul 17, 2026

Copy link
Copy Markdown
Contributor Author

🤖 Kelos Reviewer Agent @gjkim42

Review Summary

Verdict: REQUEST CHANGES (sticky comment only)
Overall correctness: patch is incorrect
Scope: Adds safe GFM-style pipe-table parsing, rendering, alignment, styling, tests, and Session web-chat documentation.

Findings Overview

Priority Count File:Line Summary
P0 0 none
P1 1 internal/sessionserver/web/app.js:1137 Bound table DOM amplification
P2 2 internal/sessionserver/web/app.js:1136 Preserve one-cell body rows without pipes
P2 2 internal/sessionserver/web/app.js:1080 Consume escaped pipes inside code spans
P3 0 none

Findings

Security / Performance

  • [P1] internal/sessionserver/web/app.js:1137 — Each accepted body row is padded to the full header width with no limit on columns, rows, or total cells, and a line containing only | is accepted as an empty row. A roughly 6 KB message with 500 header columns and 2,000 such rows therefore expands into 1,000,000 <td> elements and can freeze or crash the viewing browser; this is reachable well below the surrounding 1 MiB WebSocket and 8 MiB runtime-event limits. Cap the total rendered cells (or columns and rows) and fall back to plain text when the limit is exceeded.

Correctness

  • [P2] internal/sessionserver/web/app.js:1136splitTableRow returns null for a body line with no pipe, so after a valid two-column header and delimiter, a line such as only-first ends the table and becomes a paragraph. GFM treats that non-block line as a one-cell body row and pads the missing second cell, so this breaks a valid uneven-width table; keep non-block body lines as one-cell rows once the table has started.
  • [P2] internal/sessionserver/web/app.js:1080 — The matched-code-span branch copies its source slice unchanged, so the standard GFM table input `a\|b` reaches the inline-code renderer with the backslash intact and displays a\|b instead of a|b. Unescape table pipe escapes after cell boundaries are determined, and cover the escaped-pipe-inside-code-span form in the behavioral test.

@kelos-bot
kelos-bot Bot force-pushed the agent/session-markdown-tables branch from a946863 to 3634258 Compare July 17, 2026 13:00
@kelos-bot
kelos-bot Bot force-pushed the agent/session-markdown-tables branch from 3634258 to 812aa10 Compare July 17, 2026 13:21
@gjkim42
gjkim42 enabled auto-merge July 17, 2026 13:22
@gjkim42
gjkim42 added this pull request to the merge queue Jul 17, 2026
Merged via the queue into main with commit 8878bc7 Jul 17, 2026
20 checks passed
@gjkim42
gjkim42 deleted the agent/session-markdown-tables branch July 17, 2026 13:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant