test(term-fidelity): harden opencode readiness + isolate opencode data dir#418
Conversation
…a dir The opencode leg of the real-agent matrix intermittently failed at startup with "opencode startup did not reach TF_OPENCODE_READY" (a blank/idle home screen). Direct probes localized it: opencode's OpenTUI takes several seconds to accept input after launch (MCP init, fs watcher / location services, and a scan of the user's global skill + config trees), while the broker injects the readiness task once at spawn. An injection that lands before opencode's input is live is silently dropped, and opencode then idles at its home screen until the 90s readiness deadline. Standalone, opencode renders and completes the readiness model turn reliably (replies in 2-5s), so this is purely an injection/boot race, not a renderer or model-backend fault. Two opencode-scoped harness changes (no other CLI's path is touched): 1. Boot re-nudge: once the home screen is up and the marker is still absent past a grace window, re-submit the idempotent readiness prompt on an interval until the marker appears. It runs strictly before any workload and stops the instant the marker shows, so it cannot bleed into or mask the typing-during-stream observation that follows. 2. XDG_DATA_HOME isolation: give opencode a fresh, empty data dir under the harness run root (auth.json copied across; the model cache in XDG_CACHE_HOME is untouched). Independent hygiene win: the matrix was otherwise writing test sessions into the operator's real, shared ~/.local/share/opencode/opencode.db. Not a #417 fix — this only makes the harness reach a live-input opencode deterministically so the divergence hunt has a trustworthy denominator. Verification: - Forced-drop (broker delivers an empty task, i.e. the injection is fully dropped): the re-nudge alone drives opencode to readiness and the typing-during-stream workload passes. - lsof: the harness opencode holds only the isolated empty DB and never opens the shared one. - Happy path: normal runs still reach readiness and pass with no spurious nudge. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
Warning You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again! |
|
Warning Review limit reached
Next review available in: 6 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
✨ Finishing Touches🧪 Generate unit tests (beta)
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 |
|
Warning You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again! |
|
Bugbot is not enabled for your account, so this pull request was not reviewed. Enable Bugbot in the Cursor dashboard to get automatic reviews on future PRs. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 4c25f60f47
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| OPENCODE_HOME_HINT.test(lastScreen) && | ||
| Date.now() - startedAt >= READINESS_NUDGE_GRACE_MS && | ||
| Date.now() - lastNudgeAt >= READINESS_NUDGE_INTERVAL_MS | ||
| ) { | ||
| await submitPrompt(terminal, readinessNudge) |
There was a problem hiding this comment.
Restrict re-nudges to OpenCode's idle composer
When the initial readiness turn takes longer than the 6-second grace period, this condition can submit another prompt while that turn is still streaming: ctrl+p is a persistent OpenCode footer hint rather than an idle-only signal. Additional nudges can therefore be queued every eight seconds; once the first response prints the marker, startup returns and begins the terminal-fidelity workloads while a duplicate readiness turn remains queued or active, contaminating their PTY streams and results. Gate the nudge on a state that proves OpenCode is idle rather than on this footer text.
Useful? React with 👍 / 👎.
What
Two opencode-scoped hardening changes to the real-agent terminal-fidelity matrix harness. Not a #417 fix — this makes the harness reach a live-input opencode deterministically so the divergence hunt has a trustworthy denominator. Keeps the #417 divergence investigation epistemically separate.
Why
The opencode leg intermittently failed at startup with
opencode startup did not reach TF_OPENCODE_READY(a blank/idle home screen). Direct probes localized the cause:Separately, the matrix opencode was writing test sessions into the operator's real, shared
~/.local/share/opencode/opencode.db(multi-GB) — a hygiene problem regardless of the flake.Changes (opencode only; other CLIs untouched)
workloads.ts): once the home screen is up and the marker is still absent past a grace window, re-submit the idempotent readiness prompt on an interval until the marker appears. Runs strictly before any workload and stops the instant the marker shows, so it cannot bleed into / mask the typing-during-stream observation.XDG_DATA_HOMEisolation (harness.ts): give opencode a fresh, empty data dir under the harness run root (auth.json copied across; model cache inXDG_CACHE_HOMEuntouched). Removes shared-DB contention and stops polluting the operator's real opencode history.Verification
tsc -p tests/term-fidelity/tsconfig.json).🤖 Generated with Claude Code