Repository navigation
test: add accumulated-workspace terminal typing reproduction - #20934
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (9)
💤 Files with no reviewable changes (4)
🚧 Files skipped from review as they are similar to previous changes (3)
Included review availability: Your plan provides up to 10 included reviews per hour; 1 remains after this review. 📝 WalkthroughWalkthroughThe pull request expands the multi-workspace typing benchmark. It adds synthetic accumulated-workspace fixtures, status and title traffic, renderer profiling, scale census reporting, and workspace load helpers. It extracts paced typing parsing and measurement validation into a tested module. Load scripts now support byte-paced Unicode streaming, OSC metadata, lifecycle updates, statistics files, and character-attributed arrivals. The launcher exposes additional environment controls, and new documentation describes benchmark operation, metrics, controls, and limits. Priority: ⬇️ Low Merge Risk: 🟡 Moderate · up to Benchmark runs can measure an unintended workload, leave temporary workspaces behind after failures, or lose completed results when an auxiliary statistics file is absent. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
Full details: Docstring CoverageExplanation Docstring coverage is 12.82% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 39 functions across 17 files. (1 skipped: 1 unsupported.)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Advanced
Run ID: a01bdab5-1d26-4f74-83a4-f750614d100b
📒 Files selected for processing (18)
config/scripts/run-multi-workspace-typing-bench.mjstests/e2e/accumulated-workspace-fixture.tstests/e2e/accumulated-workspace-profile.tstests/e2e/accumulated-workspace-state-builder.tstests/e2e/accumulated-workspace-state-builder.unit.test.tstests/e2e/accumulated-workspace-status-fixture.tstests/e2e/accumulated-workspace-title-fixture.tstests/e2e/paced-terminal-typing-measurement.tstests/e2e/paced-terminal-typing.tstests/e2e/paced-terminal-typing.unit.test.tstests/e2e/sustained-agent-typing-load-scripts.tstests/e2e/sustained-agent-typing-load-scripts.unit.test.tstests/e2e/terminal-multi-workspace-typing-latency.spec.tstests/e2e/terminal-typing-measurement-control.spec.tstests/e2e/typing-load-workspaces.tstests/e2e/typing-renderer-cpu-profile.tstests/e2e/typing-scale-census.tstests/tools/benchmarks/terminal-typing-benchmark.md
Included review availability: Your plan provides up to 10 included reviews per hour; 3 remain after this review.
d0009ac to
7d6596d
Compare
There was a problem hiding this comment.
Important
The benchmark machinery is sound, but three of its verification paths can pass without verifying anything: the documented stall-control command silently skips, the status-traffic assertion also passes on all-zero evidence, and the per-scenario hang-detector assertions cannot fail. All fixes are small.
Reviewed changes
- Accumulated-workspace fixture — seeds 870 worktrees / 27 repos / 1,410 terminal tabs / 2,000 unified tabs / 857 sleeping records / 177 live statuses through production store writes, with slice-restoring teardown.
- Paced typing measurement — absolute planned-key schedule, per-key character attribution from a JSONL arrival sidecar, and strict sequence / clock-order validation in
buildPacedTypingMeasurement. - Load generator — stream pacing moved from characters/tick to UTF-8 bytes/tick with codepoint-safe chunk boundaries, plus optional OSC title / OSC 9999 status frames and per-producer stats files.
- Status and title traffic fixtures — same-tick IPC bursts routed through the production IPC bridge and title writes through mounted pane managers, with an ingress round-trip probe.
- Controls and reporting — injected-120 ms positive control, CDP CPU profiles, scale census, build-artifact fingerprints, and
tests/tools/benchmarks/terminal-typing-benchmark.md. - Launcher — new flags forwarded and
ORCA_BACKGROUND_LAUNCH=1forced.
Hoisting test.skip to file/describe scope (since the prior commit) is a good fix — skipped bench specs no longer build the Electron fixtures. I also verified the new unit suites pass (14 tests), typecheck:e2e reports no errors in the changed files, check:code-quality:changed reports 0 findings, and the production contracts the fixtures rely on (agentStatus:set → updatedAt, acceptedStatusSeq, setAgentStatus / setRuntimePaneTitle / createWorktree / removeWorktree signatures, OSC 9999 ingestion, testMatch: '**/*.spec.ts') all line up.
ℹ️ The build-provided instrumentation probe is never installed
startAccumulatedBenchmarkInstrumentation / stopAccumulatedBenchmarkInstrumentation read window.__orcaBenchmarkInstrumentation, but a repo-wide search finds that global referenced only by tests/e2e/accumulated-workspace-fixture.ts — nothing in src/, the preload, or the e2e build installs it. BENCH_INSTRUMENTATION_REQUESTED defaults to true, so every ordinary run requests a probe that can never be present and records {available: false, reason: 'not-installed'} in the report.
Technical details
# The instrumentation probe is dead on this branch
## Affected sites
- `tests/e2e/accumulated-workspace-fixture.ts:172-201` — `startAccumulatedBenchmarkInstrumentation` / `stopAccumulatedBenchmarkInstrumentation` gate on `target.__orcaBenchmarkInstrumentation`.
- `tests/e2e/terminal-multi-workspace-typing-latency.spec.ts:103,427-428,488-491` — requests it by default and folds the (always-unavailable) result into the JSON report.
## Required outcome
- Clarify whether the probe is expected to arrive from the production-fix branch (#20931). If yes, say so in the doc next to "build-provided instrumentation"; if no, stop requesting it by default so the report field carries signal rather than a permanent `not-installed`.
## Open questions for the human
- Is the `--instrumentation` default-on intended for this branch, or should it default off until a build actually installs the probe?ℹ️ Nitpicks
tests/tools/benchmarks/terminal-typing-benchmark.md:14— the example "creates 23 real visited workspaces", butcreateTypingLoadWorkspacesreuses the seeded load worktree forindex === 0and only callscreateWorktreeforindex > 0, so it creates 22 new ones and visits 23.tests/e2e/terminal-multi-workspace-typing-latency.spec.ts—await removeTypingLoadWorkspaces(...)runs unguarded in thefinallyahead ofrmSync(scratch, ...), so a cleanup failure replaces the original test error and leaks the temp directory.
DeepSeek Flash (free via Pullfrog for OSS) | 𝕏
There was a problem hiding this comment.
Actionable comments posted: 3
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Advanced
Run ID: ce4a6582-9b05-4bb2-a0c7-48f0b561e6c6
📒 Files selected for processing (18)
config/scripts/run-multi-workspace-typing-bench.mjstests/e2e/accumulated-workspace-fixture.tstests/e2e/accumulated-workspace-profile.tstests/e2e/accumulated-workspace-state-builder.tstests/e2e/accumulated-workspace-state-builder.unit.test.tstests/e2e/accumulated-workspace-status-fixture.tstests/e2e/accumulated-workspace-title-fixture.tstests/e2e/paced-terminal-typing-measurement.tstests/e2e/paced-terminal-typing.tstests/e2e/paced-terminal-typing.unit.test.tstests/e2e/sustained-agent-typing-load-scripts.tstests/e2e/sustained-agent-typing-load-scripts.unit.test.tstests/e2e/terminal-multi-workspace-typing-latency.spec.tstests/e2e/terminal-typing-measurement-control.spec.tstests/e2e/typing-load-workspaces.tstests/e2e/typing-renderer-cpu-profile.tstests/e2e/typing-scale-census.tstests/tools/benchmarks/terminal-typing-benchmark.md
🚧 Files skipped from review as they are similar to previous changes (1)
- tests/tools/benchmarks/terminal-typing-benchmark.md
Included review availability: Your plan provides up to 10 included reviews per hour; 1 remains after this review.
| if (metadataEnabled && now >= nextTitleAt) { | ||
| await writeChunk('\\x1b]0;' + spinner[titleFrames % spinner.length] + ' OpenCode' + (titleChangeMs > 0 ? ' task ' + Math.floor((now - startedAt) / titleChangeMs) : '') + '\\x07') | ||
| titleFrames += 1 | ||
| nextTitleAt = now + 80 |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟠 Major | ⚡ Quick win
Use titleChangeMs for the title update cadence.
Line 92 always schedules the next OSC title frame after 80 milliseconds. Therefore, --title-change-ms does not control the title update rate. The changing spinner still produces title updates every 80 milliseconds for all positive values.
Schedule nextTitleAt from titleChangeMs. If zero disables title traffic, also require titleChangeMs > 0 in the condition.
Proposed fix
- if (metadataEnabled && now >= nextTitleAt) {
+ if (metadataEnabled && titleChangeMs > 0 && now >= nextTitleAt) {
await writeChunk('\x1b]0;' + spinner[titleFrames % spinner.length] + ' OpenCode' + (titleChangeMs > 0 ? ' task ' + Math.floor((now - startedAt) / titleChangeMs) : '') + '\x07')
titleFrames += 1
- nextTitleAt = now + 80
+ nextTitleAt = now + titleChangeMs
}| buildArtifacts: { | ||
| mainSha256: createHash('sha256').update(readFileSync('out/main/index.js')).digest('hex'), | ||
| rendererAssetNamesSha256: createHash('sha256') | ||
| .update(readdirSync('out/renderer/assets').sort().join('\n')) | ||
| .digest('hex') | ||
| }, |
There was a problem hiding this comment.
🩺 Stability & Availability | 🟡 Minor | ⚡ Quick win
🔎 Supported by static analysis
🏁 Script executed:
sed -n '130,230p' tests/e2e/terminal-multi-workspace-typing-latency.spec.ts
sed -n '450,530p' tests/e2e/terminal-multi-workspace-typing-latency.spec.ts
rg -n 'out/main/index.js|out/renderer/assets|orca-mwt-load-stats|writeBenchReport' tests/e2e config package.jsonRepository: stablyai/orca
Length of output: 13210
🏁 Script executed:
#!/bin/bash
set -e
printf '%s\n' '--- imports/constants/setup ---'
sed -n '1,145p' tests/e2e/terminal-multi-workspace-typing-latency.spec.ts
printf '%s\n' '--- report tail and all callers ---'
sed -n '225,375p' tests/e2e/terminal-multi-workspace-typing-latency.spec.ts
sed -n '525,665p' tests/e2e/terminal-multi-workspace-typing-latency.spec.ts
printf '%s\n' '--- hidden-load setup and cleanup symbols ---'
rg -n -C 5 'loadPanes|runId|scratch|startTyping|stopTyping|spawn|statsPath|writeFileSync|removeLoadReadyFiles|cleanup|globalSetup|SKIP_BUILD|process\.cwd|chdir' tests/e2e/terminal-multi-workspace-typing-latency.spec.ts tests/e2e/sustained-agent-typing-load-scripts.ts tests/e2e/global-setup.ts playwright.config.* package.json
printf '%s\n' '--- producer script ---'
sed -n '1,180p' tests/e2e/sustained-agent-typing-load-scripts.tsRepository: stablyai/orca
Length of output: 50369
🤖 get_repo_knowledge executed:
get_repo_knowledge stablyai/orca /tmp/coderabbit-repo-knowledge/stablyai-orca-89dc44e4/conventions /tmp/coderabbit-repo-knowledge/stablyai-orca-89dc44e4/learnings
Length of output: 14636
🏁 Script executed:
#!/bin/bash
set -e
printf '%s\n' '--- hidden-load caller ---'
sed -n '375,530p' tests/e2e/terminal-multi-workspace-typing-latency.spec.ts
printf '%s\n' '--- global setup ---'
sed -n '1,110p' tests/e2e/global-setup.ts
printf '%s\n' '--- benchmark launcher and package scripts ---'
sed -n '1,240p' config/scripts/run-multi-workspace-typing-bench.mjs
sed -n '1,90p' package.json
printf '%s\n' '--- e2e config references ---'
rg -n -C 4 'globalSetup|cwd|out/main|renderer/assets|SKIP_BUILD|run-multi-workspace-typing|multi-workspace-typing' tests/e2e config package.json --glob '!tests/e2e/terminal-multi-workspace-typing-latency.spec.ts'Repository: stablyai/orca
Length of output: 50370
🏁 Script executed:
#!/bin/bash
set -e
printf '%s\n' '--- saved log source sections ---'
sed -n '1,620p' /tmp/coderabbit-shell-logs/shell-output-wbMPmVRepository: stablyai/orca
Length of output: 40725
🏁 Script executed:
#!/bin/bash
set -e
sed -n '68,124p' tests/e2e/sustained-agent-typing-load-scripts.tsRepository: stablyai/orca
Length of output: 2728
Make writeBenchReport resilient to missing build artifacts.
writeBenchReport reads the build artifacts after measurement completes and before writeFileSync writes the report. The relative reads can throw when an artifact is absent. SKIP_BUILD checks only out/main/index.js, so it does not guarantee both paths. Resolve the paths from the repository root and record null for a missing artifact.
- mainSha256: createHash('sha256').update(readFileSync('out/main/index.js')).digest('hex'),
+ mainSha256: readBuildArtifactSha256('out/main/index.js'),
rendererAssetNamesSha256: createHash('sha256')
- .update(readdirSync('out/renderer/assets').sort().join('\n'))
- .digest('hex')
+ .update(readdirSync(path.resolve(__dirname, '..', '..', 'out/renderer/assets')).sort().join('\n'))
+ .digest('hex')Use the same missing-artifact handling for the renderer directory and return null instead of allowing report construction to abort.
| if (statusTrafficStarted) { | ||
| await stopAccumulatedStatusTraffic(electronApp, orcaPage) | ||
| } |
There was a problem hiding this comment.
🩺 Stability & Availability | 🟠 Major | ⚡ Quick win
Guard the status-traffic stop in finally so later cleanup still runs.
stopAccumulatedStatusTraffic can throw. It throws when the renderer probe is missing, and waitForStatusReceipts rejects on timeout. This call sits in the finally block before stopAccumulatedTitleTraffic, cleanupAccumulatedWorkspaceFixture, removeLoadReadyFiles, removeTypingLoadWorkspaces, and the scratch-directory removal. A throw here skips all of them and leaves created git worktrees and the temporary directory on disk. The instrumentation stop directly above already uses .catch(() => undefined).
🔒 Proposed fix
if (statusTrafficStarted) {
- await stopAccumulatedStatusTraffic(electronApp, orcaPage)
+ await stopAccumulatedStatusTraffic(electronApp, orcaPage).catch(() => undefined)
}📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| if (statusTrafficStarted) { | |
| await stopAccumulatedStatusTraffic(electronApp, orcaPage) | |
| } | |
| if (statusTrafficStarted) { | |
| await stopAccumulatedStatusTraffic(electronApp, orcaPage).catch(() => undefined) | |
| } |
Review found four assertions that could not fail and one fixture gap: - `missingPtyArrivalCount`/`missingEchoCount` were hardcoded `0` and `validateExpectedSeqs` throws before them, so every assertion on them was vacuous and every report read `0`. The throw is the real guard and is already covered; drop the vestigial fields. - An absent status controller returned an all-zero result, which satisfied its own accepted-equals-generated equality. Assert presence first. - The byte-pacing control had only an upper bound, so a generator emitting no stream bytes passed. Add the lower bound. - `lineageEvery: 1` built zero lineage: no ordinal satisfies `% 1 === 1`. Offset the interval and cover the densest setting. - The documented control command never set ORCA_TYPING_BENCH, so it skipped instead of running.
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes
This delta (2cfc0b3, "make the bench harness self-checks falsifiable") hardens the verification paths the prior review flagged; all four Pullfrog threads from that review are resolved.
- Fixed the fixture lineage interval —
lineageEvery: 1now builds every non-main worktree ((repoOrdinal - 1) % lineageEveryinstead ofrepoOrdinal % lineageEvery === 1), and a new unit test pins the densest setting (9 worktrees / 3 repos / interval 1 → 6 lineages). - Removed the always-zero missing counts —
missingPtyArrivalCount/missingEchoCountare gone fromPacedTypingMeasurement, along with everyexpect(...).toBe(0)site that could never fail; thevalidateExpectedSeqsthrow remains the guard, andinputHalfMs/totalMscounts carry the multi-workspace hang detector. - Made the byte-pacing test falsifiable — added a lower bound (
> 4 KiB * 2 * 0.8) so a generator emitting no stream bytes now fails. - Gave the status-traffic assertions signal —
generatedUpdates > 0/trackedStatuses > 0are asserted before theacceptedUpdates === generatedUpdates/latestReceipts === trackedStatusesequalities, so a controller that never started no longer reads as success. - Fixed the documented control command —
ORCA_TYPING_BENCH=1is now set, so following the doc actually runs the stall positive control instead of skipping it.
Verified locally: the three unit suites pass (15 tests), check:code-quality:changed reports 0 findings, and typecheck:e2e reports no errors in any changed file.
DeepSeek Flash (free via Pullfrog for OSS) | 𝕏
…i#20934) * test: reproduce accumulated-workspace typing latency through real PTYs * test: make the bench harness self-checks falsifiable Review found four assertions that could not fail and one fixture gap: - `missingPtyArrivalCount`/`missingEchoCount` were hardcoded `0` and `validateExpectedSeqs` throws before them, so every assertion on them was vacuous and every report read `0`. The throw is the real guard and is already covered; drop the vestigial fields. - An absent status controller returned an all-zero result, which satisfied its own accepted-equals-generated equality. Assert presence first. - The byte-pacing control had only an upper bound, so a generator emitting no stream bytes passed. Add the lower bound. - `lineageEvery: 1` built zero lineage: no ordinal satisfies `% 1 === 1`. Offset the interval and cover the densest setting. - The documented control command never set ORCA_TYPING_BENCH, so it skipped instead of running.

ELI5
Reproduce typing stalls with hundreds of saved workspaces and real background terminals, and verify that the measurement itself catches delays. This is benchmark-only machinery; the production fix is separate in #20931.
What Changed
Usage and limitations: terminal-typing-benchmark.md.
Why
This workload isolated the repeated notification-label scan fixed in #20931. Three matched runs measured planned-key-to-buffer p90 of 57–90 ms before versus 20–23 ms after; reverting the built output restored the slowdown. After correcting character-based stream pacing to bytes, another pair measured 85 → 24 ms p90 and 341 → 98 ms maximum. All 1,800 keys across nine unprofiled runs arrived and echoed.
This is not an exact captured user profile: selected renderer slices are ~2.16 MB, not the original ~10 MB durable state; editor tabs lack open-file records; native focus, foreground agent-TUI rendering, recovery-record persistence, and live remote topology remain outside this scenario. Buffer polling is not pixel-paint timing. Profiling/direct-IPC controls must not be conflated with acceptance runs. Those limits are documented rather than hidden behind fixture counts.
Linked Issue
Supports https://linear.app/stably/issue/STA-7551/urgent-live-terminal-typing-lag-isolate-input-from-workspace-wide
Visual Proof
Actual hidden Electron renderer after all 200 key echoes. This screenshot verifies the rendered workload, not latency; JSON reports carry the timings.
Testing
typecheck:e2eremains blocked by 217 pre-existing errors on this base; none reference changed files. This is documented, not reported as a passing check.Review
Draft to review the larger test machinery independently. No
src/production changes and no dependency on #20931: this branch reproduces the old behavior on its base. Benchmark files can be applied to the production-fix branch for before/after validation.Agent skill upstream boundary
Checklist