dedup: import _load_env from helpers + add dupehound CI - #1
Conversation
admin.py and daemon.py each defined _load_env and _load_env_file identically (admin.py: 12-30, daemon.py: 10-28). Both now import from helpers.py, which is the canonical source (was already exporting both via module-level _load_env() side effect). CI: - .github/workflows/dupehound.yml: scan (slop score) and check (--diff against base) jobs. check is continue-on-error for now; promote to gate after FP rate <10% over ~10 PRs. Slop score: 0.9% -> 0.0% (4 -> 0 clusters, 18 lines eliminated). 40/40 unit tests pass.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 61ded7f691
ℹ️ 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".
|
|
||
|
|
||
| _load_env() | ||
| from .helpers import _load_env, _load_env_file |
There was a problem hiding this comment.
Avoid importing helper side effects from admin
Importing .helpers here immediately runs its module-level _load_agent_helpers(), so agent-workspace/agent_helpers.py is executed while browser_harness.admin is only partially initialized. If a task helper imports an admin API such as from browser_harness.admin import start_remote_daemon, the CLI now fails with a circular-import ImportError before any command runs; this worked before because run.py loaded admin before loading helpers. Move the env loader to a side-effect-free module or defer agent-helper loading to the CLI helper path.
Useful? React with 👍 / 👎.
Summary
First pass of
dupehoundintegration: import_load_envfrom the existing canonical source inhelpers.py, and add the CI workflow from upstreamdocs/ci.md.Changes
Source
src/browser_harness/admin.py: remove local_load_envand_load_env_filedefinitions, import fromhelpers(was duplicated, identical 18-line body atadmin.py:12-30).src/browser_harness/daemon.py: same change (was duplicated atdaemon.py:10-28).helpers.pywas already the canonical source — both_load_envand_load_env_filewere defined there, and module-level_load_env()was called as a side effect on import.CI
.github/workflows/dupehound.yml:scan(slop score) andcheck(--diffagainst base) jobs.checkruns withcontinue-on-error: true— promote to gate after FP rate <10% over ~10 PRs.Metrics
Validation
pytest tests/unit/: 40/40 passdupehound check --diff fork/main .on this branch: clean (no new duplicates introduced)