Skip to content

fix(gateway): let Desktop omit duplicate transcripts on session resume (salvage #69926) - #77340

Merged
kshitijk4poor merged 3 commits into
NousResearch:mainfrom
kshitijk4poor:salvage-69926-omit-messages
Aug 3, 2026
Merged

fix(gateway): let Desktop omit duplicate transcripts on session resume (salvage #69926)#77340
kshitijk4poor merged 3 commits into
NousResearch:mainfrom
kshitijk4poor:salvage-69926-omit-messages

Conversation

@kshitijk4poor

Copy link
Copy Markdown
Collaborator

Salvages the core of #69926 by @danielblankhh (Daniel Blank) — omit_messages logic ported to current main's layout with authorship preserved, plus one test-adaptation commit.

Context — what this fixes, for whom

Desktop users resuming large sessions: session.resume/session.activate serialized the FULL transcript — potentially megabytes of compression lineage — over the WebSocket, stalling resume for seconds. With omit_messages: true (Desktop passes it everywhere now), the RPC returns messages: [], messages_omitted: true, and an accurate message_count; Desktop hydrates the transcript through the authenticated REST route in parallel. Backward compatible — the flag defaults to false, so TUI/messaging clients are untouched.

Salvage notes (what changed vs the original PR)

  1. Port, not cherry-pick: main split session.resume/session.activate out of tui_gateway/server.py into methods_session.py since the PR's base, so the omit_messages logic was ported hunk-by-hunk into the new layout (_live_session_payload's omit param stays in server.py where that helper still lives). All of the PR's Python + Desktop TS tests came along.
  2. Dropped as unrelated bundling (per the repo rubric, invited back separately): the /api/cron/jobs/{job_id}/outputs endpoint and the codex quiet-timeout bump (90s→300s). @danielblankhh — both looked well-built (the path-traversal guards on the cron endpoint were thorough); please resubmit them as their own PRs.
  3. Test adaptation (ours): two queue-drain tests added on main pin session.resume's exact call shape; assertions gain the omit_messages: true key.

Verification

  • Python: tests/test_tui_gateway_server.py full file — 515 passed (incl. the PR's parametrized omit tests)
  • Mutation check: revert methods_session.py + server.py to main → all 3 omit tests fail; restore → pass
  • Desktop TS: use-prompt-actions/index.test.tsx + use-session-actions.test.tsx — 141 passed; tsc --noEmit clean
  • ruff + py_compile clean

Closes #69926 (core superseded by this salvage — original author credited via port authorship).

blonderhh and others added 2 commits August 3, 2026 10:05
Salvage of NousResearch#69926: omit_messages support ported from the PR's
tui_gateway/server.py base onto the post-split methods_session.py
layout. When a Desktop client passes omit_messages=true on
session.resume / session.activate, the RPC returns messages: [] with
messages_omitted: true and an accurate message_count, skipping the
potentially multi-megabyte compression-lineage serialization over the
WebSocket; Desktop hydrates the transcript via the authenticated REST
route in parallel.

The PR's bundled cron-outputs endpoint and codex quiet-timeout bump
were dropped from this salvage as unrelated (invited back separately).
Two queue-drain tests added on main pin session.resume's exact params;
the drain path now passes omit_messages: true. Assertion-only update.
@kshitijk4poor
kshitijk4poor enabled auto-merge (rebase) August 3, 2026 04:35
@kshitijk4poor
kshitijk4poor disabled auto-merge August 3, 2026 07:59
Two more call-shape-pinning tests (cold tile resume, default-profile
resume) assert session.resume's exact params; the delegate passes
omit_messages: true like every other Desktop resume call site.
Swept all 5 desktop test files that reference session.resume/activate:
380 of 381 files green (the one failure is a pre-existing locale-
dependent number-grouping test that fails identically on clean main).
@kshitijk4poor
kshitijk4poor enabled auto-merge (rebase) August 3, 2026 08:07
@alt-glitch alt-glitch added type/perf Performance improvement or optimization P2 Medium — degraded but workaround exists comp/desktop Electron desktop app (apps/desktop/*) comp/tui Terminal UI (ui-tui/ + tui_gateway/) sweeper:risk-session-state Sweeper risk: may lose/corrupt/mis-associate session or context state labels Aug 3, 2026
@kshitijk4poor
kshitijk4poor merged commit dd08277 into NousResearch:main Aug 3, 2026
48 checks passed
@kshitijk4poor
kshitijk4poor deleted the salvage-69926-omit-messages branch August 5, 2026 07:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/desktop Electron desktop app (apps/desktop/*) comp/tui Terminal UI (ui-tui/ + tui_gateway/) P2 Medium — degraded but workaround exists sweeper:risk-session-state Sweeper risk: may lose/corrupt/mis-associate session or context state type/perf Performance improvement or optimization

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants