Skip to content

fix(browser): harden bridge and sync REPL template#220

Open
yangshu2087 wants to merge 6 commits intoHKUDS:mainfrom
yangshu2087:fix/browser-repl-and-template-sync
Open

fix(browser): harden bridge and sync REPL template#220
yangshu2087 wants to merge 6 commits intoHKUDS:mainfrom
yangshu2087:fix/browser-repl-and-template-sync

Conversation

@yangshu2087
Copy link
Copy Markdown

@yangshu2087 yangshu2087 commented Apr 15, 2026

Summary

  • Harden browser bridge/session persistence and unify error handling.
  • Sync the canonical REPL skin across all CLI-Anything harnesses.
  • Add a reusable PR verification workflow for browser changes.

Verification

Notes

  • The workflow now uses workflow_dispatch + pull_request and no longer contains a branch-specific push trigger.
  • The PR is split into focused commits for easier review:
    • 881f1fb fix(browser): harden bridge and session persistence
    • d653b77 refactor(repl-skin): sync canonical template across harnesses
    • 7df2bcd ci: add pull request verification workflow
    • e45f6e3 ci: run verification workflow on fork pushes
    • 22a5634 ci: install browser harness dev dependencies in PR CI
    • fd535a2 ci: remove branch-specific push trigger from PR workflow

@yangshu2087
Copy link
Copy Markdown
Author

Fork-side PR CI is now green on the latest push.

Fixes included in the latest commit:

  • install browser harness dev dependencies before running tests

Note: the upstream PR currently shows no native status checks because the CI workflow was added in this branch; it will become available on the base repo after merge.

@yuh-yang
Copy link
Copy Markdown
Collaborator

Overall this PR is not focused and is containing too many things as the author also said. Here are my comments:

  • the fix for browser CLI is very useful 👍.
  • seems the CIs are only for the browser thing? If so, it would be triggered very infrequently.
  • what's the purpose of changing repl skin?

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR hardens the browser harness’ DOMShell/daemon integration (including session persistence + unified tool-result error detection), and synchronizes the canonical ReplSkin template across harnesses while adding a PR verification workflow.

Changes:

  • Add browser tool-result normalization/error heuristics and use them to gate session updates + improve CLI output.
  • Persist browser session state to disk when daemon mode is active (and auto-load when a daemon is already running).
  • Sync repl_skin.py across many harnesses and add a PR CI workflow that compiles skins + runs browser unit tests.

Reviewed changes

Copilot reviewed 50 out of 50 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
zotero/agent-harness/cli_anything/zotero/utils/repl_skin.py Sync REPL skin banner/prompt/help/goodbye to the canonical template.
zoom/agent-harness/cli_anything/zoom/utils/repl_skin.py Sync REPL skin template; adjust accent map + init signature.
wiremock/agent-harness/cli_anything/wiremock/utils/repl_skin.py Sync REPL skin template; minor table separator change.
videocaptioner/agent-harness/cli_anything/videocaptioner/utils/repl_skin.py Sync REPL skin template; init signature + accent map changes.
slay_the_spire_ii/agent-harness/cli_anything/slay_the_spire_ii/utils/repl_skin.py Sync REPL skin template (banner/prompt/help/goodbye).
shotcut/agent-harness/cli_anything/shotcut/utils/repl_skin.py Sync REPL skin template; add skill_path auto-detect param.
seaclip/agent-harness/cli_anything/seaclip/utils/repl_skin.py Sync REPL skin template; init signature + accent map changes.
rms/agent-harness/cli_anything/rms/utils/repl_skin.py Sync REPL skin template; remove extra accent entries.
renderdoc/agent-harness/cli_anything/renderdoc/utils/repl_skin.py Sync REPL skin template (banner/prompt/help/goodbye).
pm2/agent-harness/cli_anything/pm2/utils/repl_skin.py Sync REPL skin template; init signature + accent map changes.
openscreen/agent-harness/cli_anything/openscreen/utils/repl_skin.py Sync REPL skin template; removes sub_input (breaking change).
ollama/agent-harness/cli_anything/ollama/utils/repl_skin.py Sync REPL skin template; init signature + accent map changes.
obsidian/agent-harness/cli_anything/obsidian/utils/repl_skin.py Sync REPL skin template; init signature + accent map changes.
obs-studio/agent-harness/cli_anything/obs_studio/utils/repl_skin.py Sync REPL skin template; add skill_path auto-detect param.
musescore/agent-harness/cli_anything/musescore/utils/repl_skin.py Sync REPL skin template; add skill_path auto-detect param.
mubu/agent-harness/cli_anything/mubu/utils/repl_skin.py Sync REPL skin template (banner/prompt/help/goodbye).
libreoffice/agent-harness/cli_anything/libreoffice/utils/repl_skin.py Sync REPL skin template; add skill_path auto-detect param.
krita/agent-harness/cli_anything/krita/utils/repl_skin.py Sync REPL skin template; remove krita-specific accent entries.
kdenlive/agent-harness/cli_anything/kdenlive/utils/repl_skin.py Sync REPL skin template; add skill_path auto-detect param.
iterm2/agent-harness/cli_anything/iterm2_ctl/utils/repl_skin.py Sync REPL skin template (banner/prompt/help/goodbye).
intelwatch/agent-harness/cli_anything/intelwatch/utils/repl_skin.py Sync REPL skin template; add skill_path auto-detect param.
inkscape/agent-harness/cli_anything/inkscape/utils/repl_skin.py Sync REPL skin template; add skill_path auto-detect param.
godot/agent-harness/cli_anything/godot/utils/repl_skin.py Sync REPL skin template (banner/prompt/help/goodbye).
gimp/agent-harness/cli_anything/gimp/utils/repl_skin.py Sync REPL skin template; add skill_path auto-detect param.
freecad/agent-harness/cli_anything/freecad/utils/repl_skin.py Sync REPL skin template; remove freecad-specific accent entries.
exa/agent-harness/cli_anything/exa/utils/repl_skin.py Sync REPL skin template (banner/prompt/help/goodbye).
eth2-quickstart/agent-harness/cli_anything/eth2_quickstart/utils/repl_skin.py Sync REPL skin template; add skill_path auto-detect param.
drawio/agent-harness/cli_anything/drawio/utils/repl_skin.py Sync REPL skin template; init signature + accent map changes.
dify-workflow/agent-harness/cli_anything/dify_workflow/utils/repl_skin.py Sync REPL skin template (banner/prompt/help/goodbye).
cloudcompare/agent-harness/cli_anything/cloudcompare/utils/repl_skin.py Sync REPL skin template (banner/prompt/help/goodbye).
cloudanalyzer/agent-harness/cli_anything/cloudanalyzer/utils/repl_skin.py Sync REPL skin template (banner/prompt/help/goodbye).
chromadb/agent-harness/cli_anything/chromadb/utils/repl_skin.py Sync REPL skin template; init signature + accent map changes.
cli-anything-plugin/repl_skin.py Update canonical REPL skin banner/prompt/help/goodbye to “compact” output.
browser/agent-harness/cli_anything/browser/utils/tool_result.py New shared normalization + error/body text extraction helpers for tool results.
browser/agent-harness/cli_anything/browser/utils/repl_skin.py Sync browser REPL skin to canonical template.
browser/agent-harness/cli_anything/browser/core/session.py Add persisted session snapshot load/save with atomic write.
browser/agent-harness/cli_anything/browser/core/page.py Use daemon if running; only mutate session state when tool call succeeded.
browser/agent-harness/cli_anything/browser/core/fs.py Use daemon if running; add ls preflight; unify error detection for cd.
browser/agent-harness/cli_anything/browser/browser_cli.py Load persisted session when daemon is running; unify output + error handling.
blender/agent-harness/cli_anything/blender/utils/repl_skin.py Sync REPL skin template; add skill_path auto-detect param.
audacity/agent-harness/cli_anything/audacity/utils/repl_skin.py Sync REPL skin template; add skill_path auto-detect param.
anygen/agent-harness/cli_anything/anygen/utils/repl_skin.py Sync REPL skin template; init signature + accent map changes.
adguardhome/agent-harness/cli_anything/adguardhome/utils/repl_skin.py Sync REPL skin template; add skill_path auto-detect param.
README.md Link to REPL skin maintenance documentation.
.github/workflows/pr-ci.yml Add PR CI workflow to compile skins and run browser unit tests.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +352 to 354
sep_parts = [self._c(_DARK_GRAY, _H_LINE * w) for w in col_widths]
sep_line = self._c(_DARK_GRAY, f" {'───'.join([_H_LINE * w for w in col_widths])}")
print(sep_line)
Copy link

Copilot AI Apr 17, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sep_parts is computed but never used, which makes this separator-building block misleading. Either use sep_parts to build sep_line or remove the unused variable to avoid confusion.

Copilot uses AI. Check for mistakes.
Comment on lines 429 to 434
raw_prompt = self.prompt(project_name, modified, context)
return input(raw_prompt).strip()

# ── Sub-prompt input ────────────────────────────────────────────

def sub_input(self, prompt_text: str, pt_session=None) -> str:
"""Get input for a sub-prompt (e.g., parameter entry in add flows).

Uses prompt_toolkit if a session is available, otherwise falls back
to plain input(). This preserves history and styling consistency.

Args:
prompt_text: The prompt to display (e.g., " start_ms: ").
pt_session: An optional prompt_toolkit PromptSession.

Returns:
User input string (stripped).
"""
if pt_session is not None:
return pt_session.prompt(prompt_text).strip()
else:
return input(prompt_text).strip()

# ── Toolbar builder ───────────────────────────────────────────────

def bottom_toolbar(self, items: dict[str, str]):
Copy link

Copilot AI Apr 17, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ReplSkin.sub_input() was removed here, but openscreen_cli.py still calls skin.sub_input(...) in multiple REPL flows. This will raise AttributeError at runtime. Either restore sub_input() in the skin (preferred if it’s part of the canonical skin API) or update openscreen_cli.py to use an existing input helper (e.g., get_input() / pt_session.prompt() / input()).

Copilot uses AI. Check for mistakes.
Comment on lines +160 to +161
tip = "Type help for commands, quit to exit"
print(title)
Copy link

Copilot AI Apr 17, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

skill_path is still auto-detected and documented as being “Displayed in banner”, but print_banner() no longer prints it. This makes the skill_path feature effectively invisible to users/agents and contradicts the surrounding docstrings/HARNESS guidance. Either include the skill path (or at least its basename) in the compact banner output, or remove/adjust the skill_path parameter + documentation so the API matches the behavior.

Suggested change
tip = "Type help for commands, quit to exit"
print(title)
tip = "Type help for commands, quit to exit"
skill_path = getattr(self, "skill_path", "")
print(title)
if skill_path:
skill_name = os.path.basename(os.path.normpath(skill_path))
print(f"Skill: {skill_name}")

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants