Prevent duplicate agents widget during migration - #7400
Open
mdenesfe wants to merge 2 commits into
Open
Conversation
Contributor
There was a problem hiding this comment.
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-usageas equivalent-to-present when deciding whether to addomarchy.agents. - Add a test case covering the pre-rename widget ID and the rename-migration sequence behavior.
- Stub
omarchy-agent-usage-updatein 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.
Contributor
There was a problem hiding this comment.
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)"
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #7128.
An unmarked installation can already contain the former
omarchy.model-usagewidget when the agents-widget migration runs. Thatmigration only checked for
omarchy.agents, so it added a new entry. The laterrename migration then converted the former entry to the same id, leaving two
omarchy.agentswidgets.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.agentswidget remains.Tested with:
bash test/shell.d/agents-default-migration-test.shbash test/shell.d/agents-rename-migration-test.shgit diff --check