Skip to content

herdr: optional per-home workspace label (config/herdr-workspace-label)#418

Open
thevwick wants to merge 1 commit into
kunchenguid:mainfrom
thevwick:fm/herdr-label-knob
Open

herdr: optional per-home workspace label (config/herdr-workspace-label)#418
thevwick wants to merge 1 commit into
kunchenguid:mainfrom
thevwick:fm/herdr-label-knob

Conversation

@thevwick

Copy link
Copy Markdown

Motivation

On a machine running several primary firstmate homes (e.g. one hub per company/context), every primary derives the same constant herdr workspace label (firstmate) in fm_backend_herdr_workspace_label (bin/backends/herdr.sh). All hubs' task tabs therefore co-mingle in one herdr workspace.

This is exactly the mixing problem the P3 workspace-per-home pass already solved for secondmates (2ndmate-<id> labels); docs/herdr-backend.md documents that P2 "assumed a single firstmate instance per herdr session". This change extends the same per-home idea to primaries, opt-in, with zero behavior change for existing single-home setups.

Design

  • New OPTIONAL local, gitignored file config/herdr-workspace-label. Its first non-empty line is the workspace label this home's herdr task tabs use.
  • Read in fm_backend_herdr_workspace_label via the effective config dir, respecting FM_CONFIG_OVERRIDE / FM_HOME exactly like fm-backend.sh reads config/backend.
  • Sanitized: the line is trimmed of surrounding whitespace, then a value that still contains interior whitespace or a colon (the target-string <session>:<pane-id> field separator), or that matches the reserved 2ndmate-* secondmate namespace, is rejected with a stderr warning and falls back to firstmate.
  • Secondmate homes ignore the file entirely: their marker-derived 2ndmate-<secondmate-id> labels are already unique.
  • Deliberately NOT added to the inheritable-config set (bin/fm-config-inherit-lib.sh): it is per-home by nature, like config/backend.

Zero-default-change guarantee

Absent or empty config/herdr-workspace-label means the constant firstmate, byte-for-byte. A single-home setup, and every existing task's recorded label, is unchanged.

P3 secondmate-label precedent

This extends the existing workspace-per-home mechanism: the P3 pass gave each secondmate home a distinct 2ndmate-<id> workspace to stop tab co-mingling across homes. Primaries had no equivalent knob and all defaulted to firstmate. This adds that knob for primaries, following the same find-before-create adapter conventions.

Changes

  • bin/backends/herdr.sh - the label function honors the override for primaries.
  • tests/fm-backend-herdr.test.sh - override respected; absent/empty = constant firstmate; secondmate marker still wins and ignores the override; whitespace/colon/reserved labels rejected with fallback.
  • docs/herdr-backend.md - "Label derivation" section updated.
  • docs/configuration.md - the new file documented alongside the other config/ files.
  • AGENTS.md section 2 layout - one-line entry for config/herdr-workspace-label.

A machine running several primary firstmate homes has every primary derive
the same constant firstmate herdr workspace label, so all their task tabs
co-mingle in one workspace. Add an optional local, gitignored
config/herdr-workspace-label whose first non-empty line overrides that label
for a primary home, extending the P3 secondmate workspace-per-home idea to
primaries. Absent or empty keeps firstmate byte-for-byte; secondmate homes
ignore it; whitespace, colon, and reserved 2ndmate-* values fall back with a
warning. Per-home, not inherited by secondmate homes.
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.

1 participant