Skip to content

Prevent duplicate agents widget during migration - #7400

Open
mdenesfe wants to merge 2 commits into
basecamp:quattrofrom
mdenesfe:fix/7128-prevent-duplicate-agents-widget
Open

Prevent duplicate agents widget during migration#7400
mdenesfe wants to merge 2 commits into
basecamp:quattrofrom
mdenesfe:fix/7128-prevent-duplicate-agents-widget

Conversation

@mdenesfe

Copy link
Copy Markdown

Fixes #7128.

An unmarked installation can already contain the former
omarchy.model-usage widget when the agents-widget migration runs. That
migration only checked for omarchy.agents, so it added a new entry. The later
rename migration then converted the former entry to the same id, leaving two
omarchy.agents widgets.

This makes the placement migration recognize both the current and former widget
ids before adding anything.

The regression test runs the placement and rename migrations in sequence and
verifies that exactly one omarchy.agents widget remains.

Tested with:

  • bash test/shell.d/agents-default-migration-test.sh
  • bash test/shell.d/agents-rename-migration-test.sh
  • Bash syntax checks for the changed migration and test
  • git diff --check

Copilot AI balanced review requested due to automatic review settings August 18, 2026 16:39

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

Updates the agents default migration to account for a prior widget ID rename and extends shell migration tests to prevent duplicate widgets across sequential migrations.

Changes:

  • Treat omarchy.model-usage as equivalent-to-present when deciding whether to add omarchy.agents.
  • Add a test case covering the pre-rename widget ID and the rename-migration sequence behavior.
  • Stub omarchy-agent-usage-update in the shell test harness to support the rename migration.

Reviewed changes

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

File Description
test/shell.d/agents-default-migration-test.sh Adds a regression test ensuring migration + rename migration results in exactly one agents widget.
migrations/1785344985.sh Updates the “already has widget” check to include the former widget ID to avoid duplicates.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.


[[ $(ids center) == *'"omarchy.model-usage"'* ]] || fail "migration leaves the former widget id alone" "$(ids center)"
[[ $(ids right) != *'"omarchy.agents"'* ]] || fail "migration does not add an agents copy beside the former widget id" "$(ids right)"
HOME="$home" PATH="$test_dir/bin:$PATH" bash -euo pipefail "$rename_migration" >/dev/null
require_command jq

migration="$ROOT/migrations/1785344985.sh"
rename_migration="$ROOT/migrations/1786099804.sh"
…utable files, so an `-x` assertion would fail for valid migrations. The parameterized helper now provides the same invocation path for both migrations.
Copilot AI review requested due to automatic review settings August 18, 2026 16:46

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated no new comments.

Suppressed comments (2)

migrations/1785344985.sh:40

  • The comment now underspecifies the behavior: the migration considers both the current widget id (omarchy.agents) and the legacy id (omarchy.model-usage) as ‘already present’. Please update the comment to reflect that the insertion is skipped if either id is found, so future changes don’t accidentally regress the rename-migration interaction.
    # Respect a bar the user already curated: only place the widget when it is
    # absent from every section, never a second copy.
    if has_widget("omarchy.agents") or has_widget("omarchy.model-usage") then

test/shell.d/agents-default-migration-test.sh:94

  • These assertions use substring matching against a JSON-encoded array, which can lead to false positives/negatives (and makes failures harder to interpret). Prefer asserting structurally with jq (similar to the length check used later in the test), e.g., by checking membership with index(...) or by counting exact matches for the id in the parsed list.
[[ $(ids center) == *'"omarchy.model-usage"'* ]] || fail "migration leaves the former widget id alone" "$(ids center)"
[[ $(ids right) != *'"omarchy.agents"'* ]] || fail "migration does not add an agents copy beside the former widget id" "$(ids right)"

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.

The agents widget can be added to the bar twice, permanently

2 participants