GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — chat: per-session message history is never trimmed — every message re-joins the full history into the 5-line viewport, so a long-lived session grows unbounded and rendering is quadratic · Issue #3268 · developing-today/code

chat: per-session message history is never trimmed — every message re-joins the full history into the 5-line viewport, so a long-lived session grows unbounded and rendering is quadratic #3268

New issue
Copy link
New issue
Copy link
Closed
#3284
Closed
chat: per-session message history is never trimmed — every message re-joins the full history into the 5-line viewport, so a long-lived session grows unbounded and rendering is quadratic#3268
#3284
Copy link
Assignees
dezren39
Labels
app/chatPackage/app: chat (pkgs/ or apps/ in this repo)effort/sSmall: expected under 2 hours of workkind/performancePerformance problem or optimizationpriority/lowNice to have; do when convenientsource/creatorFiled by the new-issue-creator jobtask/triageQueue packet kind: verify, reproduce, and route this item

Description

@dezren39
dezren39
opened on Nov 1, 2026
Issue body actions

Problem

In pkgs/chat (main.go, main 4b0f9ceb), every client's model keeps its entire chat history forever and rebuilds the whole viewport content on every message:

case chatMsg:
    m.messages = append(m.messages, m.senderStyle.Render(msg.id)+": "+msg.text)
    m.viewport.SetContent(strings.Join(m.messages, "\n"))
    m.viewport.GotoBottom()

(main.go:177-180; the field is declared at :113 and initialised at :144.)

Those are the only three references to messages in the file: nothing ever caps, trims, or windows the slice. The viewport is 5 lines tall (viewport.New(30, 5), :141-143), so nearly everything retained is invisible — yet a long-lived session's model grows without bound, and each new message costs a strings.Join over the full history: total rendering work is quadratic in the number of messages the session has seen, and the joined string is re-allocated whole every time.

This is the per-session sibling of #3201 (the server-side progs registry in the same file, which is never pruned either): #3201 covers the server retaining dead programs; this issue covers a single live session's own history and render cost, which grows even while the session is healthy and connected.

Evidence (verified this run)

  • Code: grep -n messages pkgs/chat/main.go returns exactly three sites — field :113, init :144, append+Join :178-179. No cap, trim, or ring buffer anywhere in the package (the package is the single main.go, 197 lines).
  • Laptop probe (~/git/fleet/probe-2026-10-31-laneB-chathistory/, plain Go replicating the append + full strings.Join performed per chatMsg; pkgs/chat/main.go sha256 70e8215c5d13db1fb… identical on the sandbox clone at 4b0f9ceb and the laptop clone ~/git/code):
n= 1000  total append+Join time=8ms     retained messages=1000
n= 5000  total append+Join time=135ms   retained messages=5000
n=10000  total append+Join time=480ms   retained messages=10000
n=20000  total append+Join time=1.898s  retained messages=20000

Doubling the history roughly quadruples the total work — the per-message Join dominates, exactly as the code shape predicts.

Dedup: open + closed search for chat message history / viewport returns only #3201 (server progs registry: fan-out to dead programs + data race). No existing issue covers the per-model messages slice.

Why it matters

The chat server is a long-running SSH service: a busy room or a client left connected for days steadily eats more memory per session and gets visibly laggier with every message, because each keystroke-era message re-renders history the 5-line viewport will never show. It degrades exactly in the long-lived-session case the service exists for, and there is no operator-visible bound to tune.

Acceptance criteria

  • A session's retained history is bounded by a named cap (sized relative to what the viewport can show / scroll back, and documented in the code), or the viewport content is built incrementally without re-joining the full history per message.
  • After the cap is reached, older messages are dropped from the model (the visible behaviour — latest messages shown, GotoBottom — is unchanged).
  • Per-message render work no longer grows with total history length once the cap is reached.
  • A test or benchmark pins the behaviour: feeding more messages than the cap leaves the retained count at the cap and the newest message visible.

Activity

Next
  1. dezren39
    added
    kind/performancePerformance problem or optimization
    priority/lowNice to have; do when convenient
    queue/queuedHas a queued queue task
    source/creatorFiled by the new-issue-creator job
    task/triageQueue packet kind: verify, reproduce, and route this item
    status/needs-triageNot yet triaged; needs a first look
    app/chatPackage/app: chat (pkgs/ or apps/ in this repo)
    effort/sSmall: expected under 2 hours of work
    on Nov 1, 2026
  2. dezren39 commented on Nov 1, 2026

    @dezren39
    dezren39
    on Nov 1, 2026
    MemberAuthor
    More actions

    🤖 Agent note · filed

    • Agent: new-issue-creator-code-b
    • Session / ID: new-issue-creator-code-b cron run 2026-10-31 19:20 CDT
    • Found via: filed this run — read pkgs/chat/main.go on main 4b0f9ce while sweeping packages Lane B had not covered this cycle; grep shows messages has exactly three references (field :113, init :144, append+Join :178-179) and no cap anywhere, then measured the cost with a laptop Go probe.
    • Task: Filed this issue: a chat session's model retains every message forever and re-joins the full history into its 5-line viewport per message — unbounded per-session growth, quadratic total render work. Laptop probe (~/git/fleet/probe-2026-10-31-laneB-chathistory/, main.go sha256 70e8215c5d13db1fb… matched on both clones): append+Join totals 8ms @1k, 480ms @10k, 1.898s @20k messages.
    • Expectation: effort s; done when retained history is bounded by a named cap (or rendering is incremental), visible behaviour is unchanged, and a test/benchmark pins the cap — see the issue's acceptance criteria.
    • Links: server-side sibling chat: session program registry never pruned — unbounded growth, per-message fan-out to dead programs, and a data race on the shared slice #3201
  3. github-actions
    assigned
    dezren39
    on Nov 1, 2026
  4. dezren39 commented on Nov 1, 2026

    @dezren39
    dezren39
    on Nov 1, 2026
    MemberAuthor
    More actions

    🤖 Agent note · picked up

    • Agent: queue worker (repo-worker-code), lane D shift
    • Session / ID: task 4771
    • Found via: queue claim
    • Task: task 4771 — triage chat: per-session message history is never trimmed — every message re-joins the full history into the 5-line viewport, so a long-lived session grows unbounded and rendering is quadratic #3268: confirm the unbounded per-session messages slice + full-history strings.Join in pkgs/chat/main.go against current main, then route the fix
    • Expectation: effort/s triage; done = findings comment with fresh-main evidence + a queued fix packet (or a not-reproduced verdict with evidence)
    • Links: issue chat: per-session message history is never trimmed — every message re-joins the full history into the 5-line viewport, so a long-lived session grows unbounded and rendering is quadratic #3268; sibling issue chat: session program registry never pruned — unbounded growth, per-message fan-out to dead programs, and a data race on the shared slice #3201 (server-side, out of scope)
  5. dezren39
    added
    work/assignedQueue worker lifecycle state
    queue/claimedQueue worker lifecycle state
    status/in-progressQueue worker lifecycle state
    and removed
    status/needs-triageNot yet triaged; needs a first look
    on Nov 1, 2026
  6. 170 remaining items

    Load more actions
  7. dezren39 commented on Nov 8, 2026

    @dezren39
    dezren39
    on Nov 8, 2026
    MemberAuthor
    More actions

    🤖 Agent note · handed off

    • Agent: queue worker (repo-worker-code), lane code-p
    • Session / ID: task 5697
    • Found via: queue claim
    • Task: task 5697 (small_fix for issue chat: per-session message history is never trimmed — every message re-joins the full history into the 5-line viewport, so a long-lived session grows unbounded and rendering is quadratic #3268 — cap retained per-session chat history in pkgs/chat) is assigned to the opencode execution lane per §1b — handing off to the opencode-claimant; not working it directly in this lane. Fresh revalidation: issue chat: per-session message history is never trimmed — every message re-joins the full history into the 5-line viewport, so a long-lived session grows unbounded and rendering is quadratic #3268 OPEN, no hard-stop labels (no held / user/owned / do-not-merge / do-not-auto-edit).
    • Expectation: claimant launches the bound opencode session and drives task 5697 to a terminal state; task 5697 parked 1200s pending claimant launch, then returns to the queue if unlaunched.
    • Links: task 5697 · issue chat: per-session message history is never trimmed — every message re-joins the full history into the 5-line viewport, so a long-lived session grows unbounded and rendering is quadratic #3268
  8. dezren39
    added
    work/assignedQueue worker lifecycle state
    status/in-progressQueue worker lifecycle state
    and removed
    status/needs-triageNot yet triaged; needs a first look
    queue/queuedHas a queued queue task
    on Nov 8, 2026
  9. dezren39 commented on Nov 8, 2026

    @dezren39
    dezren39
    on Nov 8, 2026
    MemberAuthor
    More actions

    🤖 Agent note · handed off

    • Agent: queue worker (repo-worker-code), lane code-e
    • Session / ID: task 5697
    • Found via: queue claim
    • Task: small_fix for issue chat: per-session message history is never trimmed — every message re-joins the full history into the 5-line viewport, so a long-lived session grows unbounded and rendering is quadratic #3268 handed off to the opencode execution lane (task 5697, assigned_lane=opencode) AND still hard-stopped: PR ⚡ Bolt: bound chat history to cap quadratic viewport rendering #3284 re-verified OPEN DRAFT just now, authored by dezren39 (Drew-owned — do not touch, no competing implementation). Parking task 5697 for 20 minutes; resume condition unchanged: complete as already_done when PR ⚡ Bolt: bound chat history to cap quadratic viewport rendering #3284 merges; implement only if it closes unmerged.
    • Expectation: claimant launches the bound opencode session for task 5697; no implementation work while PR ⚡ Bolt: bound chat history to cap quadratic viewport rendering #3284 is open.
    • Links: issue chat: per-session message history is never trimmed — every message re-joins the full history into the 5-line viewport, so a long-lived session grows unbounded and rendering is quadratic #3268, PR ⚡ Bolt: bound chat history to cap quadratic viewport rendering #3284
  10. dezren39
    added
    queue/parkedQueue task is parked (waiting on CI, time, or an event)
    status/parkedDeliberately paused with a recorded resume condition
    and removed
    status/in-progressQueue worker lifecycle state
    on Nov 8, 2026
  11. developing-today commented on Nov 8, 2026

    @developing-today
    developing-todayBot
    on Nov 8, 2026 – with developing.today
    Contributor
    More actions

    🤖 Agent note · parked

    • Agent: queue worker (repo-worker-code, lane code-l)
    • Session / ID: task 5697
    • Found via: queue claim
    • Task: Parked on revalidation: PR ⚡ Bolt: bound chat history to cap quadratic viewport rendering #3284 (the same fix for issue chat: per-session message history is never trimmed — every message re-joins the full history into the 5-line viewport, so a long-lived session grows unbounded and rendering is quadratic #3268) is still OPEN, draft, authored by and assigned to dezren39 — a Drew-owned hard stop; no competing work. Fresh check this shift confirmed PR ⚡ Bolt: bound chat history to cap quadratic viewport rendering #3284 OPEN/draft and issue chat: per-session message history is never trimmed — every message re-joins the full history into the 5-line viewport, so a long-lived session grows unbounded and rendering is quadratic #3268 OPEN, both assigned to dezren39.
    • Expectation: resume when PR ⚡ Bolt: bound chat history to cap quadratic viewport rendering #3284 is merged (then verify and complete task 5697) or closed unmerged (then the fix is free to implement).
    • Links: PR ⚡ Bolt: bound chat history to cap quadratic viewport rendering #3284; issue chat: per-session message history is never trimmed — every message re-joins the full history into the 5-line viewport, so a long-lived session grows unbounded and rendering is quadratic #3268
  12. dezren39
    closed this as completedin #3284on Nov 9, 2026
  13. dezren39 commented on Nov 9, 2026

    @dezren39
    dezren39
    on Nov 9, 2026
    MemberAuthor
    More actions

    🤖 Agent note · done (already done)

    • Agent: repo queue worker, lane code-t (repo-worker-code)
    • Session / ID: cron repo-queue-worker-shift-t run 2026-11-09; task 5697
    • Found via: claimed task 5697 this shift; fresh revalidation per §2
    • Task: task 5697 for issue chat: per-session message history is never trimmed — every message re-joins the full history into the 5-line viewport, so a long-lived session grows unbounded and rendering is quadratic #3268 (small_fix — cap retained per-session chat history in pkgs/chat). Fresh evidence: PR ⚡ Bolt: bound chat history to cap quadratic viewport rendering #3284 is MERGED (merge commit a7404a8) and issue chat: per-session message history is never trimmed — every message re-joins the full history into the 5-line viewport, so a long-lived session grows unbounded and rendering is quadratic #3268 is CLOSED. The task's resume condition ("PR ⚡ Bolt: bound chat history to cap quadratic viewport rendering #3284 merged") is met and the underlying work is landed, so task 5697 completes as already_done; no new work is needed and no competing PR will be created.
    • Expectation: none — terminal.
    • Links: task 5697 · issue chat: per-session message history is never trimmed — every message re-joins the full history into the 5-line viewport, so a long-lived session grows unbounded and rendering is quadratic #3268 · PR ⚡ Bolt: bound chat history to cap quadratic viewport rendering #3284
  14. dezren39
    removed
    status/parkedDeliberately paused with a recorded resume condition
    queue/parkedQueue task is parked (waiting on CI, time, or an event)
    work/assignedQueue worker lifecycle state
    on Nov 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

  • @dezren39
    dezren39

Labels

app/chatPackage/app: chat (pkgs/ or apps/ in this repo)effort/sSmall: expected under 2 hours of workkind/performancePerformance problem or optimizationpriority/lowNice to have; do when convenientsource/creatorFiled by the new-issue-creator jobtask/triageQueue packet kind: verify, reproduce, and route this item

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

    You are visitor 01402775 — GeezerVison does not store the pages you look up.
    Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.