mirror of
https://github.com/esengine/DeepSeek-Reasonix.git
synced 2026-11-12 15:55:49 -10:00
8f7e4a0748094de92aa17e534bf54839b2cecaab
6
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
6448d8c985 |
fix(transcript): reconcile queued guidance by message ID / 修复队列引导重复记录 (#10723)
* fix(transcript): reconcile queued guidance by message identity Problem: A queued guidance insertion could appear twice when its live event and durable history row reached the Desktop in different orders. Unapplied guidance warnings had the same duplicate-row failure. Root cause: Live receipts and canonical records used unrelated display identities, while some legacy history rows omitted the owning message ID. Fix: Assign one message ID to each guidance insertion, retain legacy record addresses, normalize older history identities, and merge event and canonical rows by identity. Preserve inbox consumption receipts independently of display and cover applied and unapplied guidance in local, remote, and browser paths. Verification: Focused Go and frontend regressions, root Go suite, frontend transcript suite, Chromium DOM transcript workload, typecheck, and repolint passed. * test(frontend): typecheck steer transcript regressions Problem: The new transcript regressions executed successfully but their fixture types failed the repository test-typecheck gate. Root cause: Inferred literal state types were narrower than reducer results, while broad item and history interfaces hid the notice-specific fields required by assertions. Fix: Type the reducer state at its public boundary and narrow notice items explicitly without changing the behavioral assertions. Verification: pnpm test:typecheck, canonical user display test, and steer transcript test passed. |
||
|
|
355fa9fc12 |
Fix tool result identity, state handoff and historical projection (#10590)
Sparse completion events and later history hydration could erase durable tool identity, append duplicate result rows after the final answer, and downgrade completed state. Preserve canonical metadata, repair uniquely matchable legacy checkpoint identities, and reconcile bounded resident records through one conflict-aware projection with stable tool keys and anchored local notices. Keep distinct conflicting formal results independently readable and prevent old session requests from updating a new binding. Preserve pagination, content-on-demand and existing resident-memory limits without changing provider payloads, prompts, session exports or the persistent message format. Harden CI at the observed failure boundaries: carry frontend producer attempts into artifact consumers, attribute actual bounded Markdown Worker listeners, synchronize reconnect assertions with retained lifecycle publications, and use a fresh bounded functional wait for packaged upgrade history. Retain native geometry, visible history, restart integrity and independent startup gates. Verification includes transcript/store/follower/reducer regressions, 240- and 1,000-turn browser scenarios, native Electron layout, backend and race suites, packaged Windows first-import/restart acceptance, and all three full memory-screening shards. Real remote-host validation remains unavailable; binding tests do not replace it. No release is published by this change. |
||
|
|
b1a4e016b3 |
Complete fixed-snapshot session exports / 完善固定快照会话导出 (#10471)
* Complete fixed-snapshot session exports Problem: Session exports could silently contain only the resident history window, omit tool payloads, and show unloaded tool results as stopped after workspace switches. Root cause: Export commands read renderer-owned items instead of an authoritative fixed session boundary, while tool execution state and content availability were inferred from the same paginated projection. Fix: Add fixed export snapshots, watermark-bounded persistence, complete forward history traversal, host-owned local and remote export operations, streamed visual output, reliable publication, cross-page tool observations, and expanded lifecycle diagnostics. Verification: Run root and Desktop test suites, focused race tests, repository and Go linters, frontend type checks and transcript suites, browser visual export probes, and native macOS save/cancel smoke tests. * test(desktop): align remote export contract Problem: The desktop frontend CI still asserted that remote exports serialize the visible resident transcript. Root cause: The source-contract test predated fixed host-owned export snapshots and contradicted the new export boundary. Fix: Assert that remote exports pass an explicit session selector through runSessionExport to BeginSessionExportForTarget, and guard against restoring the resident-transcript Markdown path. Verification: - pnpm exec tsx src/__tests__/remote-project-tree.test.tsx - pnpm test:typecheck - pnpm test:transcript * test(desktop): update export behavior contracts Problem: The complete frontend CI still encoded two pre-snapshot export assumptions: direct renderer imports from the command hook and missing tool results being treated as stopped. Root cause: The source and status contracts were not updated when export orchestration moved behind a lazy host-snapshot operation and tool execution state was separated from content availability. Fix: Verify the two-stage lazy export import path and require missing tool results to remain unknown without authoritative termination evidence. Verification: - pnpm exec tsx src/__tests__/bundle-contract.test.ts - pnpm exec tsx src/__tests__/history-tool-status.test.ts - pnpm test:typecheck - REASONIX_TEST_CONCURRENCY=2 node frontend/scripts/run-ci-tests.mjs (452/452) |
||
|
|
738e9b956e |
Unify transcript recovery and completion with Follow v2 / 统一会话同步与完成机制 (#10385)
* Unify transcript recovery and completion through runtime-owned v2 Problem: completed or reconnecting chats could lose visible output, infer incorrect run state, or display an intermediate duration. Root cause: independent history, event-ledger and runtime snapshots described different cuts, and sampling settlement could precede its business commit. Fix: publish canonical batches and independently versioned sampling frames from the session runtime; use one mandatory Follow v2 consumer for local and remote chat, persistence barriers, stable identities and bounded canonical paging. Preserve old session logs and provider serialization. Verification: root and Desktop Go suites, transcript/session/control race tests, 371 frontend suites, typechecks, production build, Chromium and 42 macOS Electron layout scenarios; Windows cross-compilation. Native Windows verification follows on this branch. * Keep contributor prompt instructions outside transcript migration Problem: changing contributor AGENTS text affects repository instruction inputs. Root cause: protocol documentation had also been copied into the contributor instruction file. Fix: retain the existing instructions and keep migration details in the bilingual user documentation. Verification: cache and provider serialization guards passed; no runtime code changed. * Separate transcript bookkeeping and honor native viewport geometry Problem: transcript additions exceeded existing complexity and file-size budgets, and the Windows layout fixture assumed odd native widths were exact CSS widths. Root cause: runtime reduction, settlement publication and store contracts were embedded in larger owners; 200% Windows scaling rounded a requested 1009px surface to 1010px. Fix: extract cohesive helpers/types without changing publication order or provider bytes; test representable sizes on both sides of the launcher threshold and measure actual CSS geometry. Verification: repolint, transcript/type/hooks checks and focused Go tests pass; Windows native tests and race checks exercise the extracted boundaries. * Migrate remote regression fixtures to transcript Follow Route mock remote output through the mandatory Follow stream and keep metadata separate from snapshot cuts. Assert prefix preservation and ordered completion instead of legacy history rebases. Use unique mock sampling identities across turns and wait for pane transitions in native layout tests. * Use reverse slice iteration for transcript retractions * Give explicit transcript retries a fresh snapshot A retry during ancillary hydration could join an already-installed old snapshot. Mark explicit retry reads as fresh so they supersede the previous load while ordinary startup reads still coalesce. Force a pending ancillary read in the regression and verify its late completion cannot overwrite the replacement. |
||
|
|
4daa815be8 |
Refactor chat, permissions, and Windows sandbox around Harness / 以 Harness 重构聊天、权限与 Windows 沙箱 (#10209)
* feat: align chat and permissions with Harness Replace the virtualized transcript and split approval/sandbox policy with a natural-flow chat surface, stable node subscriptions, unified permission presets, precise session grants, and platform sandbox enforcement. Port the Harness-style process rows, turn footer, navigator, file presentation, and full-access confirmation while preserving Reasonix history and provider contracts. Add the Windows restricted-token sandbox and fail-closed capability reporting, together with migration, remote compatibility, documentation, and acceptance evidence. * chore: refresh repolint baseline for one-shot refactor Record the deliberate carry-forward from the transcript, remote presentation, permission, and Windows sandbox changes. The refreshed baseline also captures size and complexity reductions produced by the same extraction work. * fix: align permission refactor with CI contracts * fix: stabilize cross-platform permission CI Problem: The permission refactor left headless Windows tests on the workspace sandbox, exposed Windows-only lint findings, and let the transcript browser resolve Playwright assets from the wrong directory. Root cause: Tests used the interactive mode setter for a headless controller, direct Bash fixtures did not stamp their intended unrestricted preset, the transcript benchmark imported Playwright before normalizing its browser path, and Windows-tagged files had not been linted locally. Fix: Use the headless permission entry point, make Bash fixture intent explicit, normalize the transcript benchmark root before importing Playwright, and apply the Windows lint corrections without changing sandbox behavior. Verification: - go test ./... - cross-platform golangci-lint for linux, darwin, and windows - Windows amd64 cross-compilation for boot, builtin, and winsandbox tests - transcript Chromium browser replay for 240 and 1,000 turns - go run ./tools/repolint * test: harden native transcript and shell contracts Problem: The Linux native-scrollbar regression clicked the bottom arrow instead of the scrollbar thumb, and direct shell-contract tests inherited the new workspace-write default on Windows hosts without a sandbox backend. Root cause: The browser test used a fixed bottom-edge coordinate, while shell fixtures invoked Bash outside the controller path and therefore had no host-stamped permission preset. Fix: Compute the native thumb center from scrollbar geometry, retain CI screenshots as artifacts, and mark direct shell execution fixtures with an explicit full-access test context while preserving restricted-sandbox tests. Verification: - go test ./internal/tool/builtin -count=1 - Windows amd64 cross-compilation for internal/tool/builtin - GOOS=windows golangci-lint run --timeout=5m ./... - Chromium transcript replay for 240 and 1,000 turns - go run ./tools/repolint * perf: bound cumulative transcript mounting Problem: The 1,000-turn Linux browser replay exceeded the 500 ms long-task budget while cumulative history pages were mounted. Root cause: Transcript subtree mutations repeatedly rescanned all loaded rows, and each 60-turn history page committed its full natural-flow DOM in one frame. Fix: Observe direct chat-node additions only, retain per-row resize observation for internal content changes, enumerate direct row children, and reveal prepended history across bounded adjacent-frame commits without unmounting existing rows. Verification: frontend typecheck; chat natural-flow and scroll-controller tests; Chromium transcript replay (1,000 turns: 122.7 ms input P95, 161 ms longest task, 0 px anchor drift); repolint clean. * fix: keep transcript hydration synchronous Problem: The progressive history mount delayed initial and replacement transcript content by one frame, breaking remote hydration visibility contracts. Root cause: The bounded reveal path treated every order change like a history prepend, including an empty initial order and authoritative session replacement. Fix: Restrict progressive rendering to a contiguous non-empty suffix with newly added leading nodes; hydrate, replace, and grow the tail synchronously. Verification: remote-session-surface 101/101; frontend typecheck; chat natural-flow and scroll-controller tests; Chromium transcript replay within input and long-task budgets. * fix: stabilize transcript and Windows CI Problem: Linux transcript hydration remapped every mounted node on each history page and exceeded the 500ms long-task budget. The Windows project-session migration test also raced asynchronous catalog startup. Root cause: The order subscriber owned the full React child map even while progressive hydration intentionally retained the previous order reference. The catalog test requested reconciliation before the catalog had been published. Fix: Memoize the node-seat mapping by rendered-order identity so only committed history chunks reconcile. Wait for catalog publication before requesting the production reconcile path, and move shared catalog polling helpers out of the oversized test file. Verification: - 1,000-turn Chromium transcript benchmark: max long task about 249ms - frontend typecheck and hooks lint - project CLI migration tests, 10 repetitions - repolint and git diff checks * perf: bound cumulative transcript layout Problem: Linux 1000-turn transcript replay still exceeded 500ms after seat memoization because each history page reconciled existing seats and the turn rail forced layout of every loaded mark. Root cause: Progressive prepend kept one flat React child list, unchanged turns were reprojected, and the navigator read scroll geometry and rendered all marks after every page. Fix: Keep immutable 24-node seat chunks, cache unchanged turn projections, isolate row layout, window rail marks while retaining full loaded-turn geometry, and make benchmark waits target exact mounted anchors without weakening thresholds. Verification: - Chromium 1000-turn: max 196ms, input P95 119ms, 2407ms full mount - Full transcript test suite - Frontend build, typecheck, lint and bundle checks - Go migration tests 10x - Repository lint and diff checks * Serialize permission changes with approval commits Problem: permission revisions could change while an older approval was still recording and installing its session grant, exposing a mixed snapshot and allowing cross-version authorization. Root cause: mode changes, grant revocation, approval resolution, and permission snapshot reads used separate synchronization boundaries. Fix: establish permissionMu -> promptResolveMu -> permissionStateMu ordering, publish preset/revision/grants atomically, cancel the captured old turn outside the state mutation, and cover both legal concurrent orderings with a deterministic barrier test. Verification: go test -race ./internal/control (including five repeated targeted runs), Windows amd64 cross-compilation, and repository lint all pass. * Preserve chat nodes across history prepends Problem: loading older history repartitioned existing messages under different chunk parents, remounting their DOM and losing selection, focus, and local disclosure state. Root cause: the rendered order was grouped into position-derived SeatChunk components and regrouped whenever a prefix crossed a 24-node boundary. Fix: render every business node under one stable parent, progressively reveal only the new flat prefix, and publish the committed mounted order so navigation never advertises a missing target. Verification: transcript unit tests cover 1/5/23/24/25/48/49-node boundaries and 60 resident DOM identities; Chromium, WebKit, and Electron layout and 240/1000-turn production replays pass. * Clarify full-access host execution semantics Problem: product copy implied that Reasonix filesystem and network sandbox guarantees continued to apply after selecting full access. Root cause: permission labels were updated without consistently documenting Harness-style unsandboxed execution across the desktop, CLI, bot, Windows, and site surfaces. Fix: state that full access runs with the current OS account, retains explicit pre-launch host denies, and does not constrain behavior inside the launched process. Verification: desktop locale typecheck/build, documentation tests, site tests, and full-text consistency checks pass. * Stabilize virtual rail navigation coverage Problem: the Windows Electron layout check sometimes reached the test after the active turn had already scrolled the Harness-style virtual rail to its tail, leaving the early turn mark unmounted. Fix: explicitly scroll the rail to its loaded start before the early keyboard jump, then to its loaded tail before the final jump. Verification: Chromium reports 39 passing geometry scenarios and Electron reports 42. * Make permission ordering test platform-neutral Problem: the Windows control runner correctly reports restricted presets unavailable before its native sandbox is initialized, so the new concurrency test failed before reaching the transaction it was meant to exercise. Fix: drive the same serialized Controller mode-change path directly; platform capability rejection remains covered separately at the public preset boundary. Verification: the ordering suite passes ten times under the race detector and internal/control cross-compiles for Windows amd64. |
||
|
|
27a45a260f |
fix(transcript): unify history snapshot and live event projection / 统一历史快照与实时事件的投影 (#9983)
* fix(transcript): unify history snapshot and live event projection
Problem:
Reasonix desktop 1.38.2 renders duplicated session content. When the
persisted history snapshot runs ahead of the live event stream, transcript
hydration appends already-rendered messages again ([A,B,C] + [A,B] ->
[A,B,C,A,B]), and events replayed after hydration can be dropped because
queued events are re-enqueued after the replay cursor already advanced.
Root cause:
History hydration dedupe only matched exact equality between the tail of
history and the head of the live stream. Message identity was not carried
through sampling events, the event merger, or persistence, so local,
remote, restore, cancel, and paging paths each maintained their own
projection logic with mismatched boundaries.
Fix:
- Thread message identity (Message.ID) through sampling events, the event
merger, and persistence; identity stays out of model requests.
- Merge history and live streams by message ID through one projection
shared by local Wails sessions and remote Serve sessions, with atomic
snapshot boundaries (snapshot plus covered event sequence committed
together) and receipt dedupe separated from commit.
- Controller now persists first, projects second, publishes events last.
- New shared Go package internal/transcript owns display record types and
streaming coalescing; the snapshot API supports paging and 64KiB content
chunking.
- Restore path installs a display checkpoint verified against the session
summary; legacy Serve surfaces get a degradation notice.
- Extract shared modules (remoteStatus, historyItems, historyTypes,
transcriptContentResolver, event extension surface, ledger metrics) and
split oversized functions to satisfy repolint without baseline changes.
Verification:
- go run ./tools/repolint: clean, no baseline update.
- go test ./internal/{control,serve,event,turnevent,transcript,agent,store}/...: ok.
- go test -race ./internal/{control,turnevent,event,transcript}/...: ok.
- cd desktop && go test .: ok.
- frontend: tsc --noEmit, pnpm test:transcript (incl. transcript-store 68
passed), transcript-snapshot-client, new-session-load-race (51 passed),
turn-event-projection-reset: all pass.
* chore(frontend): ratchet locale/raw bundle budgets for transcript projection
The legacy-transcript degradation notice adds one short zh-TW string,
pushing the zh-TW locale chunk to 65551 B gzip (64.015 KiB) over the
64.0 KiB ceiling; zh stays at 64793 B under its existing 63.3 KiB
ceiling. Ratchet only the zh-TW ceiling one decimal to 64.1 KiB.
The unified transcript projection (snapshot client/state, content
resolver, extracted history-items and remote-status owners) adds a
measured 24.5 KiB raw on the initial path (2458.7 KiB total) while gzip
stays at 459.1 KiB inside the existing 469.3 KiB budget. Ratchet the
raw ceiling to 2458.8 KiB with 0.1 KiB of build headroom.
Verification: node scripts/check-bundle-budget.mjs passes all budgets
after a production build.
* style(transcript): satisfy golangci modernize and staticcheck receivers
CI lint flagged the new internal/transcript package: integer-range loops,
a copyloopvar in the nested-ref test, WaitGroup.Go modernization, and
inconsistent Buffer receiver names. Apply the mechanical modernizations
and unify Buffer methods on one receiver name; no behavior change.
Also point the clear-session identity contract test at historyTypes.ts,
where SessionClearResult moved during the shared-module extraction (the
types.ts re-export keeps the import surface unchanged).
Verification: golangci-lint 2.12.2 run ./... reports 0 issues in both the
root and desktop modules; go test ./internal/transcript/ ok;
clear-session-identity-contract test passes.
* fix(transcript): deduplicate active snapshot records
Problem: active records could be returned both in the page and activeRecords, causing the frontend to reject the snapshot; long-history snapshots also scanned settled turns under the projection mutex.\n\nFix: suppress duplicate active records, add frontend defensive deduplication, and bound active-owner discovery to the current turn when identity is available.\n\nVerification: go test ./internal/transcript; frontend tsc; transcript snapshot client and projection reset tests.
* fix(transcript): preserve recovery actions and bounded replay
Problem: installing an authoritative snapshot could hide recovery actions, strand long user messages at their preview, or stall remote replay on a legal oversized ledger page.
Root cause: terminal display metadata was omitted, content patches confused message identity with mounted keys, and replay used a different wire budget from its reader. The row renderer also omitted the recovery callback.
Fix: retain terminal recovery and read receipts, bind recovery actions through the production row renderer, match snapshot content by stable message identity while preserving mounted keys, and recover oversized replay through bounded snapshot content. Copy checkpoint metadata without serializing immutable bodies under the projection lock.
Verification: regression cases failed before these repairs and pass afterward. Related root Go packages, the full desktop module, targeted race suites, frontend transcript/remote/stream suites, typechecks, production build, repolint and go vet pass. Browser checks confirm full content and recovery command delivery; the native Electron smoke passes. A 32 MiB checkpoint capture benchmark improves from about 130 ms and 128 MB allocated to 11 ms and 14 MB allocated.
* chore(transcript): retain main-v2 bundle budgets after integration
Problem: the earlier transcript branch carried bundle ceiling increases measured before the Electron migration.
Root cause: those measurements no longer describe the integrated bundle.
Fix: restore the unchanged main-v2 ceilings and remove the obsolete measurement notes.
Verification: the integrated production bundle passes the original limits at 2396 KiB initial raw assets and 57 KiB for the Traditional Chinese locale.
* fix(transcript): satisfy current Go iteration lint rules
Problem: the integrated branch retained an integer loop flagged by intrange and introduced a backwards slice loop flagged by modernize.
Fix: use the equivalent integer range and slices.Backward forms without changing iteration order or recovery selection.
Verification: golangci-lint passes for affected root packages and the desktop module; focused control and transcript tests pass.
* docs(desktop): regenerate transcript host inventory
Problem: full root tests detected that the migration inventory still described 580 commands after the transcript APIs raised the host contract to 592.
Fix: regenerate both inventory representations from the integrated desktop sources, preserving the existing classification policy.
Verification: go test ./tools/desktopinventory passes, including the source-archive check without Git.
* fix(transcript): keep recovery tokens out of displayed prompts
Problem: connecting the recovery button through a plain prompt would show its internal command and token as the optimistic user message.
Fix: preserve separate display and submission text through local and remote transcript prompt ports. The visible action uses existing localized copy while the controller receives the unchanged recovery token.
Verification: production row-renderer assertions, local submission lifecycle, remote composer/reconciliation tests, frontend typechecks and production build pass. A real-browser button click reports localized display text and the correct token-bearing submission, with no console errors.
* test(desktop): share browser asset loader in discovered suites
Problem: the full discovered frontend run failed only at topicbar-region because its transitive SVG import reached Node without an asset loader.
Root cause: dedicated suites used the existing SVG/image/CSS loader while the discovery runner registered only the CSS loader.
Fix: use the same existing asset loader for all discovered component suites; no test is excluded and no product rendering changes.
Verification: the previously failing topicbar suite passes through that loader; the final full discovery run remains enabled.
* test(desktop): advertise only callable host fixture methods
Problem: the remote runtime browser replay timed out after generated transcript methods were added to a fallback table with undefined implementations.
Root cause: the test preload advertised every object key as a callable method, falsely enabling snapshot negotiation and preventing history hydration.
Fix: derive the stub contract from callable table entries, preserving its live update behavior. Add a regression for adding and removing optional snapshot support.
Verification: the new stub test, session-load race tests, frontend typecheck and the complete app-browser chain pass. The original runtime-state browser reproduction now restores durable history after lost completion and switches back to the local session without errors.
|