Repository navigation
Conversation
…ture parsing (stablyai#14968) A dying main process never delivers process-gone, so a crash loop never reached the only prune call site, and Crashpad's own pass runs in the handler child after a delayed first sweep. Prune on startup instead of behind the coalescing timer the loop outruns, and cap dump count alongside the byte budget. Signature parsing stayed on the main event loop after a crash. Reject on ptype before the whole-buffer scan, and bound the backward prefix search that could otherwise walk the entire dump only to discard the result past 96 bytes. Also keeps dumps already claimed by a persisted report from being pruned out from under the report's minidumpPath. STA-4544
…yai#14922)" (stablyai#14976) This reverts commit 3811881.
…ablyai#14931) * refactor: split GitHubItemDialog.tsx under 400 lines No intentional behavior change. * refactor: group github-item-dialog into lifecycle folders Reorganize the 50 flat files under src/renderer/src/components/ github-item-dialog/ into six lifecycle folders: load-item-details/ shared types, both caches, fetch/settle, state badge open-dialog/ dialog shell, headers, body, tabs, link copy discuss-item/ conversation tab, comments, composer, timeline edit-item-fields/ GH edit section, labels, assignees, status inspect-pull-request/ combined diff viewer, checks tab land-pull-request/ PR actions, merge menu, reviewers No intentional behavior change. All 50 files moved verbatim; the only edits are relative-import specifiers (sibling paths plus a depth bump for ../../../../shared) and the hardcoded module paths in the two source-boundary tests. Import graph stays acyclic: zero mutual folder pairs, no file importing 4+ sibling folders, no dest file importing the public barrel, and no per-folder index barrels. * refactor: split item references and improve diff-viewer remount logic - Break down full `GitHubWorkItem` props into discrete `itemId`, `itemNumber`, and `itemRepoId` in mutation and action functions to prevent over-memoization of callbacks and improve dependency clarity. - Extract `getPRFilesCombinedDiffSignature()` and use it as a component key to safely remount the diff viewer when the PR revision changes, replacing generationRef tracking. - Add `getKeyedCheckAnnotations()` and `getKeyedCheckJobs()` to generate stable, collision-resistant keys for check arrays that may contain duplicates. - Consolidate interpreter timeouts into a single `SPAWNED_INTERPRETER_TIMEOUT_MS` constant and apply it via describe options rather than per-test values. * refactor: improve github-item-dialog repo context and i18n coverage - Add repoId prop to ConversationTab for explicit repo context override - Internationalize UI strings in diff viewer and PR action components - Improve error handling with cache rollback and guard cleanup on sync failure - Enhance cache key validation for cross-window invalidation by repoPath - Add repository access validation before rendering diff viewer - Fix cross-platform issues: skip symlink test on Windows, normalize CRLF in test assertions * Refactor check button i18n key and update text - Replace hash-based key with semantic name for maintainability - Change button label to "Open in browser" for broader context
… shell d…" (stablyai#14975) This reverts commit b6ea3f1.
Async cwd validation dedupes by exact path but had no concurrency bound, and a dead UNC share answers `stat` in ~21s while holding one of libuv's 4 default fs threads. Four distinct paths on one unreachable server therefore starved every other async fs read in the daemon — including the cold-restore history replay running alongside them — which moves the head-of-line stall stablyai#14848 removed from the event loop into the thread pool. Adds a per-route lane of 2, reusing PrioritySemaphore and matching the per-distro lane in rate-limits/auth-filesystem-operation.ts. Keyed by the host that has to answer (WSL distro, or the `\\server` prefix) so many dead subdirectories of one share fold into one lane. Local-disk paths bypass the lane entirely: a global cap would queue a healthy local spawn behind a dead share. Moves PrioritySemaphore to src/shared. It has no imports, and reaching into src/main/daemon from src/main/providers inverted the dependency direction that already runs daemon -> providers. Note this bounds pool occupancy, which cancellation cannot: an aborted `stat` still holds its libuv thread until the OS returns. STA-4543
… picker (stablyai#14965) * feat(workspace): reland set project location from the create-worktree host picker Relands stablyai#14868 (reverted by stablyai#14912) with a fix for the regression that caused the revert: setting a project location could change the path before Orca used it. The retarget-after-setup path read the raw store record to find a just-created setup, because the memoized picker options had not refreshed yet: useAppStore.getState().projectHostSetups.find( (candidate) => candidate.id === setupId && candidate.setupState === 'ready' ) That hand-rolls a second selection path that skips every rule the option builder applies — repo eligibility, ephemeral-VM and runtime-owned SSH host exclusion, and the one-setup-per-host dedupe whose own comment notes that resolveWorkspaceCreationTarget takes the first project+host match and ignores the rest. So the composer could be retargeted at a setup other than the canonical one for that host, pointing creation at a different location than the one chosen. Resolves through buildProjectHostSetupOptions against fresh store state instead, so the fallback and the steady-state picker agree by construction. STA-4547 * fix(workspace): sanitize the clone prefill and drop an abandoned set-location Review follow-ups on this PR. The "Clone from URL" prefill seeded the field with the verbatim `git remote` URL, which can embed a PAT (`https://x-access-token:ghp_...@github.com/...`). The clone then runs on the *target* host, writing that token into its .git/config — a credential the user never typed into this flow, now readable by anyone on a shared host. Strip it with the same sanitizer `getProvisionedRootRecipeRepoUrl` already applies to the ephemeral-VM recipe URL. Extracted to resolveProjectCloneUrlPrefill so the rule is directly testable. The dialog also stays dismissable while a submit is in flight, and an SSH clone is unbounded. A clone the user backed out of minutes earlier still called onReady, silently moving the run target and resetting start-from under a form they had since pointed at another host. Drop the result if the dialog went away. * fix(workspace): re-arm the abandoned guard on mount StrictMode runs mount/cleanup/mount, so latching `abandoned` on the first cleanup left it true for the rest of the session and permanently suppressed onReady — the app wraps its root in StrictMode. Reset it on mount.
…407) (stablyai#14916) * fix(mobile): bound pending terminal recovery polls * wip(mobile): partial STA-4407 bound pending-handle poll * fix(mobile): finish bounded pending-handle recovery * fix(mobile): preserve pending-handle recovery attempts on slow links * fix(mobile): retain pending-handle cadence budget semantics * test(mobile): pin pending recovery parked state resets * chore(mobile): drop the STA-4407 worker status logbook * fix(mobile): preserve pending recovery liveness * fix(mobile): coalesce repeated recovery retries * fix(mobile): memoize pending recovery context * fix(mobile): type the pending recovery poll test renderer explicitly * fix(mobile): type the poll test renderer without an any union * fix(mobile): keep recovery context refs current * test(mobile): tighten pending recovery coverage * test(mobile): preserve recovery-source liveness * fix(mobile): keep the poll test renderer union free of any * test(mobile): prove parked recovery isolation * fix(mobile): write the parked-recovery callback ref after commit * test(mobile): isolate recovery identity changes * test(mobile): prove recovery publication boundaries
* fix(terminal): reset SGR around restored output * fix(terminal): preserve live replay styling * fix(terminal): ground dead reattach fallback
* fix(browser): prompt for WebAuthn account selection * fix(browser): scope WebAuthn cancellation to session * fix(renderer): keep WebAuthn render phase pure
) * fix(browser): report cookies an import could not decrypt Supersedes stablyai#13193, which reported only the Windows v20 case. Nothing distinguished "decryption failed" from "no cookies present". A row that would not decrypt was folded into the generic `skipped` counter, and a profile whose rows all failed returned ok:true with importedCookies:0 and no warning — a green "Imported 0 cookies from Google Chrome." The two situations produce opposite result shapes and the worse one reported success. Attribute the cause at the point of failure, while the version prefix is still in hand, and surface it as one `cookies-undecryptable` warning carrying the reason. Covers all three known causes rather than one prefix: - app-bound-encryption: Chrome/Edge 140+ on Windows write `v20`, which only the writing browser can unwrap. The version gate is a FORMAT check (`/^v\d\d$/`), so v20 passed it and failed inside AES like corruption. - linux-keyring-unavailable: getLinuxEncryptionKey derived the v11 key from an empty password when both secret-tool lookups failed, so it never returned null and the "Could not access encryption key" guard was unreachable on Linux. - unknown: any other cause still warns instead of reporting success. Deliberately not a hard failure on Linux: Chrome falls back to the "peanuts" v10 key precisely when no keyring exists, so those profiles still import. Pinned by a regression test. Refs stablyai#13192, stablyai#14181 * fix(browser): attribute decrypt failures exactly and gate CBC by version Review-loop findings on the initial commit, all fixed here. - CORRECTNESS: v11 rows were attempted with the v10 key when the keyring was unavailable. AES-128-CBC is unauthenticated, so a wrong key that yields valid PKCS#7 padding was accepted — roughly 1 in 256 per row. Garbage values were written into the jar as real cookies, and because those rows counted as successes the warning this PR adds could never fire. Key eligibility is now explicit per version rather than implicit in key ordering. - CORRECTNESS: the CBC path returned an empty Buffer for a prefix-only value BEFORE checking eligibility. An empty Buffer is truthy, so an ineligible row counted as imported and reached the live-jar clear. Eligibility now precedes that branch and empty CBC ciphertext is rejected as malformed. - ACCURACY: a named cause reported the TOTAL failure count, so one v20 row plus one corrupt row claimed both failed to app-bound encryption. Counts are now exact per cause, with the remainder reported separately and a tie falling back to 'unknown'. Exact-count approach carried over from stablyai#13193. - The app-bound copy no longer dead-ends. It names the existing in-app file import without describing how to produce the file — Chrome has no native decrypted-cookie export, so concrete guidance would send users to an extension that can read their whole session jar. - Direct prefix edge tests carried forward from stablyai#13193. Repo-wide search found no second multi-key unauthenticated-CBC first-success site, so this pattern was one occurrence rather than a class. Co-authored-by: manuaudio <manuaudio@users.noreply.github.com> * fix(pr): preserve split worktree slice Remove the unrelated rollback of the worktree-slice split and its forbidden max-lines baseline addition from this cookie-import PR. * fix(browser): match the unknown decrypt reason explicitly CI's type-aware code-quality gate flagged the reason switch as non-exhaustive: the 'unknown' member was handled by `default:` rather than matched. Matching it explicitly keeps the behaviour identical today and makes the gate enforce the thing that matters — adding a new reason to the union now fails the switch instead of falling silently into a generic message that would not describe it. This gate is separate from `oxlint` and is not covered by running oxlint on the changed files, which is why it only surfaced in CI. --------- Co-authored-by: manuaudio <manuaudio@users.noreply.github.com>
…14221) (stablyai#14985) `setx GROK_HOME "C:\path\"` stores `C:\path"` — the CRT turns the `\"` into a literal quote. That quote unbalanced the trailing-backslash `if` operand, so cmd aborted grok-hook.cmd with exit 255 before curl and every Grok hook event failed. A quote elsewhere in the value closed curl's `grokHome=` argument early, swallowing the `^` continuation and dropping the `payload@-` line. `"` is illegal in a Windows path, so strip it during the copy. Co-authored-by: OrcaWin <293788423+OrcaWin@users.noreply.github.com>
…tablyai#14684) * fix(browser): shadow PermissionStatus state instead of proxying it Rebased onto main after stablyai#14685 landed in the same file. Both changes coexist: stablyai#14685's Firefox gating and narrowed promptPerms are preserved untouched, and this change replaces only the query-override implementation. The previous Proxy bound every callable property, which broke three observable things: - onchange assignment threw "Illegal invocation" — the native setter received the proxy rather than the branded target. - Listeners were delivered with the real target and the NATIVE state, so on a real permission change event.target.state read 'granted' while the returned status still read 'prompt'. - Method reads returned a new bound function each time, so name became 'bound addEventListener', toString lost its name, and identity was unstable. Separately, the notifications state was captured once as a string, so an already-returned status went stale after requestPermission updated it. Shadow only 'state' on the genuine PermissionStatus with a lazy provider. The object the site holds IS the real one, so identity, brand checks, method fingerprints and native event delivery survive with nothing to keep in sync. Verified against real Chromium (Chrome 151) rather than only the vm stand-in, because the stand-in cannot show whether defineProperty succeeds on a branded instance: the instance is extensible, the prototype 'state' accessor is configurable, defineProperty succeeds, instanceof survives, addEventListener keeps its native name and referential stability, and onchange assignment works. New tests live in their own file rather than merged into anti-detection.test.ts, whose harness diverged on main. The fallback test targets 'camera' because stablyai#14685 narrowed the intercepted set, so a name outside it never reaches the fallback. * test(browser): cover intercepted PermissionStatus identity
…k runs (stablyai#14580) * fix(agent-status): announce Claude turn complete while background work runs Lead Stop/StopFailure already ends the turn, but resolveClaudePaneState keeps the pane working for subagents, background shells, and session crons. That erases the working→done edge that mints the completion banner: subagent turns notify late with a stale body, and shells/crons never notify at all. Stamp turnCompletedAt on the gated lead Stop, announce immediately from that row, and pair the later all-clear done to the same end time so it cannot double-fire or collapse consecutive turns onto the pinned stateStartedAt. Fixes stablyai#13245 * fix(agent-status): suppress stamped turn replays * fix(agent-status): notify paired clients at turn end * Fix late-paired completion notification arming * test(agent-status): make the notification-id test fail on the pre-fix ordering The stored row inherited the helper's default codex agentType while the event named claude, so agentSnapshotMatchesExplicitTitle dropped it and freshStoredAgentStatus was undefined — the assertion held under either side of the `??`. Name the stored row's agent so the pinned working row survives and the snapshot-first precedence is what the test actually pins. * Suppress stamped completion tail replays * Prevent cross-coordinator title replays * Preserve stamped tails across fallback signals * Keep remount replay state while sibling lives * Scope OSC turn stamp preservation * Forward paired host completion stamps * Deduplicate paired completion tails * Bind paired completion tails to their turn * Preserve paired completion tail ownership * Keep paired tail replay state across remounts * Seed paired recovery without replaying completions * Seed startup replay and release stale fallback dedupe * fix(notifications): preserve stamped OSC repaints * fix(notifications): retain paired client turn boundary * fix notifications module import safety * chore: keep main integration focused * fix: preserve completion re-enable boundary
…compat consumers (stablyai#14825) * fix(agent-hooks): make the Windows managed hook survive Claude-hooks-compat consumers `~/.claude/settings.json` is not read only by Claude Code. Third-party Claude-hooks-compat layers (cursor-agent, Devin) import the same file and reimplement hook execution, so Orca's entry has to survive consumers that support strictly less than the documented schema. Three separate defects came from assuming otherwise. 1. The entry depended on `args`, which a compat consumer ignores. `args` is valid Claude Code syntax, but cursor-agent spawns `command` alone -- so `conhost.exe` ran bare, which opens an interactive console that never closes. Hook payloads were typed into those stranded shells (stablyai#14815). The entry is now one self-contained `command` string that depends on nothing optional. 2. `conhost.exe --headless` never relayed anything. It implements the ConPTY server protocol, not a generic no-window wrapper: it does not wait for the hosted process and relays neither exit code nor stdout. Measured directly -- `conhost --headless cmd /c "echo X& exit /b 42"` yields empty stdout and no exit code, while the replacement returns both and waits. So every hook was fire-and-forget, and whatever it printed was discarded. Replaced with `-WindowStyle Hidden`, which suppresses the window and keeps wait/exit-code/stdout intact. 3. The hook never wrote anything to stdout. Guards exited silently and curl's output went to nul. Claude Code documents empty stdout as "no decision", but cursor-agent treats PreToolUse as a permission gate, fails to parse empty stdout as JSON, and blocks the tool call -- so every shell command in every cursor-agent session on Windows failed (stablyai#14818). The script now writes `{}` first, on both the Windows and POSIX branches, which is documented to be identical to writing nothing for real Claude Code. Gemini and Antigravity already did this. Defects 2 and 3 are causally linked: `{}` cannot reach any consumer while conhost is swallowing stdout, so neither fix works without the other. Also fixed while establishing the contract: - The launcher's own missing-script fallback returned empty stdout, reproducing stablyai#14818 whenever `~/.orca` was cleaned or an install was half-finished. It now emits `{}` too. - PowerShell serializes progress records to stderr as CLIXML when stderr is redirected; a consumer merging stderr into stdout would see those bytes before the JSON. Every encoded payload now silences progress. - `runtime-home-hook-command.ts` built its own launcher without window suppression -- exactly the drift stablyai#14815 asks to prevent. All launcher construction now goes through `windows-powershell-hook-launcher.ts`, so the switch list cannot be present in one installer and missing in another. - Renamed `usesWindowsHeadlessHook` to `usesWindowsPowerShellLauncher`; nothing is headless anymore, and the flag selects a launcher. Testing: the new regression test asserts the effect a consumer observes -- it runs the exact `command` string from settings.json through both cmd.exe and Git Bash, across the guard-exit, reached-curl, and missing-script paths, and parses stdout. Verified it fails when `conhost --headless` is reintroduced. The previous tests all asserted installer intent, which is why they passed through all three defects. * fix(agent-hooks): close hook launcher review gaps --------- Co-authored-by: OrcaWin <293788423+OrcaWin@users.noreply.github.com>
* fix(terminal): inset the grid inside the xterm surface (stablyai#13252) Padding X/Y was applied as start-edge container margin, so the cell grid stayed flush on the trailing edges and a fractional background opacity stacked a darker gutter around the viewport. Put the setting on .xterm so FitAddon insets both axes and the themed background fills the pad. * fix(terminal): normalize padding before fit * fix(terminal): align stored and fitted padding * test(terminal): lock padding before fit * fix terminal padding opacity compositing * fix live terminal padding backgrounds * fix(terminal): preserve source-over alpha blending * fix(terminal): restore WebGL alpha blending * test(terminal): complete hidden retention pane fixture
…ablyai#14667) * test(crash-reporting): keep ambiguous tree kills reportable * test(crash-reporting): drop the stale sibling-settle deferral comment
…ides (stablyai#14984) * fix(commit-message): keep Windows paths intact in agent command overrides `tokenizeCustomCommandTemplate` applies POSIX backslash-escape rules on every platform. On Windows `\` is the path separator, so a native absolute path in an agent command override is silently destroyed: C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -> C:WindowsSystem32WindowsPowerShellv1.0powershell.exe which is then reported as not found on PATH. The agent *startup* path already routes Windows shells to the Windows tokenizer, but the commit-message AI path still calls the generic tokenizer directly, so overrides, extra CLI args and custom commands there are all affected. The tokenizer gains an explicit `'escape' | 'literal'` mode rather than reading `process.platform`, because the same template can be parsed on one host and executed on another. `'escape'` stays the default, so POSIX behaviour — where `foo\ bar` is deliberately one token — is unchanged. `'literal'` is selected only where the command provably runs on native Windows: a LOCAL target, on win32, with no WSL distro. A WSL target runs a Linux binary inside the distro, and a remote target runs on a host whose platform this process cannot see; both keep POSIX escaping. Fixes stablyai#11375 * test: pin the platform decision for literal-backslash parsing commandBackslashMode is the only place that reads the platform, so it is where this can be wrong in the direction that matters — applying Windows rules to a command that will actually run under a POSIX shell. WSL and remote targets are pinned explicitly; both were previously untested.
* refactor: split PullRequestPage.tsx under 400 lines Move the 5888-line PR page into nested domain modules under src/renderer/src/components/pull-request-page/ and leave a thin public barrel. No intentional behavior change. * rm plan * Improve React stability and remove manual ref caching - Stabilize React keys in CheckDetailsPanel using content fields instead of array indices to prevent unnecessary remounting - Remove manual ref-based entries cache in PRFilesCombinedDiffViewer, rely on useMemo dependency (diffEntrySignature) instead - Move sectionsRef assignment to useLayoutEffect to avoid render-phase ref writes - Refactor usePRFileSectionLoader to destructure args for readability * Improve PR page stability: add error handling and fix race conditions - Add error handling with user feedback (toast notifications) for comment submission, review comments, diff loading, and file view syncing - Internationalize hardcoded strings for PR state labels and error messages - Fix race condition in reviewer submission by using a ref-based guard instead of render-time state - Fix scroll restoration to avoid overwriting target positions with intermediate clamp values - Add effectiveRepoId parameter for proper repo context in review operations - Disable reviewer picker during submission to prevent concurrent requests * Improve PR page stability: add timeout and stable list keys - Add 45s timeout for diff loading to prevent indefinite hangs - Fix React list key generation for annotations/jobs using content-based keys with occurrence tracking - Refactor scroll position caching to properly handle mid-restore teardown - Replace interpolated error messages with full locale-specific strings for close/reopen actions * Fix PR diff viewer cache isolation and list key collisions - Changed list key generation from string concatenation to JSON serialization to avoid collisions with actual content keys - Added host-aware scoping to diff view caches so local and remote execution don't share entries - Optimized virtualizer keys to use lightweight revision counter instead of full serialized signature * Extract PR file state into entry-scoped hooks Replace manual state resets with custom hooks that automatically clear section heights and active section when switching PR entries. This prevents state leakage between files and simplifies the diff viewer component. Also validates the active section key exists before passing it to child components. * Improve PR page error messages, accessibility, and stability - Show actual error messages from failed operations instead of generic fallbacks - Add aria attributes for combobox/listbox patterns and proper option identifiers - Consolidate duplicate label/assignee update logic and fix event listener passive mode - Memoize GitHub source runtime to prevent stale closure in checks callbacks - Extract filled state badge tone for reuse and fix workspace attachment type - Guard textarea shortcuts against concurrent saves and add mention query test * Add explicit PR file content cache eviction Extract PRFileContentRequestArgs type and create evictPRFileContentRequest function to handle cache eviction explicitly. Call eviction on load timeout so retries fetch fresh content. Adds tests for cache behavior.
Previously silent failures are now rethrown after recovery attempts. Co-authored-by: m4air <m4air@m4airs-Air.localdomain>
…dcrumb slot without starving memory highwaters (stablyai#14867)" (stablyai#15005) This reverts commit 28c93da.
… cannot reject them (stablyai#14994) The managed hook command embedded a bare $SYSTEMROOT. Grok loads Claude's settings.json hooks and statically prechecks env vars across the whole command string, so the reference inside the never-taken Windows branch made it refuse the hook on macOS on every event: hook not executed: required env var(s) not set: ${SYSTEMROOT} Grok fails these open, and Orca installs Grok's native hook separately, so no status was lost -- the symptom is a swallowed failure line per tool call. $VAR and ${VAR-} expand identically in POSIX shells absent set -u, so this has no execution-time effect; only the static precheck observes it. Verified in Git Bash on Windows that both guard forms resolve identically ($SYSTEMROOT is set there and uppercase is the correct spelling -- $SystemRoot is undefined). Also converts the three bare $HOME references so the regression test can assert zero bare variable references with no exemption. A $SYSTEMROOT-specific check would not have caught this class of bug being introduced elsewhere.
…tablyai#14947) detectRepoFileIcon fell back to a LOCAL read whenever the SSH filesystem provider was absent, so a disconnected/not-yet-reattached remote repo whose path also exists on the client picked up the wrong repository's icon. Thread the connection identity through and fail closed, matching the rule already stated in connection-context.ts and repo-default-branch.ts.
…ist (stablyai#14973) * feat(terminal): report execution host and listing scope in terminal list `orca terminal list` returned rows with no host identity and no statement of what the listing covered, so a scoped listing that saw nothing read as "nothing exists anywhere" — an agent reported a live remote worker dead. Each row now carries an optional `executionHostId` derived from the PTY id (SSH and paired-runtime ids embed their owner), and the result carries an optional `hostScope` naming the hosts covered and the known hosts skipped. Both are surfaced in `--json` and in the human-readable CLI output, where an absent field renders as `unknown` rather than `local`. Both row builders route through one resolver, so the rule lives in one place. * fix(terminal): preserve unverifiable host scope * fix(terminal): fail closed on unverifiable hosts * test(terminal): name unverifiable scope explicitly * perf(terminal): keep graph hydration host scans narrow * fix(terminal): reject blank foreign host owners * fix(terminal): validate inferred inventory hosts * fix(terminal): preserve paired folder host scope * fix(terminal): keep inventory host inference typed * fix(terminal): disclose paired folder hosts
…blyai#15016) The PR test LoC job fetched .github/scripts/pr-test-loc-*.mjs from pull/<n>/head and ran them with node while holding a GITHUB_TOKEN scoped pull-requests: write, so PR-authored code executed under a write token. Pin the fetch to the repository default branch. base.sha is not enough: for stacked PRs it is an unreviewed feature-branch commit any collaborator can push to, while main is gated by branch protection. Also pass event data via env instead of shell interpolation, and add set -euo pipefail so a failed download cannot leave a truncated script.
* Remap SSH leases per execution host, not globally SSH lease leaf IDs are now remapped within their execution host partition, preventing silently empty tabs when the same tab name exists on multiple machines after restart. Also preserve folder workspace paths exactly as provided without trimming whitespace. * rm review file --------- Co-authored-by: m4air <m4air@m4airs-Air.localdomain>
…d module Local IPC, SSH relay, and runtime host all need to agree on which extensions open as base64 previews. The previous fix only edited src/main/runtime/orca-runtime-files.ts, leaving local workspaces and remote SSH worktrees to fall through to the binary fallback. Sharing one PREVIEWABLE_BINARY_MIME_TYPES across the three sites keeps remote .docx / .xlsx previews alive. The relay's IMAGE_MIME_TYPES stays image-only (its only consumer needs images, not PDF or office binaries) so the file-read path picks up PREVIEWABLE_BINARY_MIME_TYPES directly. status.ts is kept on a local image-only set because ImageDiffViewer would render broken images for non-image MIME.
…3-30533 / CVE-2024-22363 xlsx@0.18.5 (the npm-registry version) carries prototype-pollution and ReDoS vulnerabilities. SheetJS moved off npm at 0.18.5 so a bare '^0.18.5' pin cannot reach 0.20.3. Pnpm override routes the package to the CDN tarball, which resolves to 0.20.3 and exposes the same import shape XLSX.read / XLSX.utils.sheet_to_csv already use.
A crafted .docx can carry a javascript: hyperlink that mammoth emits
verbatim into result.value. dangerouslySetInnerHTML with raw mammoth
output would let it reach the renderer. DOMPurify is already a
dependency and applied to the same surface in IpynbViewer / MermaidBlock,
so reuse the same USE_PROFILES: { html: true } config here.
Adds a test that mocks mammoth to return a javascript: anchor and
verifies the rendered href is no longer a javascript: URL.
…rer dispatch (I4) The renderer-side MIME literals for the .docx / .xlsx branches had drifted from the main-process whitelist, so a typo on either side would silently send the viewer a wrong type. Import the shared PREVIEWABLE_BINARY_MIME_TYPES map and bind DOCX_MIME / XLSX_MIME locally so the dispatch site and the read site reference one definition. Cover the dispatch site with focused tests that mount the real EditorContent under happy-dom, stub each lazy viewer with a uniquely-named placeholder, and assert the right stub renders for .docx, .xlsx, .png, and the conflict-review binary branch.
…lsx viewers (I1) The docx/xlsx viewers each ran a runtime preview RPC and decoded the bytes themselves; EditorContent already had the preview in its fileContents cache. Pass fc.content straight through and let the viewers do atob+mammoth/XLSX.read locally. Removes the runtimeContext prop, the JSON.stringify-keyed effect in each viewer, and the 'does not re-read on equivalent context' test that only existed to compensate for the inline-object stability assumption.
XlsxViewer kept its own <table> JSX, formatCell helper, and number-column styling that drifted from CsvViewer. Parse each sheet via XLSX.utils.sheet_to_csv and delegate table rendering to CsvViewer; the sheet-tab bar stays so the user still picks which sheet to view. pnpm-lock.yaml adds the SheetJS CDN override for xlsx so the dep chain resolves without npm-registry 0.18.5. Tests: 5 XlsxViewer tests + 5 ImageViewer + 6 EditorContent dispatch + 8 DocxViewer + others in editor preview surface = 24 passing.
DocxViewer and XlsxViewer shipped hardcoded Chinese strings for loading and parse-error states. Route them through translate() with stable auto.components.editor.<Viewer>.<hash> keys, populate en/zh/ja/ko/es catalogs, and update the two parse-error tests to assert on the English fallback string. The four EditorContent.tsx <div>Loading…</div> Suspense fallbacks stay hardcoded but get an allowlist entry — M3 removes them entirely when EditorPanelShell owns the Suspense surface.
…ice viewers (M3)
EditorPanelShell already wraps EditorContent in <Suspense fallback={<EditorLoadingFallback/>}>.
The four inline <React.Suspense fallback={<div>Loading…</div>}> wrappers around
DocxViewer/XlsxViewer duplicated that boundary with a less-translated fallback string.
Let the parent own it. Drops the temporary Loading… allowlist entry.
Tests: 19 editor preview tests passing. pnpm typecheck:web clean.
oxlint clean. verify:localization-coverage clean.
…gnment transform Ponytail: stops at one rung — mammoth's default styleMap already covers canonical headings, Strong, lists. We add: Title/Subtitle/Quote/IntenseQuote built-in styles, List Paragraph and No Spacing mappings, the empty-paragraph matcher (rejected by mammoth's grammar, dropped), explicit u/strike/Emphasis markers, and a transformDocument that re-tags aligned paragraphs with a synthetic styleId so the styleMap routes them to a wrapper with text-align. CSS module grows rules for the new elements: h1.title, p.subtitle, blockquote, p.listParagraph, p.noSpacing, p.empty, alignment wrappers, u, s, a (primary color + hover underline). <p> defaults stay close to the existing scale; we don't invent font sizes. DOMPurify v3.4.13's html profile omits h1-h6/u/s — we whitelist the tags mammoth actually emits so headings and inline formatting survive sanitization instead of flattening to text. The javascript: hyperlink test keeps passing since the href attribute stays in the allowlist. Tests: build a docx in-memory via the existing `docx` devDep and assert bold, italic, and center alignment render through the preview. The existing tiny.docx fixture stays untouched (<10KB intentionally).
…colgroup widths Ponytail: stops at rung 1 — SheetJS's sheet_to_html already handles merged cells, number formats, cell text escaping, and hyperlinks; we just consume it directly instead of round-tripping through CsvViewer's CSV pipeline that loses all of that. DOMPurify v3.4.13 strips the <table> element itself, so the xlsx path skips DOMPurify (xlsx payloads reach the renderer through an explicit preview request, not hostile HTML) — see DocxViewer's why-comment for the DOMPurify contract there. Column widths: build a <colgroup> from ws['!cols'] ourselves since SheetJS's html output doesn't include one. Use wpx when present, fall back to wch*7, default to 96. CSS: header-row convention tags the first <tr class="firstRow"> with bold + muted background. Number cells (data-t="n") get tabular right-alignment. Table layout switches to fixed so widths stick. Empty state: SheetJS emits "<table></table>" for empty sheets; the viewer shows a localized "Empty sheet" message (new e1a5c7d9f3 key in 5 locales) instead of borrowing CsvViewer's "Empty file". Sheet-tab bar and corrupted- buffer error path stay identical to the previous viewer. Skipped: font name/size/color (community SheetJS doesn't surface these), cell fill colors (parsed with theme/tint resolution that doesn't round-trip reliably), charts, images, conditional formatting. Tests: 3-sheet tiny.xlsx still shows three tabs; clicking tab[3] switches content; empty.xlsx shows the localized empty state; new tests assert the first row gets the firstRow class and the preview escapes raw HTML/script tags via SheetJS's own escapehtml.
i18next defaults to {{varName}} for interpolation. Single {varName} was
treated as literal text, so the loading message rendered
"正在加载 {fileName}…" instead of substituting the actual filename.
Fix DocxViewer / XlsxViewer fallback strings and the matching entries in
all 5 locale catalogs.
Both local IPC and runtime file-explorer now reference a single MAX_PREVIEWABLE_BINARY_BYTES constant in src/shared/previewable-binary-mime-types.ts. Previously the runtime path used LOCAL_PREVIEWABLE_BINARY_MAX_BYTES = 10 MiB while IPC used MAX_PREVIEWABLE_BINARY_SIZE = 50 MiB; a 15 MB .docx opened over SSH hit the runtime cap with no clear error and the renderer saw an empty payload, then DocxViewer's base64ToArrayBuffer threw and surfaced a misleading 'corrupt or encrypted' message.
Previously overwrote styleName with the raw alignment string ('center',
'right', 'justify'), so mammoth styleMap rules keyed on styleName
(p[style-name='Quote'], p[style-name='Title'], p[style-name='List Paragraph'])
no longer matched when the paragraph was also explicitly centered/right/
justified — a common Word authoring pattern.
Now only styleId is set, matching the alignment-only rules (p.AlgnCenter,
p.AlgnRight, p.AlgnJustify) while leaving the named-style rules intact.
OfficePreview.module.css previously hardcoded 'Inter' as the third fallback with a comment claiming it matched Orca's shadcn UI, but STYLEGUIDE.md:86 explicitly says 'Always reach for Geist for sans, never Inter or system sans'. --font-sans (defined in assets/main.css as the Geist stack) is now the fallback after Calibri/Carlito.
status.ts previously declared its own local PREVIEWABLE_BINARY_MIME_TYPES that only contained image extensions + .pdf, missing .docx/.xlsx. The git status path then reported docx/xlsx as 'not previewable binary' even though the file-open path (IPC/relay/runtime) already handled them. Import from src/shared/previewable-binary-mime-types instead so all paths agree on what 'previewable binary' means.
Collapses two parallel docx/xlsx/image dispatch ladders (active-file path ~lines 779-813 and conflict-review path ~lines 510-553) into a single renderBinaryViewer helper. Conflict-review ImageViewer now also receives scrollCacheKey (it previously didn't, drifting from the active-file path). Adding a new previewable MIME touches one place instead of two.
Test name and comment claimed DOMPurify escapes cell text, but XlsxViewer.tsx intentionally bypasses DOMPurify (v3 strips <table>). SheetJS sheet_to_html runs its internal escapehtml on every cell value, which is what actually prevents raw <script>/<iframe> from reaching dangerouslySetInnerHTML. Rename to match the actual mechanism and inline a comment naming the real sanitizer, so future regressions target the right layer.
Move ZIP_MAGIC + isZipBuffer to src/shared/zip-magic.ts and import from both viewers. .docx and .xlsx are both ZIP containers, so a truncated/non-ZIP payload should fail with a clear 'not a zip archive' error from both, not surface as the viewer-specific 'corrupt or encrypted' copy in DocxViewer.
The key forced React to unmount and remount the entire <table> subtree on every tab switch, losing scroll position and selection. Only innerHTML needs to change; React already updates that on the existing div.
Move the byte-identical atob→Uint8Array→ArrayBuffer loop out of DocxViewer and XlsxViewer into src/shared/zip-magic.ts (alongside the zip-magic helper already hoisted there). One place to fix if the relay ever ships whitespace- tolerant or URL-safe base64.
DocxViewer and XlsxViewer both initialise status to {kind:'loading'}, then
unconditionally rewrite it again at the top of useEffect. On a prop change
that's already a loading state (e.g. filePath change while previous parse
in flight), the unconditional setState triggers an extra render. Use the
functional form and bail when prev is already loading.
src/shared is the contract between renderer, main, preload, and relay, but the renderer imports it as '@shared/...' with no matching alias in vite, vitest, or tsconfig.web.json. The DocxViewer/XlsxViewer tests have been silently failing to resolve since the office-preview branch added the first @shared/zip-magic import. Register the alias once in: - electron.vite.config.ts (renderer.resolve.alias) - config/vitest.config.ts (resolve.alias) - config/tsconfig.web.json (paths) so editor:vitest no longer breaks and the renderer build stops relying on a non-existent path.
MAX_PREVIEWABLE_BINARY_BYTES + MAX_TEXT_FILE_BYTES now live next to PREVIEWABLE_BINARY_MIME_TYPES. Relay/fs-handler-utils and ssh-file-stream-read-cap import them instead of declaring local 50/10 MiB copies. Local IPC keeps its 50 MiB text cap (no RPC frame ceiling), but reads MAX_PREVIEWABLE_BINARY_BYTES for the binary cap so the four paths (local IPC, runtime host, relay, SSH) agree. - src/shared/previewable-binary-mime-types.ts: add MAX_TEXT_FILE_BYTES - src/relay/fs-handler-utils.ts: import both, re-export under existing names - src/main/ssh/ssh-file-stream-read-cap.ts: import both
…iewer The shared MIME allowlist now contains image/* + PDF + .docx/.xlsx. buildDiffResult previously set isImage:true for every allowlist hit, so any .docx or .xlsx diff was routed to ImageDiffViewer — which decodes the bytes as image data and renders Word/Excel documents as garbled output. Narrow the flag to image MIME + PDF so office binaries fall through to the 'Binary file changed' message while preserving the existing PDF preview contract. - src/main/git/status.ts: import IMAGE_FILE_MIME_TYPES; isImage now computed from image-MIME map + .pdf, not from the full allowlist.
…eze, export) - pin xlsx CDN tarball to 0.20.3 (CVE-2023-30533 / CVE-2024-22363) - drop misleading xlsx ^0.18.5 from dependencies (overrides wins) - guard XlsxViewer against empty SheetNames - freeze PREVIEWABLE_BINARY_MIME_TYPES so callers can't mutate it - hoist RUNTIME_PREVIEWABLE_BINARY_MIME_TYPES export out from between import blocks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
.docx/.xlsx/.pdf加进编辑器文件预览白名单,统一走PREVIEWABLE_BINARY_MIME_TYPES(本地 IPC + SSH relay + runtime host 三方共享)sheet_to_html渲染工作簿,支持多 sheet 切换、空 sheet 占位、首行高亮、colgroup列宽.docx,带 ZIP magic 预检renderBinaryViewer,office 文件复用ImageDiffViewer(PDF 走 image 管道预览)修复 (review feedback)
src/main/git/status.ts: 缩小isImage到IMAGE_FILE_MIME_TYPES + .pdf,避免.docx/.xlsx被误标记走ImageDiffViewerescapehtml已转义,文档化接受风险xlsx-latest.tgz→xlsx-0.20.3.tgz(CVE-2023-30533 / CVE-2024-22363)SheetNames守卫Object.freeze(PREVIEWABLE_BINARY_MIME_TYPES)RUNTIME_PREVIEWABLE_BINARY_MIME_TYPES移出 import 块之间MAX_PREVIEWABLE_BINARY_SIZE上提到 sharedTest Plan
XlsxViewer7 测试 (多 sheet 切换、默认 sheet、空 sheet、损坏缓冲、表头高亮、SheetJS escapehtml、标签语义)status-diff4 测试 (含 PDF 仍标 isImage)orca-runtime-files.preview3 测试fs-handler-utils1 测试