chore(dev): replace chrome worktree symlink with stable agent-browser e2e harness#1014
Conversation
📝 WalkthroughWalkthroughThe PR removes per-worktree Chrome symlink auto-activation, adds Changese2e-browser workflow migration
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 inconclusive)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
|
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
… e2e harness
The ~/.config/lobu-dev/active/chrome symlink swap (task-use.sh) never worked:
Chrome canonicalizes the unpacked-extension path at load time and reloads from
that captured real path, so retargeting the symlink was a no-op. Remove it.
Replace with `make e2e-browser` (scripts/e2e-browser.sh): launches/reuses a
stable agent-browser session ("owletto") with a persistent profile
(~/.config/lobu-dev/chrome) and --extension pointed at the current worktree.
The extension's fixed manifest key pins its ID across worktrees, so
chrome.storage.local (gateway URL + auth) persists — pair once, reuse from any
agent session, like the installed Mac app. agent-browser's CDP-launched Chrome
also isn't subject to Google Chrome stable's --load-extension gating.
- delete scripts/task-use.sh; drop its calls from task-setup.sh/task-clean.sh
- remove the `task-use` Makefile target, add `e2e-browser`
- document the Chrome/Mac e2e approach in AGENTS.md
eb9263e to
be15550
Compare
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@scripts/e2e-browser.sh`:
- Around line 74-75: The agent-browser launch is currently masked by "|| true",
hiding failures; remove the "|| true" from the agent-browser invocation and
instead capture its exit status (e.g., check $? or use set -e) so failures cause
the script to fail or be handled explicitly; only print the success message ("->
launched '$session'") when the agent-browser command actually succeeded, and
apply the same fix to the similar launch block around lines 80-84 to avoid
misleading success output.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: 03f16474-ac1b-4c35-830f-176b8fe727eb
📒 Files selected for processing (6)
AGENTS.mdMakefilescripts/e2e-browser.shscripts/task-clean.shscripts/task-setup.shscripts/task-use.sh
💤 Files with no reviewable changes (2)
- scripts/task-use.sh
- scripts/task-setup.sh
| agent-browser --session "$session" --profile "$profile" --extension "$ext" --headed open "$url" >/dev/null 2>&1 || true | ||
| echo "-> launched '$session'" |
There was a problem hiding this comment.
Do not swallow browser launch failures on the main launch path.
At Line 74, || true masks startup failures, but Lines 80-84 still print success. This can mislead e2e runs into proceeding without a real harness.
Proposed fix
- agent-browser --session "$session" --profile "$profile" --extension "$ext" --headed open "$url" >/dev/null 2>&1 || true
+ if ! agent-browser --session "$session" --profile "$profile" --extension "$ext" --headed open "$url" >/dev/null 2>&1; then
+ echo "error: failed to launch '$session' with extension/profile" >&2
+ exit 1
+ fi
echo "-> launched '$session'"
echo " profile: $profile"
echo " extension: $ext"
fiAlso applies to: 80-84
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@scripts/e2e-browser.sh` around lines 74 - 75, The agent-browser launch is
currently masked by "|| true", hiding failures; remove the "|| true" from the
agent-browser invocation and instead capture its exit status (e.g., check $? or
use set -e) so failures cause the script to fail or be handled explicitly; only
print the success message ("-> launched '$session'") when the agent-browser
command actually succeeded, and apply the same fix to the similar launch block
around lines 80-84 to avoid misleading success output.
There was a problem hiding this comment.
♻️ Duplicate comments (1)
scripts/e2e-browser.sh (1)
86-90:⚠️ Potential issue | 🔴 Critical | ⚡ Quick winBrowser launch failure is still masked by
|| true.This issue was previously flagged in the past review. Line 86's
|| truesuppresses the launch failure, but lines 87-90 still report success, misleading e2e runs into proceeding without a working browser harness.🐛 Proposed fix
- agent-browser --session "$session" --profile "$profile" --extension "$ext" --headed open "$url" >/dev/null 2>&1 || true + if ! agent-browser --session "$session" --profile "$profile" --extension "$ext" --headed open "$url" >/dev/null 2>&1; then + echo "error: failed to launch '$session' with extension/profile" >&2 + exit 1 + fi echo "-> launched '$session'" echo " profile: $profile" echo " extension: $ext"Note: Line 84 (reuse path) is intentionally non-fatal per the comment on line 83, since a down gateway shouldn't fail the script when the browser is already verified running.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@scripts/e2e-browser.sh` around lines 86 - 90, The agent-browser launch is being masked by the trailing "|| true" which hides failures while the subsequent echo lines still report success; update the agent-browser invocation (the command that starts with "agent-browser --session \"$session\" --profile \"$profile\" --extension \"$ext\" --headed open \"$url\"") to remove "|| true" and instead check its exit status: if it fails, log an explicit error and exit non‑zero so the script stops (or otherwise handle the failure path), while keeping the reuse-path behavior mentioned earlier non‑fatal as intended; ensure the success echo lines only run when the agent-browser command actually succeeded.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Duplicate comments:
In `@scripts/e2e-browser.sh`:
- Around line 86-90: The agent-browser launch is being masked by the trailing
"|| true" which hides failures while the subsequent echo lines still report
success; update the agent-browser invocation (the command that starts with
"agent-browser --session \"$session\" --profile \"$profile\" --extension
\"$ext\" --headed open \"$url\"") to remove "|| true" and instead check its exit
status: if it fails, log an explicit error and exit non‑zero so the script stops
(or otherwise handle the failure path), while keeping the reuse-path behavior
mentioned earlier non‑fatal as intended; ensure the success echo lines only run
when the agent-browser command actually succeeded.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: 3d5bd84f-6c9d-4796-b4ed-4f370a1d8349
📒 Files selected for processing (6)
AGENTS.mdMakefilescripts/e2e-browser.shscripts/task-clean.shscripts/task-setup.shscripts/task-use.sh
💤 Files with no reviewable changes (2)
- scripts/task-use.sh
- scripts/task-setup.sh
✅ Files skipped from review due to trivial changes (1)
- AGENTS.md
What
Retire the
~/.config/lobu-dev/active/chromesymlink-swap dev flow (task-use.sh) and replace it with a stable agent-browser-managed Chrome harness for Owletto e2e.Why
The symlink swap never actually worked. Chrome canonicalizes the unpacked-extension path when you "Load unpacked", and reloads from that captured real path — it never re-resolves the symlink. So
task-use's retarget was a no-op; the extension stayed pinned to whichever worktree was active at first load.How
make e2e-browser(scripts/e2e-browser.sh) launches or reuses a stable agent-browser session namedowlettowith:~/.config/lobu-dev/chrome--extensionpointed at the current worktree'sapps/chromesourceThe extension's fixed manifest
keypins its ID regardless of load path, sochrome.storage.local(gateway URL + access/refresh tokens) persists in the profile and carries across worktrees — pair once, reuse from any agent session, mirroring the installed Mac app. agent-browser's CDP-launched Chrome also sidesteps Google Chrome stable's--load-extensiongating.Drive it from any session:
agent-browser --session owletto <cmd>;RESTART=1to pick up source/worktree changes.Changes
scripts/task-use.sh; drop its calls fromtask-setup.sh/task-clean.shtask-useMakefile target, adde2e-browserAGENTS.mdValidation
bash -n;make helplistse2e-browser, notask-use; zero residual refsmake e2e-browserlaunches theowlettosession, loads + enables the extension (verified via screenshot ofchrome://extensions), creates the persistent profile, and reuses on a second runchrome.storage.locallands underDefault/Local Extension Settings/<fixed-id>in the profileNo TS/product code touched (shell + Makefile + docs only).
Summary by CodeRabbit
New Features
Documentation
Chores