Repository navigation
feat(skills): the untouched default source follows the bundled pin on upgrade (abilityai/trinity-enterprise#529) - #4091
Conversation
… upgrade (Abilityai/trinity-enterprise#529) The bundled community source was seeded on fresh installs only, so an existing install stayed on the tag it was born with. Now, at backend start and before the skills auto-sync loop, the seeded default moves to a newer DEFAULT_SKILL_SOURCE_REF while it still points where the seed put it. - Marker `skill_sources.follows_bundled_pin`: set by the seed for the built-in catalog URL only; cleared by update_source when url, ref or ref_type changes (PUT, apply / MCP). Disable pauses; rename and priority never opt out. Rows seeded earlier are backfilled by one SQL statement shared by both migration tracks. - Forward only on strict vX.Y.Z. A compare-and-set UPDATE with every eligibility predicate in its WHERE, so it's safe across workers. Goes through the same retarget reset as an admin ref edit, so the next sync isn't refused as moved_tag and counts as a moved commit (ent#236 fleet re-inject). - A system audit row `skill_source_follow_bundled_pin`, plus followed_from_ref / followed_at on the row. Settings -> Library shows "Followed bundled pin vA -> vB on <date>" under the status line (after the error line when a sync failed). - record_sync writes only while the row still points at the url/ref/ ref_type the sync fetched. Otherwise a sync in flight across a retarget stamps the old commit onto the new ref, and every later sync is refused as moved_tag. - Migration on both tracks: SQLite skill_sources_follow_bundled_pin and Alembic 0107_skill_sources_follow_bundled_pin on 0106 (ADD COLUMN IF NOT EXISTS). Tests: tests/unit/test_ent529_follow_bundled_pin.py (53, real git with annotated tags, both clone paths, the race, the backfill) and skillSourcesFollowLine.mount.spec.js. Mutation-checked: removing the marker clear (4 tests go red), the follow reset (5), the sync scoping (1), the boot hook (1), the seed marker (14), the forward check (1) or the backfill audit filter (4). Co-Authored-By: Claude Opus 5.5 <[email protected]>
…y-enterprise#529) Findings from the full /review of #4091, fixed with failing tests first: - The per-source Sync route recorded a moved commit without starting the fleet re-inject. That spent the moved-commit signal, so the next full or scheduled sync saw nothing to propagate, and running agents kept the old tag's skills until they restarted. After a boot follow, the row's own Sync button is the likely click. Both manual sync routes now share `_start_fleet_reinject_if_moved`; the MCP sync_skill_source description says so. The user doc step that warned against per-row Sync is rewritten. - update_source decided "did the target change?" from a read and wrote by id. A save naming the old ref that landed across the boot follow put the tag back while keeping the follow's marker and record. It now writes only over the url/ref/ref_type it read, and re-reads and re-decides on a miss (bounded; the read happens after the commit). - Every compare-and-set condition of the follow is now pinned by a direct refusal test. Removing any one of the seven turns a test red. - Docs: - .env.example now says the REF var also moves an untouched existing install forward. - A re-enabled row moves at the next backend start. - The panel's path is Settings -> Agents -> Skills Library. - The backfill comment covers declarative apply. - A learnings fragment for the consumed-signal class; the late-write fragment is extended. Mutation-checked: removing the update_source scoping (1 test red), the row route's re-inject (3), the full route's re-inject (1), or any one compare-and-set condition (1-2 each). Co-Authored-By: Claude Opus 5.5 <[email protected]>
dolho
left a comment
There was a problem hiding this comment.
Reviewed at 8e58a36c18c915e331adde0cbf822b0ab1684921.
Approve. The "untouched" decision holds up on every path I could reach. The seed sets the marker only for the built-in URL. Every admin write that changes url, ref or ref_type clears it inside update_source, which covers PUT, apply and MCP, so no router has to remember to do it. The boot move is a compare-and-set with all eight eligibility predicates in its WHERE clause, and only the CAS winner writes the audit row, so concurrent worker boots are safe. The backfill is one SQL constant that both migration tracks execute. Audit-log retention is floored at 365 days, and skill_source_update auditing shipped in the same commit as the PUT route (9e98b31cf), so for an install seeded since then the audit filter sees every retarget. There is no system_settings write, and both sync routes keep require_admin + reject_agent_principal. The one finding is Low: a user-doc sentence promises an opt-out that a no-op PUT does not perform.
What I ran
- Merge with
origin/dev:git merge-tree --write-treeis clean. On the merged tree,check_alembic_heads.py src/backend/migrations/versionsreports 108 revisions, 1 head (0107_skill_sources_follow_bundled_pin), PASS. - Parity guards:
check_alembic_parity.py(merge-base → head) passes: both tracks were updated.check_sqlite_upgrade_parity.py <merge-base> HEADpasses, with 1 migration newly recorded on upgrade andmigration_health = (174, 174, None). - Unit tests:
pytest -q -p no:randomlyovertest_ent529_follow_bundled_pin.py,test_2545_skill_source_pin.py,test_ent236_skills_lifecycle.py,test_ent237_skill_source_env_packaging.py,test_ent237_skill_sources.py,test_ent334_status_url_disclosure.py,test_ent692_skill_sources_mcp.py,test_schema_parity.py,test_alembic_parity_guard.py,test_sqlite_upgrade_parity_guard.pyandtest_2094_dependency_path_param_pairing.py: 379 passed, 1 failed.- The failure was
test_ent692_…::test_scheme_less_stored_url_matches_its_normalized_spelling, and it is environmental. That path goes through the URL normalizer, which resolves DNS, and the host was heavily loaded at the time. Re-run on this head: 7/7 for that class and 38/38 for the whole file. It also passes on the merge-base, and the diff does not touch_same_skills_repo.
- The failure was
- Frontend:
rawColorRatchet,loadingGateRatchetandsourceTextRatchetpass (28 tests). I could not runskillSourcesFollowLine.mount.spec.jslocally because mynode_moduleshas nojsdom. That is my environment, not the PR. CI runs it. - Mutations on a scratch copy, each run against
test_ent529_follow_bundled_pin.py. All seven went red:
| # | Mutation | Tests that went red |
|---|---|---|
| M1 | update_source keeps the marker on a retarget |
5: test_an_admin_retarget_opts_out_for_good ×4, test_a_stale_save_of_the_old_ref_is_a_retarget |
| M2 | Backfill ignores the audit NOT EXISTS filter |
4: test_an_audited_retarget_opts_out ×4 |
| M3 | record_sync unscoped |
2, including test_a_sync_in_flight_across_the_follow_cannot_stamp_the_old_commit |
| M4 | follows_bundled_pin == 1 dropped from the follow CAS |
1: test_the_update_itself_refuses[marker-cleared] |
| M5 | Forward-only check bundled <= current changed to == |
1: test_does_not_move[v0.5.0-v0.3.0] |
| M6 | Per-source sync route stops starting the re-inject | 1: test_the_sync_after_a_follow_reinjects_the_fleet[row] |
| M7 | Seed marks every URL as following | 1: test_a_fork_seed_never_follows |
Execution coverage
- Boot hook.
follow_bundled_pinis called frommain.py::_start_skills_sync_delayed. The test pins this by AST and also executes the service function directly. - New
DatabaseManagerpass-throughs.follow_skill_source_pinand the scopedrecord_skill_source_syncare executed through the real facade (test_the_real_db_facade_reaches_both_new_paths). - Backfill. Executed through the real SQLite migration.
- Route re-inject.
_start_fleet_reinject_if_movedis live in both sync routes and executed by the route tests. - Frontend. The follow line is covered by a jsdom mount spec, not a source-text pin.
No source-text-only coverage of a live gate.
Acceptance criteria
- AC1 (move, reset, audit): DONE.
services/skill_service.py::_follow_bundled_pin_rowandfollow_bundled_pin, plusdb/skill_sources.py::follow_bundled_pin. CHANGED: "forward" means semver order of strictvX.Y.Ztags, not the catalog's tag order. This is a reasonable proxy. - AC2 (admin edits left alone): DONE, CHANGED. Disabling pauses following instead of opting out, per the owner's ruling cited in the PR.
- AC3 (removed/disabled stays so): DONE. Covered by
test_a_deleted_default_stays_deletedand the "never re-enables" assert. - AC4 (re-inject after first sync): DONE. The reset clears
last_commit_sha, so the first sync counts as a moved commit. The per-source Sync also re-injects now. - AC5 (Settings line): DONE, CHANGED. Only the latest follow is shown, not a history. The requirements file lists "history list" under Not built.
- AC6 (docs paragraph): DONE.
Blocking
None.
Medium
None.
Low
1. A PUT that re-states the current ref keeps following, but the user doc says pinning by hand ends it.
-
Where:
docs/user-docs/automation/skills-and-playbooks.md:55says: "Pinning the bundled source to a tag yourself … Doing it by hand stops the source following the platform's pin from then on". Step 3 at line 61 isPUT /api/skills/sources/{id}with{"ref": "<tag>"}. -
What the code does:
db/skill_sources.py:252clears the marker only when an identity field differs from the stored value:values.update(_RETARGET_RESET, follows_bundled_pin=0), insideif any(k in values and values[k] != getattr(current, k) ...).test_a_save_that_changes_nothing_keeps_followingpins this deliberately. -
Failure scenario: an admin on
v0.5.0wants to hold the catalog there. Following the doc, they PUT{"ref": "v0.5.0"}. The call returns 200, the marker stays 1, and the next platform upgrade moves the source tov0.6.0. That is the admin's stated intent overridden, which is the outcome this feature promises never to cause. -
Second symptom: the backfill treats that same historical PUT as a retarget (
migrations.py:5772, "a no-op PUT namingref… reads as touched"). So one admin action has opposite effects depending on whether it happened before or after0107. -
Fix, either of:
- (a) Clear the marker in
update_sourcewheneverurl/ref/ref_typeis named in a PUT, not only when the value changes.applyalready passes only changed fields toupdate_source, so the MCP declarative path is unaffected. This makes runtime match the backfill and the doc. - (b) Keep the behaviour and fix the doc: "to a different tag", plus a line saying that holding at the current tag is done with
TRINITY_DEFAULT_SKILL_SOURCE_REF, as.env.examplealready says.
(a) is the safer reading of "admin intent wins".
- (a) Clear the marker in
…Abilityai/trinity-enterprise#529) Reviewer finding on #4091. The user doc's pin steps say that setting the bundled source's ref by hand stops it following the platform's pin. But a PUT naming the tag the row was already on changed nothing, so the next upgrade moved it anyway: admin intent overridden. The backfill already read that same historical PUT as a retarget, so runtime and backfill also disagreed. update_source now ends `follows_bundled_pin` when an edit NAMES url, ref or ref_type, even if the value is unchanged. The sync bookkeeping still resets only on a real change. Clearing `last_commit_sha` on a save that moves nothing would make the next sync trust whatever the tag points at. `apply` (the MCP tools) passes only the fields whose value differs, so re-applying a declaration is still not a pin. Tests, red first: - naming the current ref/url/ref_type ends following; - that save keeps the moved-tag baseline; - a declarative apply that re-states the ref keeps following. Mutation-checked: restoring the change-only rule (3 tests go red), resetting the bookkeeping on any named field (1), and making apply pass named fields (1). The user doc, requirements, flow, database area file and backfill comment state the rule. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
@dolho thanks. The Low is fixed as option (a) in 0c11776.
New tests are under |
…l_sources_follow_bundled_pin #4091 took 0107 on dev; renumber 0107 -> 0108 and chain onto it. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…_follow_bundled_pin #4091 took 0107 on dev; renumber 0107 -> 0108, chain onto it, and update the parent named in database.md and the requirement. Co-Authored-By: Claude Opus 5.5 <[email protected]>
One conflict, src/backend/db/migrations.py: dev (#4091, #4102) and this branch each added migration functions and appended MIGRATIONS entries after execution_chat_session_id. Both kept, dev's first, so platform_alert_subjects_resweep stays last. tests/registry.json auto-merged with no duplicate rows (617 rows, each file once). Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01HWna79vVmnezQdhpaGRKbw
…3254) dev gained 0107_skill_sources_follow_bundled_pin (#4091) off 0106, then 0108_agent_memory_facts, 0109_agent_ownership_memory_opt_out and 0110_agent_memory_provenance (#4102) on top, so 0107_platform_alert_resweep forked the Alembic head again. Renamed to 0111_platform_alert_resweep with down_revision = "0110_agent_memory_provenance", in every place the id appears: the file and its Revision ID / Revises lines, the migrations.py "Mirrored by" docstring, the tests/registry.json row, requirements/security.md (2 lines) and feature-flows/operating-room.md. A re-chain, not a merge revision: the revision has never been applied anywhere. The upgrade body is unchanged. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01HWna79vVmnezQdhpaGRKbw
…(closing slice) (#4022) * fix(operator-queue): run the platform-alert upgrade sweep a second time (#3254) The #3246 sweep (SQLite platform_alert_subjects / Alembic 0090) ran once, on the upgrade that carried it. Every emitter #3254 moves onto the seam kept filing rows with no subject until its move landed, and the seam cannot see such a row: observe files a second pending row beside it, clear cannot end it, and the snooze cannot see a person's ending of it. A data-only pair re-runs the unchanged run_platform_alert_sweep: SQLite platform_alert_subjects_resweep (appended to MIGRATIONS) and Alembic 0104_platform_alert_resweep (down_revision 0103). The subject's existing holder keeps the slot whatever its age (#3255's rule), else the newest pending row stays; the rest end as one superseded batch by the platform. Agent-raised and gate rows and the gitignore / problem-report rows are never touched. No DDL on either track; downgrade is a no-op, as in 0090. tests/unit/test_3254_second_sweep.py drives both halves against the real post-#3246 operator_queue DDL for 18 derivable families, the fresh-install lifecycle, idempotency, and the Alembic upgrade() on SQLite and (requires_postgres) on PostgreSQL. * docs(requirements): mark platform alerts done and name every kind (#3254) #3254 completes OPS-001-PLATFORM-ALERTS, so the lines that described the half-moved state become false on its merge: - requirements/security.md section 26.14: status Partially -> Implemented, the ratchet's real name EMITTERS_NOT_YET_ON_SEAM (empty), each lifetime class names its kinds, the upgrade sweep in the past tense plus its second run, and the Files list gains the moved emitters; the flood alert and the #1677 budget bullets name observe as the write path and the episode's subject alert_budget:<type>. - requirements/core-agent.md, github.md, scheduling.md: the problem report, gitignore, sync-diverged and poison write paths. - architecture/backend.md (platform_alerts.py), reliability.md (the two backup kinds), workspace.md (the problem report). Path tokens and status lines only; no requirement text changes meaning. * docs(feature-flows): the moved alarms report through platform_alerts (#3254) The flow lines that state the old direct-create write path or a minted request-id shape, now that every in-repo platform emitter reports through platform_alerts.observe / clear: - git-sync-health.md: the two queue rows and the poller tree (sync failing, sync diverged, the two git-bloat kinds; row types kept). - database-backup.md: two kinds keyed by backup_dir, 14-day lifetime, ended on the next ok. - operating-room.md: the flood alert, the #1677 exemption paragraph, poison, the seam section's "only four families" (plus the second sweep), the flood/episode side effects (operator_queue_sync), and a current-path note on the two #1677 revision-history rows. - effect-idempotency.md, github-sync.md, business-validation.md, system-manifest.md: the unguarded-effect, gitignore, validation and system-seed write paths. - user-docs/operations/operating-room.md: sync alerts now end on their own. * docs(git-sync): a divergence alert outlives a sync-failing freeze (#3254) The sync_diverged row is filed only while a divergence freeze is in force, but on the seam it stays for the whole episode: the platform ends it when diverged_since clears, not when sync_failing takes precedence over the freeze or the freeze stops. git-sync-health.md (the queue row) and requirements/github.md ("No item for red-but-not-frozen") now say both halves. * docs: seven more write-path statements the #3254 batch makes false (#3254) Found by review sweeps for the old write-path tokens (this slice's, and the backup/archive, retention and boot-housekeeping slices'), and folded into this slice because it is the one that carries the docs: - architecture/api-endpoints.md (ingestion caps): the third copy of the #1677 paragraph and of the flood-alert sentence now name observe as the write path, the kind's budgeted_type, the created-only notification and the episode's subject alert_budget:<type>. - architecture/reliability.md (the #1644 blast-radius guard): the retention alarm is a platform alert, one row per setting; "delivered" means observe returned created/updated/snoozed; the row's lifetime, 6-hour refresh, note_allowed clear and material keys are stated. The sentences that stay true are unchanged. - requirements/core-agent.md (problem report): a re-rate updates the day's pending item in place, the words reach it through observe's keep_text, and the click/comment order is decided inside the per-agent create lock (update_pending_problem_report and the second attach are gone). - requirements/roadmap.md: the system-seed alarms report through observe (subject system_seed:<kind>) and a later successful seed ends them. - requirements/infrastructure.md (BKUP-013): the backup alarms report through observe as two subjects, db_backup_failure and db_backup_stale, each ended by the platform on the next ok. - migrations/GIT_REMOTE_TOKEN_SCRUB_2026-09.md: the unreadable-workspace alarm is one row per agent, updated by each sweep and ended by the platform once a sweep can inspect the workspace (no longer one per day). Path tokens and status lines only. * docs: six more live lines that still stated the old alert write path (#3254) Fresh review of the closing slice, each line read against the merged code: - user-docs operating-room: every platform alert is now a condition (the "other platform alerts still file one card per event" sentence is gone), and the four kinds that need a person and never expire are named. - architecture agent-lifecycle and background-services: the divergence alert is the `sync_diverged:<agent>` subject on the seam, ended when its episode ends, not a `sync-diverged-{agent}-{diverged_since}` id collapsed by the request-id conflict target. - feature-flows operating-room: platform callers report through `platform_alerts.observe`; the five budgeted kinds are bounded inside its locked create (no `create_bounded_alert` route); the #3246 history row says the rest moved with #3254. - requirements security: the validation notifier is on the seam. - feature-flows git-sync-health: the maintenance alert ends only on the agent's own repack report, and a persisting condition is re-read every 6 h rather than filed once. * fix(migrations): chain the #3254 re-sweep after dev's head as 0105 (#3254) dev gained 0104_agent_sync_state_git_stats_at (#4006), which also revised 0103_a2a_caller_identity. With both on dev the version line had two heads, and `alembic upgrade head` on PostgreSQL would apply nothing (#2068). The re-sweep becomes 0105_platform_alert_resweep, revising 0104_agent_sync_state_git_stats_at. The id is renamed everywhere it appears: the file, its Revision ID / Revises lines, the migrations.py docstring, the tests/registry.json row, requirements/security.md §26.14 and feature-flows/operating-room.md. The SQLite entry stays last in MIGRATIONS, after agent_sync_state_git_stats_at. The revision has never been applied anywhere (the branch is unmerged), so a re-chain is correct and a merge revision is not needed. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01HWna79vVmnezQdhpaGRKbw * docs(operator-queue): the snooze silences one episode; the flood, budget, gitignore, backup and archive markers (#3254) dolho's I1 on this PR: these docs stated the platform-alert snooze as "the same reading files nothing for 7 days", which #4021's review fix (the flood, budget and gitignore kinds) and #4017's (the backup and log archive kinds) narrow to one episode. Each of those kinds now carries an episode marker that it lists as a material key, so a person's ending silences re-reads of that episode and a new episode files at once: queue_flood episode_started_at, alert_budget filled_by, gitignore_untracked push_id, db_backup_failure / db_backup_stale last_success_at, log_archive_unwritable last_writable_at. Also stated, as those branches implement it: - the flood cooldown is stamped before an episode's first reading only, and the 6-hour re-read is OPERATOR_QUEUE_FLOOD_REREAD_SECONDS; - a stale-backup re-alarm is stamped only when the reading landed, so a snoozed one is re-read daily; the weekly gate is not reset by an ok; - a keyless (pre-upgrade) ending of the inbox collision, a final-ending kind, files once more (#4020); for the snoozing kinds it counts as unchanged, which leaves an upgrade-day residual of at most 7 days. Lines: requirements security.md §26.14 (snooze, flood, budget), infrastructure.md BKUP-013, github.md; architecture reliability.md; flows operating-room.md, database-backup.md, github-sync.md; and user-docs operations/operating-room.md. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01HWna79vVmnezQdhpaGRKbw * fix(migrations): chain the #3254 re-sweep after dev's head as 0107 (#3254) dev gained 0105_idempotency_claim_token (#3921) and 0106_execution_chat_session_id (#3918) off 0104, so 0105_platform_alert_resweep forked the Alembic head again. Renamed to 0107_platform_alert_resweep with down_revision = "0106_execution_chat_session_id", in every place the id appears: the file and its Revision ID / Revises lines, the migrations.py "Mirrored by" docstring, the tests/registry.json row, requirements/security.md section 26.14 (2 lines) and feature-flows/operating-room.md. A re-chain, not a merge revision: the revision has never been applied anywhere. The upgrade body is unchanged. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01HWna79vVmnezQdhpaGRKbw * docs(approvals): every platform heads-up is on the one-row model now (#3254) approvals.md still said the other platform heads-ups file one row per event and move onto the model in a later release. With #3254's last slice every in-repo emitter is on the seam (EMITTERS_NOT_YET_ON_SEAM is empty), so the sentence now says that, and names the four person-only kinds that never expire, in the operating-room page's words. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01HWna79vVmnezQdhpaGRKbw * fix(migrations): chain the #3254 re-sweep after dev's head as 0111 (#3254) dev gained 0107_skill_sources_follow_bundled_pin (#4091) off 0106, then 0108_agent_memory_facts, 0109_agent_ownership_memory_opt_out and 0110_agent_memory_provenance (#4102) on top, so 0107_platform_alert_resweep forked the Alembic head again. Renamed to 0111_platform_alert_resweep with down_revision = "0110_agent_memory_provenance", in every place the id appears: the file and its Revision ID / Revises lines, the migrations.py "Mirrored by" docstring, the tests/registry.json row, requirements/security.md (2 lines) and feature-flows/operating-room.md. A re-chain, not a merge revision: the revision has never been applied anywhere. The upgrade body is unchanged. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01HWna79vVmnezQdhpaGRKbw * docs(operator-queue): a new divergence episode files after a person's ending (#3254) #4016 gives `sync_diverged` the material key `diverged_since`, so a person's ending snoozes re-reads of the episode they ended and a later episode files its own row inside the 7 days. Three lines said otherwise: - user-docs/operations/operating-room.md (Sync Health Alerts): drop "unless you dismissed the last one within the past 7 days". - requirements/github.md (one item per episode): drop "unless a person ended the last one inside the 7-day snooze" and name the material key. - requirements/security.md 26.14 (Snooze): add `sync_diverged` `diverged_since` to the episode markers. It stays out of the upgrade-day residual list: the pre-move emitter wrote `diverged_since` into every row's context, so a person-ended legacy row carries it. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01HWna79vVmnezQdhpaGRKbw * docs(operator-queue): name the sync_failing exception to the episode rule (#3254) The general rule says only the episode a person ended stays quiet. That holds for every kind with an episode marker, but `sync_failing` has none: its context (`last_sync_at`, `consecutive_failures`, the error excerpt) moves on every reading and the priority is always high, so after a person's ending, a new run of failures inside the 7-day snooze files nothing, even across a successful sync. The rule now says so, and that the sync-health dot still turns red. Kept as its own commit: drop it if #4016 gives `sync_failing` an episode marker. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01HWna79vVmnezQdhpaGRKbw --------- Co-authored-by: Claude Opus 5.5 <[email protected]>
Summary
DEFAULT_SKILL_SOURCE_REFas long as it still points where the seed put it. Before this, an existing install stayed on the tag it was born with, so "update the library → the fleet picks it up" (ent#236) held only for fresh installs.url,reforref_type, even unchanged, since setting the tag it is already on is how an admin holds it. Also an actual change throughapply(the MCP tools), which passes only the fields that differ. Only the marker goes on a same-value save; the moved-tag baseline survives.vMAJOR.MINOR.PATCH.moved_tag, and counts as a moved commit, so the ent#236 fleet re-inject fires as usual.skill_source_follow_bundled_pin(from_ref,to_ref).followed_from_ref/followed_aton the row./review:sync_skill_sourcetool) recorded a moved commit without starting the fleet re-inject, which spent the moved-commit signal. Both manual sync routes now share_start_fleet_reinject_if_moved.update_sourcewrites only over the url/ref/ref_type it read, and re-reads on a miss. A stale save naming the old ref can no longer quietly undo the follow while keeping its record.record_syncnow writes only while the row still points at the url/ref/ref_type the sync fetched. Before, a sync already running when the ref moved (here, or through an admin PUT today) wrote the old tag's commit onto the new ref. Every later sync was then refused asmoved_tag, and only another retarget cleared it.Changes
db/skill_sources.py:_RETARGET_RESETis shared byupdate_sourceand the new compare-and-setfollow_bundled_pin, which carries every eligibility predicate in its WHERE so it's safe across workers.update_sourceends following when url/ref/ref_type changes.record_syncis scoped to the synced target.services/skill_service.py:follow_bundled_pin()(async, never raises; only the winner of the CAS writes the audit row)._synced_targetis passed at all threerecord_synccall sites.main.py:_start_skills_sync_delayedawaits the follow beforeskills_sync_service.start(). It runs here rather than ininit_database, because that runs insideDatabaseManager()at import time, whereplatform_audit_servicecannot be imported.database.py+config.py:follows_bundled_pin = 1only for the built-in catalog URL (BUNDLED_SKILL_SOURCE_URL). A fork may not carry the next tag.skill_sources_follow_bundled_pinand Alembic0107_skill_sources_follow_bundled_pin(on0106_execution_chat_session_id,ADD COLUMN IF NOT EXISTS), with the DDL inschema.py/tables.py.skill_source_updateaudit row namesref/url/ref_type.SkillSourcesPanel.vue:statusClass's two identical gray arms are collapsed, so the panel's raw-gray count stays at its baseline.skills.md§21.1.3.database.md+backend.md.skills-library-sync.md.skills-and-playbooks.md: the AC6 rule paragraph, plus the manual pin procedure now says it ends following.test_ent237_skill_source_env_packaging.py: the guard now reads the default URL from the named constant.test_ent334_status_url_disclosure.py: itsSimpleNamespacestand-in rows gain the three new fields.The MCP
list_skill_sourcestool proxies the route body verbatim, so it gains the fields with no TypeScript change. There's no new route.Config keys whose behaviour changed
TRINITY_DEFAULT_SKILL_SOURCE_REF: besides the tag a fresh install is seeded with, it is now the tag an untouched existing bundled source follows on upgrade (forward only). Setting it to the current tag holds an install where it is..env.examplesays so.Test Plan
cd tests && pytest unit/test_ent529_follow_bundled_pin.py -v: 72 passed.file://upstream with annotated tags, covering both the update path and the lost-checkout clone path.run_cyclere-injects with the new commit.DatabaseManagerpass-throughs, and boot wiring pinned by AST.Mutation-checked. Each removal turns tests red: the marker clear (4), the follow reset (5), the sync scoping (1), the boot hook (1), the seed marker (14), the forward check (1), the backfill audit filter (4), moving the follow line back above the error (1), any one of the seven compare-and-set conditions (1–2 each), the
update_sourcescoping (1), the per-row route's re-inject (3), Sync all's (1), the named-field pin rule (3), resetting the bookkeeping on a same-value save (1), andapplypassing named fields (1).Frontend:
skillSourcesFollowLine.mount.spec.js(jsdom mount), the raw-colour / loading-gate / source-text ratchets andcheck:tokensall pass.Review round: skills, sync-route and migration unit files: 1743 passed. mcp-server
skill_sources.test.ts: 32/32, typecheck clean.Related unit files (skills, library, migration, audit, lifespan) on the first commit: 2116 passed. The only failures are 7 in
test_ent873_audit_client_ip.py, whereimport mainneedsopentelemetry.exporter, which a stale local venv lacks; they're untouched by this diff.check_alembic_heads.py(1 head,0107),check_alembic_parity.pyandcheck_sqlite_upgrade_parity.py(merge-base → head) pass./verify-local --skip-agentunit stage: 30719 passed. Of the 5 failures, 2 were the ent#334 stand-ins (fixed above) and 3 aretest_3262, red only whenTRINITY_DEFAULT_SYSTEM_MANIFEST=disabledis exported for the sibling stack (10/10 pass without it)./verify-local --skip-agent --skip-unit(image build, import smoke, boot, integration): pass — build +import mainin the image, boot +/health, test preflight, integration 69 passed / 13 skipped (2 no-PostgreSQL, 11 unclassified) / 2 known false-fails deselected.Manual check on a local instance:
Postgres, against real rows (a throwaway
postgres:16-alpine):0107, including psycopg2's%/LIKEhandling and the correlatedNOT EXISTSagainst the append-onlyaudit_log.Fixes abilityai/trinity-enterprise#529
🤖 Generated with Claude Code