Skip to content

fix(#177): ESLint 9 flat config still descends into nested worker worktrees #180

Description

@rdfitted

Summary

PR #178 fixed #177 for eslintrc (ESLint 8) cascade mode by writing an inert {"root": true} boundary into the hive-owned directory above generated worktrees, which halts ESLint's upward config walk before it escapes into the parent repository.

That fixes the outward direction only. The inward direction is still broken and needs the worktree relocation deferred under #86.

The remaining problem

Worktrees live at <repo>/.hive-manager/worktrees/<sid>/<cell> — inside the parent repository tree (src-tauri/src/workspace/git.rs, create_session_worktree).

ESLint 9 flat config (eslint.config.js) does not cascade. Instead, a run at the repo root traverses downward from the project root, so npx eslint . in the parent repo will walk into .hive-manager/worktrees/** and lint every live worker's checkout — duplicating every file N times, reporting errors against code the operator is not editing, and slowing the run proportionally to the number of active sessions.

The root: true boundary from #178 does nothing here: it is an eslintrc-mode signal, and flat config ignores it. Flat config also dropped eslintrc's implicit dot-directory skip, so .hive-manager/ is not excluded by default.

Why a shim cannot fix it

Unlike the outward case, the inward case is controlled by the parent repo's own config, which hive-manager must not modify:

  • Excluding .hive-manager/** belongs in the operator's eslint.config.js ignores array — editing a tracked source file in their repository is out of scope for a worktree tool.
  • A .gitignore does not stop flat-config traversal.
  • There is no ancestor-file mechanism in flat config equivalent to root: true.

The durable fix is to stop nesting worktrees inside the repository at all — i.e. #86 / #177 Option A.

Blast radius of the real fix (why it was deferred)

Relocating worktrees outside the parent repo is not a path-constant change:

  • 23+ hardcoded .hive-manager/worktrees literals across four files.
  • It changes the meaning of the persisted session.worktree_path, so sessions launched before the change would resume into dangling paths on upgrade — a migration is required, not just a new path.
  • Task-file derivation (task_file_path_for_worker / task_file_path_for_session_worker), worktree cleanup (workspace/git.rs), prompt boundary rules, prompt-file routing (<worktree>/.hive-manager/prompts/) and artifact collection all assume the nested layout.
  • It splits the control plane away from the worktrees, which needs a location policy of its own.

Interim guidance

For ESLint 9 flat-config repos, add to the project's own eslint.config.js:

{ ignores: ['.hive-manager/**'] }

Acceptance criteria

  • In an ESLint 9 flat-config repo with live worker worktrees, a lint run at the repo root does not traverse into worker checkouts.
  • Existing sessions with a persisted nested worktree_path still resume correctly (migration, not just a new default).
  • Worktree lifecycle still passes end to end: create, task-file resolution, boundary rules, artifact collection, cleanup on session close.

Related: #86 (worker autonomy umbrella / task file location), #177, PR #178.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions