Skip to content

fix(threads): never render empty work segments - #672

Merged
nixuuu merged 3 commits into
devfrom
fix/threads-empty-work-segments
Nov 13, 2026
Merged

nixuuu merged 3 commits into
devfrom
fix/threads-empty-work-segments

Conversation

@nixuuu

@nixuuu nixuuu commented Nov 13, 2026 •

Copy link
Copy Markdown
Member

Older turn summaries can arrive while their messages are outside the independent 128-item watch window. Web treated those turns as completed empty folds and only paged near the list's beginning, leaving work and answers blank across reloads.

This change shows compact loading rows for missing or partial work, prefetches one bounded history page from virtual overscan, and preserves message anchors when earlier steers renumber segments. Fold coverage mismatches expose the source rows and emit diagnostics. Initial positioning has a two-second reveal fallback; diagnostics include earlier-page request-to-render timings. New running turns without their first item do not trigger a scan of older history.

History metrics use fixed IDs 450–455, separate from the thread-watch metrics introduced by #673. Gateway responses classify client metrics by their registry group, keeping recovery timings in the Client section and preserving the existing watch-recovery behavior.

Fixes: #541

Verified with git bisect: 0c655ca3ba72f2aea48487d7de62642a15a096f2 introduced the independent windows; its parent e483f4274 passes the same three-turn/600-item reproduction. #639 and #668 steer/group parity tests pass. Shared mobile fold derivation is unchanged.

Validation:

  • Nine focused history/fold regressions pass, including partial cached tails, steers, collapsed groups, nested tools, a running subagent and stable message identities. Real gateway/cache/checkpoint recovery integration passes.
  • Production browser checks cover desktop and 390px phone widths, light/dark and reduced motion. Prefetch starts up to 572px before missing work reaches the viewport; loading rows measure 44px; reading-anchor drift stays under 0.5px.
  • Held responses, actual thread switching, cached reload with a simulated desktop persistence bridge, cleared local storage, failed requests/Retry and blocked row measurement all recover visibly. A fresh running turn sends zero history requests; scrolling to older gaps sends one. Recovery and request-to-render diagnostics were captured.
  • Initial handover gates passed: install, gen:check, typecheck, lint, format:check, check:tmp and the web build. That full local run had 2,793 passed, 166 skipped and zero failures across 523 files; temporary-directory cleanup was clean.
  • Rebased onto current dev (89f37fea6), including fix(connectors): apply connector changes to running agent sessions #670 and fix(threads): recover live updates without retry loops #673. Post-rebase checks pass: 34 focused feed/fold tests, 10 diagnostics integration tests, six provider-account integration tests and the bounded-window/cache integration test (51 total), full typecheck, lint, format check and production web build. The provider refresh invalidation regression and forced-refresh race both pass. Diagnostics tests verify distinct watch/history metrics through authenticated ingestion, client-section rendering data and redacted export. Runs were detached with nice, with heavy test files run one at a time; each focused check:tmp run cleaned its temporary directory.

Native Mac/Electron and native phone rendering were unavailable. The desktop renderer and cache contract were checked in Chromium; shared mobile/web steer and group logic tests pass.

Copy audit (docs/copy.md §8): “Loading earlier work…” is a concise progress status; existing error and Retry copy is reused. Light/dark desktop and phone widths checked; no new motion or copy in tool/steer rows.

@nixuuu
nixuuu marked this pull request as ready for review November 13, 2026 22:09
Represent incomplete bounded item windows with loading rows and prefetch them from the virtual overscan window. Preserve message anchors while older steer segments arrive, fail open on fold coverage mismatches, and report recovery and page render timings.

Fixes: #541
Only treat absent items as older history when the turn precedes the loaded item frontier. Fresh running turns and newer empty completed turns must not pull the entire transcript into the client.
@nixuuu
nixuuu force-pushed the fix/threads-empty-work-segments branch from 3a8546c to c1df7e1 Compare November 13, 2026 22:29
@nixuuu
nixuuu merged commit 8e78568 into dev Nov 13, 2026
10 checks passed
@nixuuu
nixuuu deleted the fix/threads-empty-work-segments branch November 13, 2026 22:39
nixuuu added a commit that referenced this pull request Nov 13, 2026
## Final integration rebase including history/fold recovery

Rebased all seven layers of stack #643 onto dev
`8e78568c7e86c188039743dde6cb879c34de4a6e`, including #671 provider
warnings, #673 reconnect/backoff, #670 connector refresh, #674
deterministic steer recovery and #672 empty-work/history recovery. Two
thread-page conflicts were resolved in their introducing stages:
preserve the conversation/file tab wrapper together with history loading
rows/actions, prefetch, fold synchronization/coverage, diagnostics and
scroll anchors. Feed, history and fold implementation files retain the
merged dev behavior. Earlier generated-descriptor conflicts were
resolved through `bun run gen`; proto additions and field numbers are
preserved. The independently confirmed five workspace fixes are
unchanged. No pending Git or gh-stack rebase operation.

Verification scope on the final heads: install, explicit gen, gen:check,
full typecheck, lint, format:check, production web build and focused
workspace/feed tests at every stage. Commands run detached with `setsid
nohup` and `nice`; heavy files run serially through `check:tmp`. Stage 1
integration files: `thread-file-previews.test.ts`,
`thread-scroll.test.ts`. Existing feed logic files: `feed-rows.test.ts`,
`work-history-gaps.test.ts`. No UI/component test suite added.

All seven PRs remain ready as requested. The maintainer merges the
complete stack after CI is green on every head; no merge is performed
here. Device check remains pending as previously authorized. No product
copy change in this integration rebase.

Everything below is historical evidence from before this final
integration rebase, including earlier draft statuses and
export/fingerprint measurements.

## Change

Stage 1 of the approved seven-stage workspace stack. File links in a
thread open one replaceable preview tab beside the pinned Thread tab.
Edit, Keep tab, double-click or Move keeps it. The shared header handles
overflow; native mobile uses a tab switcher sheet.

Adds device-local tab metadata, in-memory drafts, close guards,
line/range navigation and restoration of file scroll and web editor
undo. Existing file RPCs and SHA-256 mutation checks remain in use.
Links outside a thread keep their current viewer.

Related: #613

## Current-head rebase verification

Rebased onto dev `4bb71c80142e0c1d0616502ce428ca2bf19d8cad`. The
workspace wrapper retains dev's thread scroll-memory preparation and
loaded-view gates on web and mobile. The existing interrupt
request/error handling moved into the thread-command module to keep the
page within the code-size limit, with unchanged behavior and UI copy. No
manual feed/work-fold changes.

Current-head install, gen:check, full typecheck, lint, format:check,
production web build and iOS/Android exports passed with `nice`. Both
nightly native fingerprints match dev. Current-head CI is green,
including all four test shards. Initial thread JS is 765,684 gzip bytes
versus dev 756,367: +9.10 KiB, within the 15 KiB budget.

The final stack head was reviewed in a production browser on the
separate review machine in light/dark at 1440/820/390 px, including
short/long names, source ranges, file-tab switching and file-scroll
restoration. The merged thread-scroll domain integration passed
separately on that head. **Device check pending**. Every implementation
PR stays a draft in stack #643. Current full-suite fallback and the
serial corrective integrations are recorded in #648; interrupted local
runs are not passes.

## Earlier implementation verification (historical)

- Passed locally with `nice`: install, gen:check, typecheck, lint,
format:check and web production build.
- Full `check:tmp`: 2748 passed, 166 skipped, 0 failed; temp directory
clean. The newly rebased mobile foreground integration test also passed
separately.
- Local iOS and Android exports passed with one Metro worker.
Fingerprints equal the same `dev` baseline (`bd89660d5`) with
`CANOPY_CHANNEL=nightly`: iOS
`6ddec9ef559ee0095ac33e94ff9418a942053b17`, Android
`5f6eae3ab278f1cd543e9ed763f923a319b65ec9`. No native
dependency/configuration changes.
- **Device check pending**. Device support reports `Could not
communicate with device support. Try refreshing devices.` Refresh did
not restore it. The maintainer explicitly authorized continuing later
stages with typecheck, both exports and unchanged fingerprints;
consolidated iOS/Android device review remains required before the stack
is merged. No native performance results are claimed.
- Production browser measurements on the separate review machine at
`e668c19dc`: thread-route JS +9269 bytes gzip (9.05 KiB, budget 15 KiB);
100 warm switches p50 35.5 ms / p95 41.5 ms with 0 file reads; retained
heap +72480 bytes after 20 open/edit/discard/close cycles following
warm-up (budget 5 MiB). Earlier exploratory warm p95 ranged 41.3–56.5
ms; these are not omitted from the evidence.
- File 100 KiB, 30 cold document opens: first plain paint p50 125.4 ms /
p95 139 ms (250 ms budget); DOM p95 92 ms; second-frame stability p95
299.5 ms. The latter includes subsequent syntax work and is not reported
as first plain paint.
- Three alternating baseline/current two-minute renderer runs completed:
handler p95 0.4/0.5 ms, 0.4/0.6 ms and 0.5/0.5 ms. Long-task totals were
3682/3836, 3609/3760 and 3679/3779 ms; runs lasted 120.2–120.9 s. A
separate 30-minute renderer run completed 209 cycles / 41,800 messages:
handler p95 0.6 ms, 244 long tasks / 54,489 ms total; sampled heap
263,495,772 → 262,438,198 bytes and DOM 19,838 → 19,657 nodes. These are
streaming/scroll fixtures, not the complete file-switch/undo/offline
resource scenario, which remains for final stack verification. Sampled
heap is not retained heap after GC.
- No protocol or database migration; no UI test suite added.

This PR stays a draft. The maintainer merges the whole stack only after
all seven stages are finished and verified.

## Copy audit — docs/copy.md §8

- Repeated modal title → compact file tab with the full path in its
tooltip/switcher. Short, sentence-case actions use verbs: Keep tab, Move
left/right, Close saved tabs and Go to line.
- Unsaved state → Unsaved changes in a reserved slot and accessible tab
name. Save/Discard/Keep editing repeat the confirmation's action;
deletion names the file and computer.
- Limits and storage failures state the problem and a next action. No
new humorous copy or inspiration references.
- Short, typical and long names checked in the real browser in
light/dark at desktop, narrow and phone widths, including 320 px. At 12
tabs the active long name remains reachable with no page overflow;
opening another file gives an actionable limit message. Repeated file
links reuse their tab. Oversized edits restore the accepted content and
cannot save a different draft.
nixuuu added a commit that referenced this pull request Nov 13, 2026
## Final integration rebase including history/fold recovery

Rebased all seven layers of stack #643 onto dev
`8e78568c7e86c188039743dde6cb879c34de4a6e`, including #671 provider
warnings, #673 reconnect/backoff, #670 connector refresh, #674
deterministic steer recovery and #672 empty-work/history recovery. Two
thread-page conflicts were resolved in their introducing stages:
preserve the conversation/file tab wrapper together with history loading
rows/actions, prefetch, fold synchronization/coverage, diagnostics and
scroll anchors. Feed, history and fold implementation files retain the
merged dev behavior. Earlier generated-descriptor conflicts were
resolved through `bun run gen`; proto additions and field numbers are
preserved. The independently confirmed five workspace fixes are
unchanged. No pending Git or gh-stack rebase operation.

Verification scope on the final heads: install, explicit gen, gen:check,
full typecheck, lint, format:check, production web build and focused
workspace/feed tests at every stage. Commands run detached with `setsid
nohup` and `nice`; heavy files run serially through `check:tmp`. Stage 2
integration files: `thread-file-previews.test.ts`,
`computer-relay.test.ts`. Existing feed logic files:
`feed-rows.test.ts`, `work-history-gaps.test.ts`. No UI/component test
suite added.

All seven PRs remain ready as requested. The maintainer merges the
complete stack after CI is green on every head; no merge is performed
here. Device check remains pending as previously authorized. No product
copy change in this integration rebase.

Everything below is historical evidence from before this final
integration rebase, including earlier draft statuses and
export/fingerprint measurements.

## Change

Stage 2 of the approved seven-stage workspace stack, based on #640. The
header's + opens Pull requests, Tasks or Connectors in a full tab. The
right icon rail selects a minimal module, whose header offers a module
chip, +, Open in tab and Collapse panel. Tab and panel metadata stay
local to the device.

Thread details dock by default when the panel has no module. Selecting a
module leaves details closed behind their header button; the floating
card closes on outside click or Escape and returns focus. Narrow layouts
use separate bottom sheets. The panel supports keyboard/pointer resizing
and respects the available main-area width. Existing PR refresh content
retention and shared reads remain in use; task output can occupy a full
tab. Mobile mirrors the module/switcher/sheet model with the native
viewer and editor.

Related: #613

## Current-head rebase verification

Rebased onto corrected stage 1 and dev
`4bb71c80142e0c1d0616502ce428ca2bf19d8cad`, retaining merged thread
scroll memory and default tool-group folding. Current-head install,
gen:check, full typecheck, lint, format:check, production web build and
iOS/Android exports passed with `nice`; both nightly native fingerprints
match dev. Current-head CI is green, including all four test shards.
Initial thread JS is 768,471 gzip bytes versus dev 756,367: cumulative
+11.82 KiB, within the 15 KiB budget.

The final stack head was reviewed again in a production browser on the
separate review machine in light/dark at 1440/820/390 px. The summary
docks without an active module, floats when Files occupies the desktop
panel, and opens as a sheet at narrow/phone widths; Escape closes it.
Files panel/sheet, long names and the phone tab-switcher sheet were
inspected with no horizontal page overflow. No new UI copy in the
rebase; the original copy audit remains applicable. **Device check
pending**. This PR remains a draft in stack #643; full-suite fallback
and serial corrective evidence are recorded in #648.

## Earlier implementation verification (historical)

- Passed with `nice`: install, gen:check, typecheck, lint, format:check
and production web build. Full check:tmp: 2759 passed, 166 skipped, 0
failed; temporary directory clean. No protocol/database changes and no
UI test suite.
- Both final iOS/Android exports passed. Fingerprints unchanged from the
dev baseline: iOS `6ddec9ef559ee0095ac33e94ff9418a942053b17`, Android
`5f6eae3ab278f1cd543e9ed763f923a319b65ec9` (`CANOPY_CHANNEL=nightly`).
No native dependency/configuration changes.
- **Device check pending**: Device support remains unavailable. The
maintainer authorized continuing with typecheck, both exports and
unchanged fingerprints. Consolidated device review is required before
merging the stack; native runtime/performance and PR scroll restoration
are not claimed as verified.
- Real browser: light/dark, 1440/1280/900/390/320 px, short and long
thread/tab names; module toggles, maximize into a tab, close module →
details dock, floating details placement, outside/Escape and focus
restoration, collapse/restore, keyboard resize bounds and narrow sheets.
Linux window-control CSS reserves were checked; Electron runtime was not
launched. Two review setups were already running on the second machine,
so this stage used the authorized local fallback.
- Thread-route initial JS: 766900 bytes gzip versus 754751 baseline;
cumulative +12149 bytes (11.9 KiB), within 15 KiB. Production browser,
1440×900, 100 warm Thread/Tasks switches after 10 warm-ups: p50 32.2 ms
/ p95 32.4 ms, budget 50 ms, zero thread API requests during the sample.
The local integration run was still active; these results do not replace
the final paired streaming/resource scenario. No initial editor/grammar
dependency added.
- Authenticated PR mutations were not exercised: the private fixture has
no linked account. Existing gateway/integration coverage and retained PR
components cover the unchanged contract; a real-account flow remains a
final QA gap.

This PR stays a draft. The maintainer merges all seven stages together
after complete verification.

## Copy audit — docs/copy.md §8

- Mixed thread-panel sections → Pull requests, Tasks and Connectors with
a separate Thread details surface. Existing glossary terms stay intact.
- Ambiguous panel actions → Open sidebar module, Open in tab, Close
module and Collapse panel. Icon labels describe the same action as their
tooltips; the chip retains an accessible full label when truncated.
- Missing task history → a short explanation and instruction to open
Tasks. Module tab limit errors explain the limit and ask to close a tab.
Existing permission/offline notices remain actionable.
- No humorous copy or inspiration references. Short/long labels and
header controls were checked in both themes and at desktop/narrow/phone
widths; native device coverage is pending as stated above.
nixuuu added a commit that referenced this pull request Nov 13, 2026
## Final integration rebase including history/fold recovery

Rebased all seven layers of stack #643 onto dev
`8e78568c7e86c188039743dde6cb879c34de4a6e`, including #671 provider
warnings, #673 reconnect/backoff, #670 connector refresh, #674
deterministic steer recovery and #672 empty-work/history recovery. Two
thread-page conflicts were resolved in their introducing stages:
preserve the conversation/file tab wrapper together with history loading
rows/actions, prefetch, fold synchronization/coverage, diagnostics and
scroll anchors. Feed, history and fold implementation files retain the
merged dev behavior. Earlier generated-descriptor conflicts were
resolved through `bun run gen`; proto additions and field numbers are
preserved. The independently confirmed five workspace fixes are
unchanged. No pending Git or gh-stack rebase operation.

Verification scope on the final heads: install, explicit gen, gen:check,
full typecheck, lint, format:check, production web build and focused
workspace/feed tests at every stage. Commands run detached with `setsid
nohup` and `nice`; heavy files run serially through `check:tmp`. Stage 3
integration files: `thread-directory-race.test.ts`,
`thread-directory.test.ts`. Existing feed logic files:
`feed-rows.test.ts`, `work-history-gaps.test.ts`. No UI/component test
suite added.

All seven PRs remain ready as requested. The maintainer merges the
complete stack after CI is green on every head; no merge is performed
here. Device check remains pending as previously authorized. No product
copy change in this integration rebase.

Everything below is historical evidence from before this final
integration rebase, including earlier draft statuses and
export/fingerprint measurements.

The Files module now browses the current thread's cwd/worktree in the
sidebar or a full tab. Expanding a directory fetches one bounded page;
selecting a file opens the existing replaceable preview tab.

The additive `ListThreadDirectory` RPC routes through the thread's home,
checks ownership and relative paths in the gateway, and enumerates on
the worker without a recursive snapshot. Pages contain at most 200
entries / 64 KiB protobuf including the envelope. Eight one-use
iterators expire after 30 seconds; closing Files releases cursors. Git
status uses a shared bounded governor query. Symlinks expose no targets
and cannot be expanded.

Web and mobile share a bounded tree cache, two concurrent reads and
cancellation. Virtual rows preserve the visible path anchor and keyboard
focus; Git letters and accessible labels supplement colors. No database
migration, native dependency/configuration change, UI test suite,
polling or full-snapshot synchronization.

Stage 3 of 7 in stack #643. Base: stage 2. All implementation PRs remain
drafts until the entire stack is finished and verified; the maintainer
merges it at once.

Related: #613

## Pre-merge security correction

Directory iteration and child metadata now use the same verified native
directory handle. Unix walks components with `openat(O_NOFOLLOW)` and
uses `fdopendir` / `fstatat(AT_SYMLINK_NOFOLLOW)`. Windows pins all
ancestors without delete sharing, refuses reparse points and queries
entries plus metadata from the final handle. Cursors close these handles
on completion, release, expiration and disconnect.

The controlled ancestor ABA regression returns only the original inside
name and size; replacing an ancestor before handle acquisition is
rejected. Both regression tests and the existing 9 directory integration
cases passed on Linux, including 10,000 children, owner isolation,
cursor limits and symlink refusal. The Linux worker binary builds and
starts. Native macOS/Windows execution has not been verified in this
correction.

Rebased onto dev `4bb71c80142e0c1d0616502ce428ca2bf19d8cad` and
propagated through all seven draft layers of stack #643. The rebase
preserves the merged thread scroll memory and default tool-group
folding. Current-head install, gen:check, full typecheck, lint,
format:check, production web build and iOS/Android exports passed with
`nice`; both nightly fingerprints match dev. The 2 directory-race tests
and all 9 directory integration cases passed locally, one file at a time
(10,385 assertions combined, clean private temp directories).
Current-head CI is green, including all four test shards.

Local full-suite attempts were interrupted by SIGTERM and are not
counted as passes. Before the last dev rebase, a subsequent detached
`setsid nohup` run continued beyond the tool timeout but failed existing
computer-move reachability/discovery cases under load; its owned process
group was stopped after the failures, with a clean private temp
directory. The maintainer authorized green CI on every stack layer plus
serial corrective/stack integration files as the fallback. The final
stack PR records the complete evidence. Native macOS/Windows execution
and the mobile device check remain unverified.

Current thread-route JS is 769,308 gzip bytes versus dev 756,367:
cumulative +12.64 KiB, within the 15 KiB budget. The final stack head
was reviewed again in a production browser in light/dark at 1440/820/390
px, including short/long names, Files panel/sheet and summary
dock/float/sheet. Earlier performance observations below remain
historical.

## Earlier implementation verification (historical)

- Passed with `nice`: install, gen:check, typecheck (including mobile),
lint, format:check and web production build. Full `check:tmp`: 2768
passed, 166 skipped, 0 failed; nothing left in the private temp
directory. CI is green.
- Gateway/worker/computer-link integration: 9 passed, 0 failed, 10,377
assertions. Covers worktree/home routing, 10,000 long names, bounded
pagination, cursor replay/filter/thread binding/release, directory
changes, owner isolation, traversal and symlink refusal, Git states,
eight-iterator admission, older workers and restart cursor invalidation.
- iOS/Android exports passed. Fingerprints equal the dev baseline with
`CANOPY_CHANNEL=nightly`: iOS
`6ddec9ef559ee0095ac33e94ff9418a942053b17`, Android
`5f6eae3ab278f1cd543e9ed763f923a319b65ec9`.
- **Device check pending**: Device support remains unavailable. The
maintainer explicitly authorized continuing with typecheck, both exports
and unchanged fingerprints. Consolidated device review remains required
before merging the stack; no native CPU/FPS/thermal results are claimed.
- Real production browser reviewed light/dark, desktop/narrow/phone,
short/long names, pagination, file preview opening, focus preservation
and sheets. Local fallback used while two review setups occupied the
second machine. Final timing measurements pending completion of heavy
checks.
- Thread-route JS: 767,709 bytes gzip, +12,958 bytes / 12.65 KiB versus
the dev baseline; within the cumulative 15 KiB budget. Tree and
directory transport load lazily.

External changes currently use Reload files; bounded change watching and
reconnect recovery belong to stage 5. Expanded/scroll metadata
persistence belongs to the resource/recovery stage. This PR does not
claim those later slices.

## Copy audit — docs/copy.md §8

- No tree surface → Files / Working directory with verb actions Reload
files, Load more and Show ignored files. Labels use sentence case and
the glossary's directory term.
- Silent or ambiguous partial listing → explicit Reload directory,
update/reconnect guidance and actionable resource-limit errors. No
cursor/protocol jargon on the surface.
- Color-only status → Git letter plus
Modified/Added/Deleted/Renamed/Conflict/Untracked/Ignored accessible
labels. Symbolic links and deleted entries are explicit and inactive.
- Short, typical and long file names reviewed in light/dark at desktop,
narrow and phone widths. Names truncate with full paths available; no
horizontal page overflow. No new humorous copy or inspiration
references.
nixuuu added a commit that referenced this pull request Nov 13, 2026
## Final integration rebase including history/fold recovery

Rebased all seven layers of stack #643 onto dev
`8e78568c7e86c188039743dde6cb879c34de4a6e`, including #671 provider
warnings, #673 reconnect/backoff, #670 connector refresh, #674
deterministic steer recovery and #672 empty-work/history recovery. Two
thread-page conflicts were resolved in their introducing stages:
preserve the conversation/file tab wrapper together with history loading
rows/actions, prefetch, fold synchronization/coverage, diagnostics and
scroll anchors. Feed, history and fold implementation files retain the
merged dev behavior. Earlier generated-descriptor conflicts were
resolved through `bun run gen`; proto additions and field numbers are
preserved. The independently confirmed five workspace fixes are
unchanged. No pending Git or gh-stack rebase operation.

Verification scope on the final heads: install, explicit gen, gen:check,
full typecheck, lint, format:check, production web build and focused
workspace/feed tests at every stage. Commands run detached with `setsid
nohup` and `nice`; heavy files run serially through `check:tmp`. Stage 4
integration files: `thread-highlight.test.ts`,
`thread-file-previews.test.ts`, `computer-relay.test.ts`. Existing feed
logic files: `feed-rows.test.ts`, `work-history-gaps.test.ts`. No
UI/component test suite added.

All seven PRs remain ready as requested. The maintainer merges the
complete stack after CI is green on every head; no merge is performed
here. Device check remains pending as previously authorized. No product
copy change in this integration rebase.

Everything below is historical evidence from before this final
integration rebase, including earlier draft statuses and
export/fingerprint measurements.

File tabs now render virtual source rows and highlight the active
viewer/editor in a dedicated CPU executor. Mobile keeps native editing
and colors the saved viewer or an explicit Preview changes draft through
a bounded gateway/worker RPC. Source indexing yields in chunks, long
lines remain fully readable, and large files start as plain text.

The additive `GetThreadFileHighlight` contract carries at most 200 lines
/ 64 KiB of semantic offsets and roles, tied to the file hash and draft
revision. The gateway derives ownership and cwd. Draft source cannot
cross an onward-sharing relay and is never persisted. One worker
executor has four waiting slots, bounded source/checkpoint caches and a
100 ms execution deadline after separately bounded grammar
initialization. Raster headers are checked before client decoding;
images above 16 MP are refused and GIF/animated previews are static.

Stage 4 of 7 in stack #643, based on stage 3. All implementation PRs
stay drafts until the entire stack is finished and verified; the
maintainer merges it at once. No database migration or native
configuration change.

Related: #613

## Pre-merge reading-position correction

The mobile source viewer restores the document's saved offset after full
indexing, content measurement and layout. A newly requested line takes
precedence, and preparatory scroll events cannot overwrite the saved
offset. No UI text or native configuration changes.

Rebased onto corrected stage 3 and dev
`4bb71c80142e0c1d0616502ce428ca2bf19d8cad`, preserving merged thread
scroll memory and default tool-group folding. Current-head install,
gen:check, typecheck, lint, format:check, web build and both mobile
exports passed with `nice`; nightly native fingerprints match dev.
Current-head CI is green, including all four test shards. Highlight
integration passed locally (6 tests); file previews (12) and
three-gateway relay (11) passed serially on the otherwise idle review
machine. A first preview run on the loaded host failed after its 100 ms
heartbeat link timed out; it is not counted as a pass. Every run cleaned
its private temp directory. Stage 3 separately passed its directory
regressions on the rebased head.

Current thread-route JS is 770,456 gzip bytes versus dev 756,367:
cumulative +13.76 KiB, within the 15 KiB budget. The final stack head
was reviewed again in a production browser in light/dark at 1440/820/390
px, with long names, source colors, line/range positioning, Files and
summary sheets. Web file scroll was restored to the recorded 1200 px
after switching away and back; this does not establish the native mobile
result.

**Device check pending**, including switch-away/back scroll restoration;
no real-device result is claimed. The maintainer authorized green CI on
every layer plus serial corrective/stack files if the detached full run
still fails under shared-host load. The final stack PR records that run;
interrupted local full suites are not counted as passes. Prior
performance observations below are historical. This PR remains a draft
in stack #643.

## Earlier implementation verification (historical)

- Passed with `nice`: install, full typecheck, gen:check, lint,
format:check, web production build and a compiled Linux worker binary.
Full `check:tmp`: 2776 passed, 166 skipped, 0 failed, nothing left in
the private temp directory. CI is green.
- New highlight integration: 6 passed, 0 failed. Covers home routing
through a real computer link, owner isolation, traversal/symlink safety,
saved/draft hash and revision separation, bounded responses, long-line
fallback, older workers and restart.
- File preview integration: 12 passed, 0 failed, including safe raster
dimensions, a static PNG preview and refusal above the pixel budget.
Three-gateway relay integration: 11 passed, 0 failed, including rejected
draft forwarding and forged incoming envelopes.
- iOS and Android exports passed. Mobile typecheck passed. Native
fingerprints equal the dev baseline with the nightly identity: iOS
`6ddec9ef559ee0095ac33e94ff9418a942053b17`, Android
`5f6eae3ab278f1cd543e9ed763f923a319b65ec9`.
- **Device check pending**: Device support remains unavailable. The
maintainer explicitly authorized continuing without device verification.
Consolidated iOS/Android device review remains required before merging
the stack; native CPU/FPS, keyboard/IME, background behavior and thermal
results are not claimed.
- Production browser inspected in light/dark at desktop, narrow and
phone widths, with short and long names. Virtual rows, line/range
positioning, theme colors, editor decorations, dirty/discard flow and
horizontal overflow reviewed. Local fallback used while two review
setups occupied the second machine; the prior remote review setups were
then stopped.
- Local synthetic 100 KiB file, 30 openings: p95 visible plain text 52.8
ms (250 ms budget), stable view 65.7 ms. Warm tab switch: p95 36.8 ms
across 100 samples (50 ms budget), zero additional file reads. These are
local synthetic measurements, not controlled remote-latency or native
results.
- Initial thread JS: 768,832 bytes gzip, cumulative +14,081 bytes /
13.75 KiB versus dev; within the 15 KiB budget. Syntax executor and
editor remain lazy. The 20-cycle browser check had no explicit GC, so
its coarse heap reading is not evidence for the retained-heap budget;
final resource profiling belongs to stages 6–7.

Disk invalidation/watch and conflict comparison remain stage 5; final
scope cleanup and migration removal remain stages 6–7. No UI test suite
was added.

## Copy audit — docs/copy.md §8

- Plain mobile file text → saved viewer colors and the explicit Preview
changes / Keep editing actions; native editing remains immediately
available.
- Large or unsupported syntax → a compact reason, readable plain text
and Enable highlighting where applicable. Errors explain that the file
remains readable; older capabilities give an update action in words.
- Unbounded image decoding → a stated preview limit with an action to
open the file on its computer. No parser, cursor or transport jargon in
the surface text.
- Line highlights supplement original line numbers and Go to line. Dirty
state and failures have text; neither depends only on color.
- Short, typical and long names inspected across the responsive widths
and both palettes. Sentence case and verb actions retained; no humorous
copy or inspiration references.
nixuuu added a commit that referenced this pull request Nov 13, 2026
## Final integration rebase including history/fold recovery

Rebased all seven layers of stack #643 onto dev
`8e78568c7e86c188039743dde6cb879c34de4a6e`, including #671 provider
warnings, #673 reconnect/backoff, #670 connector refresh, #674
deterministic steer recovery and #672 empty-work/history recovery. Two
thread-page conflicts were resolved in their introducing stages:
preserve the conversation/file tab wrapper together with history loading
rows/actions, prefetch, fold synchronization/coverage, diagnostics and
scroll anchors. Feed, history and fold implementation files retain the
merged dev behavior. Earlier generated-descriptor conflicts were
resolved through `bun run gen`; proto additions and field numbers are
preserved. The independently confirmed five workspace fixes are
unchanged. No pending Git or gh-stack rebase operation.

Verification scope on the final heads: install, explicit gen, gen:check,
full typecheck, lint, format:check, production web build and focused
workspace/feed tests at every stage. Commands run detached with `setsid
nohup` and `nice`; heavy files run serially through `check:tmp`. Stage 5
integration files: `thread-root-checkpoint.test.ts`,
`thread-watch-cancellation.test.ts`, `thread-watch-relay.test.ts`,
`thread-watch.test.ts`. Existing feed logic files: `feed-rows.test.ts`,
`work-history-gaps.test.ts`. No UI/component test suite added.

All seven PRs remain ready as requested. The maintainer merges the
complete stack after CI is green on every head; no merge is performed
here. Device check remains pending as previously authorized. No product
copy change in this integration rebase.

Everything below is historical evidence from before this final
integration rebase, including earlier draft statuses and
export/fingerprint measurements.

Files now watch only the visible directories and active document.
External changes refresh clean content and preserve dirty drafts, with
Compare changes, Copy changes and a confirmed Discard and reload. The
comparison switches between virtual read-only disk/draft versions; it
never force-overwrites a file.

The additive `WatchThreadFiles` stream carries bounded invalidations,
never source or a tree snapshot. Gateway ownership, path checks and home
routing apply before subscription. Shared checkout watches have bounded
replay, reconnect requests visible-scope revalidation, and
cancellation/background releases the stream and retries. Save conflicts
use a typed Connect code and HTTP 412 in the BFF. No database migration
or native configuration change.

Stage 5 of 7 in stack #643, based on stage 4. Every implementation PR
remains a draft until the whole stack is finished and verified; the
maintainer merges the stack at once.

Related: #613

## Pre-merge root, watch and relay corrections

- Every file response carries its root identity. The document retains
that checkpoint with its base and draft across watch stops. A changed
root remains a conflict until explicit discard and reload, even with
identical base bytes. Additive `expected_root_identity` fields reach the
home worker for writes and deletes; a stale root yields `Aborted`.
Unsupported workers cannot silently ignore a supplied checkpoint.
- Released queued additions check cancellation inside the serialized
operation and after reconciliation. Pending additions keep coordinator
ownership until cleanup. The controlled slow-reconciliation regression
with 35 released queued subscriptions leaves zero subscribers, zero
directory watches and zero callbacks after release; a fresh subscription
still works.
- Supported onward routes advertise `thread_files_watch_v1`. A new
three-gateway integration covers negotiation, delivery of a file change
and cancellation at the home worker.

Rebased onto corrected stages 3–4 and dev
`4bb71c80142e0c1d0616502ce428ca2bf19d8cad`, preserving merged thread
scroll memory and default tool-group folding. Current-head install,
gen:check, full typecheck, lint, format:check, production web build and
iOS/Android exports passed with `nice`. Both nightly native fingerprints
match dev. Current-head CI is green, including all four test shards.

Serial integration files all passed with clean private temp directories:
root checkpoint (2 tests / 30 assertions, both with and without a
reopened watch) and queued cancellation (1 / 10) locally; three-gateway
onward watch (1 / 5) and existing watches (6 / 43) on the otherwise idle
review machine. The old draft cannot write or delete identical-byte
replacement files; explicit discard/reload permits the new checkout.
Thirty-five released queued subscriptions leave no subscribers, watches
or callbacks.

Interrupted local full-suite attempts are not counted as passes. Before
the last dev rebase, a detached full run continued beyond the tool
timeout but failed existing computer-move reachability/discovery cases
under load and was stopped with a clean private temp directory. The
maintainer authorized green CI on every layer plus serial
corrective/stack files as the fallback; #648 records the final evidence.
**Device check pending** remains in effect. The final stack head
received a fresh production-browser review in both themes at
1440/820/390 px; prior performance observations below remain historical.
This PR stays a draft in stack #643.

Current initial thread JS is 770,777 gzip bytes versus dev 756,367:
cumulative +14.07 KiB, within the 15 KiB budget.

Copy audit for this correction: “reopen the file” → “reload the file”
names the explicit recovery action for a root conflict; an unsupported
checkpoint asks the user to update the computer and reload before
changing the file. Existing conflict copy is reused for rejected
mutations. No new labels, layout, glossary terms or humorous copy.

## Earlier implementation verification (historical)

- Passed with `nice`: install, generation check, full typecheck, lint,
formatting check, production web build and full `check:tmp` (nothing
left in the private temp directory). CI is green.
- New gateway/worker integration: 6 passed, 0 failed. Real local and
linked-home streams cover owner isolation, traversal/symlink refusal,
scope and envelope limits, replay, last-subscriber cancellation, burst
recovery and dirty/hash conflicts without mutation replay.
- Mobile typecheck and iOS/Android exports passed. Native fingerprints
match the baseline with the nightly identity: iOS
`6ddec9ef559ee0095ac33e94ff9418a942053b17`, Android
`5f6eae3ab278f1cd543e9ed763f923a319b65ec9`.
- **Device check pending**: Device support is unavailable. The
maintainer authorized continuing with typecheck, exports and unchanged
fingerprints. Consolidated iOS/Android device review remains required
before the stack is merged; device CPU/FPS/IME and background results
are not claimed.
- Initial thread JS is 768,856 bytes gzip, cumulative +14,105 bytes /
13.77 KiB versus the dev baseline (15 KiB budget). File UI and watch
adapters load on demand. On the isolated review machine, 30 opens of 100
KiB: plain text p50 48.7 ms / p95 52.1 ms; stable view p95 65.7 ms. 100
warm switches: p50 32.2 ms / p95 33.2 ms. Restarting a watch epoch
revalidates the active file; these measurements do not claim zero
network requests during switches. GC was unavailable, so the
retained-heap budget is unverified.
- Manual browser review covered light/dark, desktop/narrow/phone widths
and long paths. A real worker filesystem watcher refreshed clean
content, preserved a dirty draft, exposed both comparison versions, and
reloaded the disk version only after discard confirmation. The save
button is disabled for a known conflict.
- No UI tests added. No full-tree or transcript snapshot recovery,
polling of file contents, write replay or automatic overwrite.

## Copy audit — docs/copy.md §8

- Previously stale content → Changed on disk / Removed from disk, with
explicit Compare changes, Copy changes and Discard and reload actions.
The draft is preserved until confirmation.
- Generic save rejection → a typed conflict with an explanation and an
action; no hash, cursor, parser or transport jargon in UI errors.
- Unavailable live changes → a plain explanation and Reload fallback.
Short labels reserve status space and do not depend on color.
- Comparison labels name the selected version; all destructive
confirmations retain explicit verbs. No humorous copy or inspiration
references. Light/dark and desktop/narrow/phone layouts preserve
truncation and explicit actions.
nixuuu added a commit that referenced this pull request Nov 13, 2026
## Final integration rebase including history/fold recovery

Rebased all seven layers of stack #643 onto dev
`8e78568c7e86c188039743dde6cb879c34de4a6e`, including #671 provider
warnings, #673 reconnect/backoff, #670 connector refresh, #674
deterministic steer recovery and #672 empty-work/history recovery. Two
thread-page conflicts were resolved in their introducing stages:
preserve the conversation/file tab wrapper together with history loading
rows/actions, prefetch, fold synchronization/coverage, diagnostics and
scroll anchors. Feed, history and fold implementation files retain the
merged dev behavior. Earlier generated-descriptor conflicts were
resolved through `bun run gen`; proto additions and field numbers are
preserved. The independently confirmed five workspace fixes are
unchanged. No pending Git or gh-stack rebase operation.

Verification scope on the final heads: install, explicit gen, gen:check,
full typecheck, lint, format:check, production web build and focused
workspace/feed tests at every stage. Commands run detached with `setsid
nohup` and `nice`; heavy files run serially through `check:tmp`. Stage 6
integration files: `thread-root-checkpoint.test.ts`,
`thread-watch-cancellation.test.ts`, `thread-watch-relay.test.ts`,
`thread-watch.test.ts`. Existing feed logic files: `feed-rows.test.ts`,
`work-history-gaps.test.ts`. No UI/component test suite added.

All seven PRs remain ready as requested. The maintainer merges the
complete stack after CI is green on every head; no merge is performed
here. Device check remains pending as previously authorized. No product
copy change in this integration rebase.

Everything below is historical evidence from before this final
integration rebase, including earlier draft statuses and
export/fingerprint measurements.

Workspace now releases read work, live streams and cached bytes when a
paired scope or thread access ends. A replaced worktree root preserves
the old draft and requires explicit discard/reload. Clean content is
bounded to four warm files on web and two on mobile, in addition to byte
budgets; inactive files receive invalidation markers without background
reads.

This also forwards file-read cancellation through the BFF, fences late
responses after cleanup, clears mobile token caches and excludes IME
composition from workspace shortcuts. No database migration or native
configuration change.

Stage 6 of 7 in stack #643, based on stage 5. All implementation PRs
remain drafts. The maintainer merges the whole stack at once.

Related: #613

## Pre-merge root-checkpoint correction

Rebased onto corrected stages 3–5 and dev
`4bb71c80142e0c1d0616502ce428ca2bf19d8cad`, preserving merged thread
scroll memory and default tool-group folding. Root identities are
checked for every retained document in a thread, including hidden tabs.
Resource/access guards retain the new expected-root argument through
writes and deletes; explicit discard and reload remain necessary after a
root replacement.

Current-head install, gen:check, full typecheck, lint, format:check,
production web build and iOS/Android exports passed with `nice`. Both
nightly native fingerprints match dev. Current-head CI is green,
including all four test shards. Serial integration files on the
otherwise idle review machine passed with clean private temp
directories: root checkpoint (2 tests / 30 assertions), queued
cancellation (1 / 10), onward relay (1 / 5), and expanded
watch/resource/access coverage (9 / 58). Stages 3 and 5 also passed the
three blocker regressions locally on their introducing heads.

Current initial thread JS is 771,163 gzip bytes versus dev 756,367:
cumulative +14.45 KiB, within the 15 KiB budget. No UI text or web
layout changed in this correction. The final stack head received a fresh
production-browser review in both themes at 1440/820/390 px, including
long names, Files panel/sheet and summary dock/float/sheet. Earlier
performance observations below remain historical; **Device check
pending** remains in effect.

Interrupted local full suites are not counted as passes. Before the last
dev rebase, a detached full run continued beyond the tool timeout but
failed existing computer-move reachability/discovery cases under load
and was stopped with a clean private temp directory. The maintainer
authorized green CI on every layer plus serial corrective/stack files as
the fallback; #648 records the final evidence. This PR remains a draft
in stack #643.

## Earlier implementation verification (historical)

- Gateway/worker integration: 9 passed, 0 failed. Real local and
linked-home streams cover owner/path safety, bounded replay,
paired-scope cleanup, thread access revocation, root replacement and
preservation of drafts.
- Passed with `nice`: install, generation check, full typecheck, lint,
formatting, production web build and iOS/Android exports. Full
`check:tmp`: 2,785 passed, 166 skipped, 0 failed; nothing left in the
temp directory.
- CI is green. The first run had one existing remote thread-sequence
recovery assertion returning the previous title after home reconnection.
The unchanged test passed in isolation (1 passed, 0 failed, clean temp
directory), then the failed CI shard passed on rerun.
- Nightly native fingerprints match baseline: iOS
`6ddec9ef559ee0095ac33e94ff9418a942053b17`, Android
`5f6eae3ab278f1cd543e9ed763f923a319b65ec9`.
- Browser review: light/dark, 1440/820/390 px widths, short and long
file names, virtual source and line ranges, docked summary, Files panel,
floating summary and phone sheet. No added UI suite.
- On the isolated review machine: 100 warm switches p50 31.8 ms / p95
32.9 ms and **0 additional Files requests** (including subscriptions).
After warmup and 20 edit/discard/close cycles with GC exposed, retained
JS heap grew 517,260 bytes / 0.49 MiB (5 MiB budget).
- Initial thread JS: 769,295 bytes gzip, cumulative +14,544 bytes /
14.20 KiB against dev (15 KiB budget). This measures the static import
closure; editor/grammar loading remains deferred.
- These stage-6 measurements do not verify RSS/bitmap memory or native
runtime budgets. Final cumulative streaming/navigation pairs, controlled
transport probes and the 30-minute file/Undo/offline endurance run are
reported in stage 7 (#648), including the browser HTTP/1.1 emulation
outlier and remaining measurement gaps; those results do not relabel the
stage-6 head as separately measured.
- **Device check pending**: Device support is unavailable. The
maintainer authorized typecheck, iOS/Android exports and unchanged
native fingerprints while continuing the stack. Consolidated device
review is still required before merge.
- No UI tests, database migrations or native dependency changes.

## Copy audit — docs/copy.md §8

- Stale/inaccessible content → “File access ended. Reopen the thread to
check access.” The action matches the cleared scope.
- A changed root → an explanation followed by Copy changes / Reload; an
old draft never silently becomes a new-root edit.
- Existing short labels and conflict confirmations are preserved. IME
input is excluded from shortcuts. Responsive/theme review preserves
explicit actions and truncation at desktop, narrow and phone widths.
nixuuu added a commit that referenced this pull request Nov 13, 2026
## Final integration rebase including history/fold recovery

Rebased all seven layers of stack #643 onto dev
`8e78568c7e86c188039743dde6cb879c34de4a6e`, including #671 provider
warnings, #673 reconnect/backoff, #670 connector refresh, #674
deterministic steer recovery and #672 empty-work/history recovery. Two
thread-page conflicts were resolved in their introducing stages:
preserve the conversation/file tab wrapper together with history loading
rows/actions, prefetch, fold synchronization/coverage, diagnostics and
scroll anchors. Feed, history and fold implementation files retain the
merged dev behavior. Earlier generated-descriptor conflicts were
resolved through `bun run gen`; proto additions and field numbers are
preserved. The independently confirmed five workspace fixes are
unchanged. No pending Git or gh-stack rebase operation.

Verification scope on the final heads: install, explicit gen, gen:check,
full typecheck, lint, format:check, production web build and focused
workspace/feed tests at every stage. Commands run detached with `setsid
nohup` and `nice`; heavy files run serially through `check:tmp`. Stage 7
integration files: `thread-directory-race.test.ts`,
`thread-directory.test.ts`, `thread-file-previews.test.ts`,
`thread-highlight.test.ts`, `computer-relay.test.ts`,
`thread-root-checkpoint.test.ts`, `thread-watch-cancellation.test.ts`,
`thread-watch-relay.test.ts`, `thread-watch.test.ts`,
`thread-scroll.test.ts`, `thread-watch-failures.test.ts`,
`thread-live-updates.test.ts`, `connector-sessions.test.ts`,
`connector-session-errors.test.ts`, `codex-provider-warnings.test.ts`,
`prompt-after-turn-end.test.ts`, `thread-work-window.test.ts`. Existing
feed logic files: `feed-rows.test.ts`, `work-history-gaps.test.ts`,
`feed-prefix.test.ts`, `work-fold-state.test.ts`,
`work-tool-groups.test.ts`, `steer-folds.test.ts`,
`notice-folds.test.ts`. No UI/component test suite added.

All seven PRs remain ready as requested. The maintainer merges the
complete stack after CI is green on every head; no merge is performed
here. Device check remains pending as previously authorized. No product
copy change in this integration rebase.

Everything below is historical evidence from before this final
integration rebase, including earlier draft statuses and
export/fingerprint measurements.

Thread file links now use the workspace in every transcript. A link
outside the current workspace opens the correct thread and selects its
file tab. The old web modal, mobile file screen and their separate
mutation state are removed; attachment, blob and bot viewers keep their
existing flows.

The web editor now has one highlighting path, using off-main-thread
tokens. Architecture and client documentation describe the completed
workspace, module surfaces and scoped file lifecycle. No database
migration, protocol change or native configuration change.

Stage 7 of 7 in stack #643, based on stage 6. All seven implementation
PRs stay drafts. The maintainer merges the whole stack at once after
verification, including the deferred device check.

Related: #613

## Pre-merge corrective rebase

Rebased all seven draft layers onto dev
`4bb71c80142e0c1d0616502ce428ca2bf19d8cad`, preserving the merged thread
scroll memory and default tool-group folding. The stack includes
directory-handle confinement in stage 3, mobile source scroll
restoration in stage 4, document root checkpoints/mutation fences plus
queued-watch cancellation and onward capability in stage 5, and retained
hidden-document root checks in stage 6. No manual feed/work-fold edits.

Current-head install, gen:check, full typecheck, lint, format:check,
production web build and iOS/Android exports passed with `nice` at every
stage after the final rebase. Both nightly native fingerprints match dev
at all seven layers. Current-head CI is green on all seven PRs,
including all four test shards for each layer.

On the final head, all 9 changed integration files passed serially
**locally after the static checks and exports finished**: **53 tests,
10,694 assertions, 0 failures**. The merged thread-scroll integration
also passed (3 tests / 23 assertions), making **56 tests / 10,717
assertions across 10 files**, with every private temp directory clean.
The same ten files also passed serially on the otherwise idle review
machine. Introducing-stage regressions passed separately in stages 3–6:
directory ABA/refusal and bounded listing locally in stage 3;
highlighting locally and previews/relay on the review machine in stage
4; retained root/cancellation locally and onward watch/existing watches
on the review machine in stage 5;
root/cancellation/onward/resource/access files on the review machine in
stage 6. Every test invocation used `nice` and ran one file at a time.

The controlled ancestor swap returns only the original inside filename
and size; a substituted ancestor before handle acquisition is refused.
Identical-byte checkout replacement rejects the retained draft and
direct stale write/delete, with and without reopening the watch;
explicit discard/reload permits the new checkout. Thirty-five released
queued additions leave no subscriptions, native watches or callbacks; a
fresh subscription works. A real three-gateway route negotiates the
watch feature, delivers a change and releases the home worker watch.

There is **no claimed full local-suite pass** for this corrective
rebase. Earlier local full attempts were interrupted by SIGTERM. Before
the last dev rebase, a detached `setsid nohup` / `nice` attempt ran
beyond the tool timeout but failed existing computer-move
reachability/discovery cases under load; its owned process group was
then stopped with SIGINT (exit 130, private temp directory clean). One
earlier computer-move owner-discovery failure passed in isolation (1
test / 30 assertions). A first stage-4 preview run on the loaded host
also failed after its 100 ms computer-link heartbeat expired; the same
head passed all 12 previews on the idle review machine. These failures
and interrupted runs are not counted as passes. The maintainer
authorized green CI on all seven PRs plus serial corrective/stack files
as the fallback.

Current initial thread JS is 766,417 gzip bytes versus dev 756,367:
cumulative **+10,050 bytes / 9.81 KiB**, within the 15 KiB budget. The
new stage-6 maximum is +14.45 KiB, also within budget; editor and
grammar imports remain deferred. Other detailed timing/endurance
measurements below are historical and are not relabelled as measurements
on this head.

Fresh production-browser review of this final head on the separate
review machine covered light/dark at 1440/820/390 px, short/long names,
docked summary with no module, Files with summary closed, floating
summary and Escape, narrow/phone summary and Files sheets, and the phone
tab-switcher sheet. Switching away/back restored the saved web-file
offset (1200 px); `sample.ts:31-40` scrolled to and highlighted the
range. No horizontal document overflow was found at narrow/phone widths.
The owned browser tab, servers, container, tunnel, runtime directory and
review checkout were removed afterward.

Native macOS/Windows directory-handle execution remains unverified.
**Device check pending**, including native mobile scroll restoration on
switching away/back; typecheck, exports and web review do not establish
that runtime result. All seven PRs stay drafts for the maintainer's
independent re-check of stack #643; none was marked ready or merged.

## Earlier implementation verification (historical)

- Passed with `nice`: install, generation check, full typecheck (Svelte:
0 errors/warnings), lint, formatting check and production web build.
Full `check:tmp`: 2,785 passed, 166 skipped, 0 failed; nothing left in
the private temp directory.
- iOS/Android exports passed. Nightly native fingerprints match the
baseline: iOS `6ddec9ef559ee0095ac33e94ff9418a942053b17`, Android
`5f6eae3ab278f1cd543e9ed763f923a319b65ec9`.
- Initial thread JS: 764,558 bytes gzip versus dev 754,751: +9,807 bytes
/ 9.58 KiB (15 KiB budget). Removing the old modal reduces stage 6 by
4,737 bytes gzip. Editor and grammar code remain deferred.
- Production browser reviewed in light/dark at 1440/820/390 px, with
short and long names, Files in a panel/sheet, line/range source, summary
placement, editing, Undo and keyboard save. File views are tabs; no
legacy thread-file modal host remains.
- On the isolated review machine, 30 opens of 100 KiB: plain text p50
48.6 ms / p95 65.2 ms; stable view p95 81.9 ms. 100 warm switches: p50
31.9 ms / p95 32.4 ms, **0 additional Files requests**. After warmup and
20 edit/discard/close cycles with explicit GC, retained JS heap grew
421,077 bytes / 0.40 MiB (5 MiB budget).
- Three alternating 2-minute renderer pairs, 1000 turns / 2800 messages
per run: baseline/current handler p95 0.4/0.4, 0.4/0.4 and 0.5/0.5 ms.
Pairs 2/3 renderer task busy: 12.99/12.57% and 12.62/12.76%; layout
5.27/5.05 and 5.15/5.13 ms/s. Long-task totals for those pairs:
3752/3704 and 3723/3724 ms. The first baseline trace is partial and is
not used for a full-duration CPU comparison.
- Production endurance: 30 minutes / 648 open-edit-Undo-close cycles,
including 22 offline/reconnect draft checks, completed without an error.
Task busy 9.08%, layout 4.93 ms/s, 43 long tasks / 2939 ms total. rAF
gap p95 16.8 ms; 100 gaps above 34 ms across 107,732 callbacks (0.093%).
This is a scheduler proxy, **not compositor lost frames**. Final heap
after GC: 69,592,520 bytes / 66.37 MiB; the separate warmed 20-cycle
retained-heap result above is the budget check. Both runs used a visible
1440×900 Chromium page with reduced motion disabled.
- File 100 KiB under browser transport emulation (100 ms, 10 Mbit/s), 30
opens over a private HTTP/2 proxy: plain p50 248.6 ms / p95 265.5 ms,
stable p95 282.3 ms. A separate HTTP/1.1 proxy applies 100 ms response
delay and a shared 1.25 MB/s response budget outside the browser: 30
opens, plain p50 265.0 ms / p95 265.6 ms, stable p95 282.3 ms, maximum
565.6 ms. Both controlled proxy runs meet the 800 ms goal; neither
proves physical linked-home WAN latency.
- Diagnostic limitation retained: browser-wide HTTP/1.1 emulation over
the same BFF had plain p95 4181.1 ms, with about 3.9 s spent before
request dispatch in slow samples. That result differs from the
independently paced HTTP/1.1 run above and is not silently discarded or
presented as a confirmed application fix. No speculative SSE code change
was made: a focused real-gateway/worker cancellation probe passed.
- Directory reload, 30 samples: local p95 33.7 ms, browser-shaped
HTTP/1.1 p95 133.7 ms. A 10,000-child directory kept 45 tree items in
DOM. These are reload/virtualization measurements, not cold
module-import times. Editor input on 100 KiB, 30 inputs with Undo: p50
27.6 ms / p95 35.0 ms to the second frame (including automation round
trips).
- Three alternating production SPA navigation pairs, 30 measured
openings per member after warmup: baseline/current p95 108.5/107.8,
109.7/109.7 and 113.6/106.9 ms; p50 67.2/71.1, 86.7/78.3 and 79.0/72.5
ms. These measure thread articles/composer readiness to the next frame,
not browser TTI or cold startup. An earlier 20-sample probe had p95
96.6/106.8 ms and exceeded the tolerance; the larger alternating runs
are reported alongside it rather than suppressing that sample.
- Measurements used headless Chromium with software rendering. Actual
compositor lost frames, isolated application RSS, bitmap memory and
native process/JS profiling remain unmeasured. Browser/proxy transport
shaping is a controlled surrogate, not a measurement of a physical
linked computer's WAN route. Native results are not claimed.
- **Device check pending**: Device support is unavailable. The
maintainer authorized typecheck, exports and unchanged fingerprints
while continuing. Consolidated device review remains required before
merge; mobile runtime performance is unverified.
- No UI tests added. Existing gateway/worker integration covers scope,
paths, bounded listing, watch lifecycle and conflicts.

## Copy audit — docs/copy.md §8

- No new UI labels or errors. Existing workspace actions replace the old
modal actions.
- File names remain selectable and paths keep their explicit line/range
meaning. Attachment copy is unchanged.
- No new glossary terms, humorous copy or inspiration references. Short
and long paths retain truncation and explicit actions in both themes at
desktop, narrow and phone widths; native device review is pending.
nixuuu added a commit that referenced this pull request Nov 13, 2026
Dodaje „Edit from here”: cofnięcie rozmowy przed własną wiadomością w
tym samym wątku Canopy. Oryginalne tury pozostają jako superseded;
trwałe zdarzenie i upserty synchronizują urządzenia oraz lustra
przyrostowo po seq. Undo przywraca poprzednią sesję przed kolejną turą.
Cofnięte wiadomości nie wracają do modelu, również przy generowaniu
tytułu.

Projekt i źródła przypiętych harnessów: `docs/threads.md`, sekcja „Edit
from here”. Claude SDK 0.3.316 tworzy prefiks sesji i opcjonalnie
przywraca checkpointy plików. Codex 0.164.0 tworzy prefiks przez
`thread/fork`; przypięty `thread/revert` nie zapewnia odwracalności.
Grok CLI 1.0.70 nie ma zweryfikowanego kontraktu ACP rewind i zwraca
jawną odmowę. Rozmowa nie cofa plików bez wyboru użytkownika.
Odtwarzanie załączników zachowuje metadane wideo.

Gateway egzekwuje właściciela, blokadę przyjęcia pracy i granice
celów/harmonogramów, również przy Undo. Wątki botów, automatyczne i
odziedziczone punkty są wyłączone; aktywne dzieci trzeba zatrzymać. Stop
and edit zatrzymuje turę i zadania w tle oraz anuluje kolejkę, steery i
interakcje. Zamiar rewindu pozostaje dostarczalny do ACK również po TTL
outboxu. Starszy worker dostaje polecenie aktualizacji przez addytywną
capability, bez zmiany WORKER_LINK_PROTOCOL.

Poprawka P1 znajduje się w tej warstwie: rewind unieważnia generację
startów i czeka także na StartTurn przygotowywany przed turn_started.
Claude sprawdza anulowanie przed utworzeniem procesu i przekazaniem
wejścia; Codex sprawdza aktualność sesji po asynchronicznym wyborze
ustawień. Testy zatrzymują admission przy uzyskiwaniu runtime,
przygotowaniu Claude i ustawieniach Codex. Oryginalna sesja nie
otrzymuje anulowanej ani edytowanej wiadomości.

Cały stos przebazowany przez gh stack na dev `dcd13faaa`, obejmujący
workspace #640–#648 i filtrowanie pustych segmentów z #672. Zachowane
provider warnings i interrupt z #671, odświeżanie konektorów z #670,
odzyskiwanie live updates z #673 i poprawka testu steera #674. Konflikty
wygenerowanych kontraktów rozwiązane przez bun run gen z połączonych
addytywnych proto; RPC workspace i rewind pozostają dostępne. Parametry
sesji Codex zachowują MCP przy start/resume/fork, a kontrola generacji
Claude działa po odświeżeniu konektorów. Fixture Codex obsługuje katalog
MCP; testy admission używają agent bus. Migracja pozostaje 0136 po
najwyższej 0135 na dev. Brak pozostałego stanu rebase.

Walidacja na dev dcd13fa: bun install, gen:check, pełny typecheck,
lint i format:check przeszły z nice. Sprawdzenia odłączone od sesji
terminala; ciężkie testy kolejno po jednym pliku. Wynik: 38 pass, 0 fail
w 5 plikach — work-history-gaps, thread-rewind, thread-rewind-mirrors,
thread-file-previews i thread-root-checkpoint; katalogi tymczasowe
czyste. Pierwszy typecheck wymagał bun install dla nowego pakietu
workspace @canopy/syntax; ponowiony pełny przebieg przeszedł.
Wcześniejsze live: Codex 9 asercji, Claude 13 asercji, w tym
przywrócenie pliku i brak cofniętych wiadomości w kontekście. Bieżący
rebase nie powtarza pełnego check:tmp ani testów live.

Copy audit §8: brak akcji → „Edit from here” (cel edycji); brak
checkpointu → „Files stay as they are.” (jawny skutek); stary worker →
„Update this thread's worker to use Edit from here.” (przyczyna i
następny krok). Angielski sentence case, bez nowych synonimów i bez
polegania wyłącznie na ikonie.

Warstwa 1/3 stosu #662: #655 → #656 → #661. Ready; maintainer scala cały
stos atomowo.
nixuuu added a commit that referenced this pull request Nov 13, 2026
Dodaje „Edit from here” w akcjach własnej wysłanej wiadomości:
kompaktowe potwierdzenie, zatrzymanie aktywnej pracy i wybór cofnięcia
rozmowy lub rozmowy z checkpointowanymi plikami. Tekst, cytaty, wzmianki
i załączniki wracają do composera. Poprzedni szkic pozostaje w pamięci
karty i można go odzyskać przez Swap drafts.

Cofnięte tury i ich późne zdarzenia są schowane pod „N messages rewound
· Show”. Undo działa przed kolejną turą; Edit message odzyskuje trwały
szkic po ponownym otwarciu. Niepewna odpowiedź sieciowa zachowuje klucz
idempotencji i pozwala sprawdzić wynik. Gateway egzekwuje uprawnienia i
granice automatyzacji.

Poprawka P2 znajduje się w tej warstwie: Swap drafts jest nieaktywne
podczas wysyłania, uploadu, błędu załącznika i rewindu. Handler sprawdza
tę samą blokadę, zgodnie z mobile. Odpowiedź wysłania B nie może
wyczyścić podmienionego szkicu A. Wcześniejszy przegląd w prawdziwej
przeglądarce z wstrzymaną odpowiedzią potwierdził blokadę i odzyskanie A
z załącznikiem.

Rebase całego stosu przez gh stack na dev `dcd13faaa` zachowuje karty
workspace, pliki, moduły i panele z #640–#648. Rozmowa i composer
pozostają zamontowane w swoim panelu przy przełączaniu kart; blokada
rewindu działa w nowym położeniu composera. Zachowane filtrowanie
pustych segmentów, kontrolki brakującej historii, prefetch i kotwiczenie
feedu z #672 oraz Edit from here. Obie ścieżki feedu dostają granice
brakującej pracy i diagnostykę. Wiersze work-gap cofniętej tury chowają
się razem z nią; Show pozwala pobrać brakujące itemy. Regresja sprawdza
ukrycie, Show, prefetch i te same segmenty po stronicowaniu. Zachowane
#670, #671, #673 i #674. Migracja nadal 0136 po najwyższej 0135 na dev.
Brak pozostałego stanu rebase.

Walidacja na dev dcd13fa: bun install, gen:check, pełny typecheck
(Svelte: 0 błędów i ostrzeżeń), lint i format:check przeszły z nice.
Wynik testów: 38 pass, 0 fail w 5 plikach — work-history-gaps,
thread-rewind, thread-rewind-mirrors, thread-file-previews i
thread-root-checkpoint. Sprawdzenia odłączone od sesji terminala, testy
kolejno przez check:tmp; katalogi tymczasowe czyste. Typecheck przeszedł
po instalacji nowego pakietu workspace @canopy/syntax. Regresja #672
rozszerza istniejący test projekcji danych, bez testów komponentów i
przeglądarki. Wcześniej przeszedł web build; obecny rebase nie deklaruje
nowego pełnego przebiegu ani buildu.

Wcześniejszy przegląd przeglądarkowy: jasny i ciemny motyw, desktop
1280×800 i telefon 390×844; potwierdzenie, oba warianty plików, długie
ścieżki, odtwarzanie i zachowanie szkiców, Show/Hide, Undo i wysłanie
edytowanej wiadomości w tym samym wątku. Bez poziomego przewijania.
Przegląd z testowym workerem; prawdziwe harnessy i checkpointy
sprawdzono w backendzie. Środowisko przeglądu usunięte.

Copy audit §8: „Edit from here” (cel), „Stop and edit” (zatrzymanie),
„Conversation only” / „Conversation and files” (zakres), „Your previous
draft is saved.” + „Swap drafts” (odzyskanie). Potwierdzenie ma formę
pytania; tooltip i przycisk zachowują nazwę akcji. „will stop” → „stop”,
„will be cancelled” → „Canopy cancels”: czas teraźniejszy i aktywny
głos. Angielski sentence case, krótkie zdania, błędy z następnym
krokiem, techniczne szczegóły za Show details. Układ sprawdzony z
długimi nazwami plików.

Warstwa 2/3 stosu #662: #655 → #656 → #661. Ready; maintainer scala cały
stos atomowo.
nixuuu added a commit that referenced this pull request Nov 14, 2026
)

## Root cause

Since #623 the web cache held only a 128-item **tail** of each thread,
and the background warmer saved that tail over full in-memory snapshots
(web and mobile). Switching away dropped `ThreadState`, folds and the
virtual feed's measured heights; returning rebuilt everything from the
tail and then **replaced** it when the watch increment arrived. Older
turns first rendered as `input` + work loading rows, a turn cut by the
tail showed a gap that collapsed, row keys changed and "Worked for" rows
faded in, so the visible content moved (48 px, CLS 0.26–0.28 on every
reopen of a thread whose last turn exceeds a page — the "Landing page"
shape: one turn with 21 commands, 24 tool calls and 18 subagents).

Two rendering faults made it flash:
- `padBottom` mixed `layout.total` (committed a frame later) with the
live `index.offset`, leaving up to a few hundred px blank below the last
row for one frame (the 133 px / 413 px one-frame hop seen in the video
and the probe).
- A new feed got its footer height only from the first ResizeObserver
callback, so its first frame had no end reserve and a 32 px composer
backdrop (CLS 0.0207 on every switch).

## Fix (target architecture: keep what was loaded, sync only what is
missing)

- `threadViews` (web): recently opened threads keep their client state
in memory — `ThreadState` with loaded older pages, `WorkFolds`,
`FeedBuilder` and the `SizeIndex` of measured row heights. LRU 12
threads / 12 MiB encoded; the visible thread is never evicted. Leaving a
thread caches its checkpoint in idle time.
- A return renders that state synchronously; the watch resumes from the
stored cursor (incremental batches only) and patches rows in place.
"Show earlier messages" is never needed for pages already loaded.
- Background warming (existing overview heads, no new streams) applies
newer checkpoints to retained threads off screen. The shared
`ThreadWarmer` no longer cuts snapshots to a tail; the cache owns its
bounds. Web memory keeps whole snapshots (32 entries / 16 MiB encoded,
objects shared with retained views); Electron disk keeps the tail.
- `VirtualFeed` takes a caller-owned `SizeIndex`, measures its viewport
and footer on mount (rows are positioned before the first paint) and
reads both padding ends from the live index.
- Cold opens stay hidden while the mounted window still shows work
loading rows (bounded by the existing 2 s positioning limit), so gaps
never collapse under the reader.
- A thread reopened at a saved reading position starts with the compact
composer in its first frame; a first message saved below the top padding
is restored at its distance (offset may be negative, up to half a
viewport).
- Short threads that do not fill the viewport stay **top-aligned**
(unchanged, consistent: rows start under the header, composer at the
bottom; following starts once content overflows).

### Review follow-up (head b03e40f)

- **A far-moved thread keeps its pages.** When a retained thread
advances more than 256 records off screen, the background read gets a
fresh 24-turn window. The warmer now reports that it *replaced* its
base; such a window never replaces a retained view. The view stays
behind with its loaded pages and cursor, warming continues from the
cache copy (no repeated window reads), and opening resumes the view's
own cursor: the visible watch replays only the missing records.
- **Background refreshes respect the budget.** Each applied refresh
re-accounts the encoded size and trims the LRU in idle time; shown
threads are never evicted.
- Retention moved into `RetainedThreads` (`@canopy/domain`) so it is
tested with the real gateway; web `threadViews` wraps it.

## Measurements

Private bench stack (`scripts/bench/client-stack.ts`, now also seeding a
1-turn thread and a thread whose last turn exceeds the first page),
production builds of `dev` and this branch against the same gateway,
Chromium 1400×900, after-paint sampling (rAF → task; `layout-shift` does
not count scrollTop hops, plain rAF reads precede ResizeObserver
corrections). Host load 5–10.

| | dev | this PR |
|---|---|---|
| Reopen, long last turn: visible moves | 1–3 per open (44–48 px, plus
−21/+21 px flash) | 0 |
| Reopen, long last turn: CLS | 0.278–0.297 | 0.0000–0.0001 |
| Every switch: CLS (composer backdrop) | 0.0207 | 0.0001 |
| scrollTop writes after reveal (long last turn) | 4–5 | 0–1 |
| Return to a scrolled-up thread, row offset vs leave | 0 px; 1444 px
(anchor lost) on the long-last-turn thread | 0 px everywhere |
| Cold open, long last turn | 48 px move, CLS 0.278 | 0 moves, CLS
0.0001 (revealed after the missing page) |
| Switch → first visible frame, p50 / p90 (12 returns × 2 rounds) | 185
/ 219 ms, 216 / 342 ms | 155 / 190 ms, 197 / 276 ms |
| Switch → settled, p50 | 193 ms, 235 ms | equals first frame (155 ms,
197 ms) |
| Rapid switching (30 switches, 80 ms apart) | — | no errors, one feed,
final thread at its end |

Memory: about 1.9 MB encoded per 1000 loaded items; heap is roughly 4×
that (8 history pages of the 1000-turn fixture ≈ 8.7 MB heap). Bounded
by 12 MiB encoded for retained views (≈50 MB heap worst case, shared
with the 16 MiB snapshot cache). In the same scenario (8 pages loaded,
two switches away) total heap after GC was 71 MB vs 82 MB on `dev`.

## Mobile

Mobile already renders its in-memory full snapshot synchronously
(`peek`) and resumes from the cursor; it shared the root cause through
the warmer, which replaced that snapshot with a tail — fixed in
`@canopy/domain`. Gaps (device checks blocked; typecheck passes): a
background window after >256 records still replaces the mobile cache
entry (web keeps pages and resumes); manual fold choices reset when a
thread is reopened (`useMemo` keyed on the thread), and cell heights are
not retained across screens.

## Tests

- `thread-warming.test.ts`: warming a loaded thread keeps its older
pages (fails with the previous tail save).
- `thread-warming.test.ts` (real gateway): a retained thread with a
loaded older page advances 300 records off screen; the warm gets a fresh
window, the retained pages and cursor stay, and reopening resumes with
batches only (no snapshot), keeping the pages and reaching the head
(fails if a window replaces the view).
- `thread-scroll.test.ts`: anchor offsets below the top edge.

## Checks

`bun install`, `gen:check`, `typecheck`, `lint`, `format:check`, web
build — clean locally. `check:tmp`: see below.

Copy audit (docs/copy.md §8): no UI text changed.

Fixes: #623
Related: #672
nixuuu added a commit that referenced this pull request Nov 14, 2026
When a connector notice arrives before the provider echoes a message,
the web/desktop feed replaces the turn-input placeholder at the echo's
later sequence position. Its entire work fold can then appear above the
user's message, including messages with attachments.

Place the echoed input immediately after its turn's start, before its
work. Keep the echo's item identity and the sequence positions of
steers, background work and notices. The same derivation repairs
existing saved histories after reload. Inputs containing only
attachments or quotes also retain their placeholder while their echo is
unavailable.

Gateway inspection confirmed that admission already persists the input
and binds attachments atomically before dispatch; the draft path uses
that same admission. Event `seq` correctly records arrival order and
remains unchanged. Mobile already renders the persisted turn input
before its body and excludes the initial echo from that body.

The bug reproduces on current dev, including #673, #687, #689, #690 and
the merged drafts stack. #670 introduced the connector acknowledgement
before Codex `turn/start`, exposing the timeline's assumption that the
input echo was the first element. #672 retained that assumption.

Fixes: #670

Validation:

- Added PostgreSQL/gRPC gateway regression: upload a PNG and Markdown
file, send the message, publish an early connector notice and
commentary, then publish the input echo. The test failed on the original
dev feed (input row 3, work row 1).
- Covers echoes with and without client IDs, placeholder replacement,
open/closed work folds, steer chronology, completion, a fresh sequenced
history subscription, and the mobile turn/body derivation. Both new
cases and 27 existing feed checks pass under `check:tmp`; nothing
remains in the test temp directory.
- `nice` install, `gen:check`, typecheck, lint, `format:check` and web
build pass with temp files under `/var/tmp`. Full suite left to CI
because the shared 12-CPU host reached load 12.41 during verification.
- No browser/device visual run; the change affects timeline derivation,
with no component, styling or UI-copy changes. Copy audit: no changed UI
text.
nixuuu added a commit that referenced this pull request Nov 18, 2026
…gs (#986)

## Nightly.75 console report

- Reproduced the `actorAvatars` exception and `derived_inert` warnings
by invalidating avatar reads just before a PR snapshot reset. Scheduled
refreshes now use a mounted subscriber, and a later explicit read uses
its own fetch function.
- Preserve the saved timeline anchor through a slow initial snapshot.
Start the positioning deadline once data arrives and compare watch
liveness against loaded history. Routine history paging still
contributes to the diagnostics counter. Actionable recovery warnings
keep their reason.
- Open a cold thread through the owner-scoped GetThread RPC while the
overview stream is rebuilding. Skip Git scans for unavailable
placements. Report busy, missing, oversized and timed-out checkouts in
the panel, retain the last successful counts on a transient scan
failure, and cancel an abandoned shared HTTP request when its last
reader leaves.
- Skip idle web, desktop and BFF diagnostics submissions. Reserve
admission and checkpoint space for active sessions within the existing 6
MiB budget. A frozen minute carries its checkpoints even if RPC load
exhausted the space for its metric series.

The screenshots omit response bodies and the expanded recovery objects.
The tests cover concrete paths to the reported statuses. Genuine
connectivity and rate limits still surface.

## Local verification

- Focused shared-query, overview invalidation, BFF state and reads, Git
status, thread history/watch, client diagnostics and persistence tests.
Gateway, domain and web typechecks passed. Lint and formatting checked
on edited files. Full gate runs in CI.
- Chromium at 1280 and 390 px, light and dark. PR reset and avatar
reload produced no exception or Svelte warning after the fix. In a
1000-turn thread, a 2.25 s initial snapshot delay restored an 8 px
scroll offset. A real checkout reported its changed file, and a removed
worktree issued no Git request. Desktop rapid navigation cancelled the
in-flight request. At phone width in both themes, closing thread details
and navigating to the removed worktree started one Git read, cancelled
it once and issued no further Git request.

## Copy audit

Reviewed all ten items in docs/copy.md §8. Generic Git refresh failures
now identify the missing directory, busy checkout, size limit or timeout
and give a recovery action. Directory terminology matches the glossary.
Short, typical and long names were checked at desktop and phone widths.
All items pass or are inapplicable.

Fixes: #456
Fixes: #569
Fixes: #672
Fixes: #799
Fixes: #847
Fixes: #900
nixuuu added a commit that referenced this pull request Nov 20, 2026
## Change

- Web and desktop show the loaded timeline immediately. Scrolling up to
a gap reads one older page. “Show earlier work” loads the selected turn,
including turns that span several pages. On mobile, a gesture toward the
history edge loads at most one page.
- Web, desktop and mobile keep the live stream open when an older page
covers the changes already received. If the stream advanced past the
page, the client replays from the page checkpoint to recover concurrent
edits and deletions.
- Desktop persists a bounded history tail. Web and desktop limit
inactive expanded content to 32 items and 8 MiB and cancel obsolete
reads on reset. An oversized result stays available while in use.
Clients reuse the measured size of an unchanged snapshot when leaving a
conversation.
- Header-only updates preserve the timeline rows. Unchanged controls and
heartbeats still run validation and connection diagnostics while
avoiding redundant view updates.

## Verification

- Chromium on Linux, 2,160 items and 19 subagents. Opening the thread
issued 0 older-page requests, down from 16 (453,590 response bytes).
Checked scroll restoration, a multi-page turn, a quote, retry after a
failed read and a timeline that fits on screen. Tested wide and narrow
viewports in both themes.
- Android emulator. A layout change after scrolling issued 0 history
reads, down from 16. A gesture fetched one page on the existing stream.
Twelve pairs of unchanged controls and heartbeats produced 0 React
commits, down from 21. Sending a message and resuming from the
background advanced and restored the live checkpoint.
- With 4,608 synthetic items, 32 exits from an unchanged cached thread
required 0 full encodings, down from 32. In a 10,000-item renderer
probe, median header-update processing fell from 3.10 ms to 0.007 ms.
Forty-eight expanded outputs of 512 KiB retained 7.5 MiB of inactive
content, down from 24 MiB.
- Targeted domain, history cache, gRPC replay, continuity, work-window
and mobile synchronization checks passed, along with web, mobile and
domain typechecks and repository lint on the edited files. The
concurrent-deletion test compares a paged-and-resumed client with a
continuously connected client.
- Copy audit (§8) passed. The former idle “Loading earlier work…” label
now reads “Show earlier work” and acts as a button. “Loading earlier
work…” appears during a read and “Retry” after failure. The native
equivalent uses the existing “Show earlier messages” button.
- The Windows Electron and day-long Windows session remain unmeasured.
Native testing used Android. Additional Expo ESLint reported
pre-existing hook findings.

Fixes: #300
Fixes: #302
Fixes: #541
Fixes: #556
Fixes: #672
Fixes: #687
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