Commit Graph

15 Commits

Author SHA1 Message Date
alt-glitch
6f1f08ef38 refactor: bring pm/ under the import bans and route plugin dir lookups through one helper
Remove the pm/** TID251 ignore (per-line noqa for pm-private imports) so future old-name bans reach pm/. Route six __file__-derived bundled plugins paths through get_bundled_plugins_dir().
2026-11-11 16:00:17 +05:30
Teknium
0c357fea11 fix(pm): a plugin requiring another Hermes sits out instead of being disabled for good
Round-2 review P2 + P3 #1. A plugin's applicable hermes-agent requirement that
excludes the running Hermes raised ResolutionConflict inside the workspace build,
so `hermes update` parked it in plugins.disabled with a `tried` fingerprint that
never includes the running version: after Hermes reached a fitting release
nothing retried it. A plain `sync_venv(explicit=True)` failed outright.

The check is now one gate with requires_hermes (pm.workspace.hermes_fit_error):
member selection and update eviction leave the plugin out of this build with
config untouched (it rejoins once Hermes fits, because the member set moves the
stamp), admission refuses it (pm.publication.validate_manifest), and the loader
skips it. It runs for every plugin, including one whose only dependency is
hermes-agent in plugin.yaml, which was never checked.
2026-11-03 00:28:04 -08:00
kshitijk4poor
b7cd1f084b fix(config): reader gate tracks every binding form and scans pm/
The reader gate only bound plain `name = <config path>` assignments and never scanned pm/, so
direct local-file reads still passed it: `env_path, config_path = ...` then
`config_path.exists()` in tools/send_message_tool.py, and pm/plugins_state.read_home_selection
reading config.yaml with read_text().

The gate now binds tuple-unpacked elements, `self.<attr>` targets and for-loop targets; flags
unbound `Path.<method>(p)`, shutil copies and pm's byte readers (read_bytes_or_none,
file_digest); and scans pm/.

Routed through the backend: send_message_tool's missing-config check and
read_home_selection (same FileNotFoundError / OSError / YAMLError -> ValueError contract).
Marked as file tooling: pm's byte-level compare-and-swap publication/eviction rewrite and the
LKG backup copy, which operate on the local file itself.

Known limit: bindings flow into nested scopes, not across sibling methods, so a `self.x` bound in
`__init__` is not tracked in another method (pm/publication.PluginSelection.publish).
2026-10-25 18:54:09 -07:00
Teknium
1d258cc6c2 fix(pm): a retry fingerprint covers the enabled plugins beside the retried one
A plugin disabled for conflicting with an enabled one now comes back once
that plugin changes or leaves: the fingerprint is taken against the members
the update leaves enabled, and compared against the enabled members of the
next update.
2026-10-25 03:01:26 -07:00
Teknium
d178550247 fix(pm): retries never displace an enabled plugin and cost nothing while unchanged
Independent review findings on update-disabled plugins:
- Recorded plugins are tried only after the enabled plugins have built, one
  at a time on top of them; an update that has to disable an enabled plugin
  re-enables nothing, so a download failure can never swap two plugins.
- A resolver or build verdict records a fingerprint of what was tried (core's
  dependency inputs plus the plugin's) and is not built again until one side
  changes; a download failure is retried by the next update, and those go
  first because they fitted beside the rest before.
- The update publishes against the config snapshot it decided from, and a
  rejoin needs the record to still be there, so a user's mid-update choice
  stands.
- Recorded reasons keep their readable start, not the tail of a uv error.
- An installed provider that fails to import is reported as such instead of
  running recovery, and the startup notices dedupe per kind.
2026-10-25 03:01:26 -07:00
Teknium
8c7cbd37d4 fix: review findings on update-disabled plugins
- A provider-only record is retried only while memory.provider still names
  it, so a rejoin never installs a provider the user switched away from.
- An installed provider that still fails to load after startup recovery is
  reported even when recovery printed an install notice.
- One spelling reader: plugin_spellings uses the shared native manifest
  reader (plugin.yaml or plugin.yml), and the memory loader uses it too.
2026-10-25 03:01:26 -07:00
Teknium
ffe2f6411c fix(pm): an update that disables a plugin keeps memory.provider and retries it
When an update had to disable a plugin it also cleared memory.provider, so
the memory provider stayed lost even after the plugin was re-enabled, and
nothing ever retried the plugin: one transient failure (a TLS proxy, a mirror
outage, a since-fixed resolver bug) left it off for good.

- The dependency union now honours plugins.disabled for memory.provider the
  same way the provider loader already does, so eviction no longer has to
  blank the selection. Re-enabling the plugin brings the provider back.
- The eviction is recorded in the home's config under
  plugins.disabled_by_update (was it enabled, and why). Every later update
  retries recorded plugins after the enabled ones and undoes exactly the
  edit once a plugin fits again.
- A user's own enable/disable/remove takes the decision back: PM's selection
  publication forgets the record for the plugin the user settled, and
  `hermes plugins disable` on an update-disabled plugin now writes that.
- Spellings come from the plugin's own manifest instead of a plugin scan of
  the PM process's home, so a profile's plugins are matched in that profile.
- A parked provider is reported, not re-installed: agent init tells the
  user once why external memory is off (naming the update's reason), and
  `hermes memory status` and `hermes doctor` show it instead of "plugin not
  found" or "All checks passed". Doctor lists every update-disabled plugin.
2026-10-25 03:01:26 -07:00
Charan Rathore
d7382ef014 perf(pm): scan the plugin tree once per eviction instead of once per evicted plugin
Review follow-up on #131220: _spellings re-ran _discover_all_plugins for every evicted name. Scan once, lazily, and pass the entries to _plugin_aliases.
2026-10-25 03:01:26 -07:00
Charan Rathore
4941a296bb fix(pm): only fall back on import/IO errors when discovering plugin aliases 2026-10-25 03:01:26 -07:00
Charan Rathore
36e67a1957 fix(pm): drop a dependency-evicted plugin from plugins.enabled and tell the operator how to re-enable it 2026-10-25 03:01:26 -07:00
alt-glitch
953a598860 fix(pm): give text that leaves PM the ordinary spelling of store paths
Store now spells its root \\?\C:\... on Windows so PM's own file calls
under it pass MAX_PATH. That spelling must not escape: the same folder
spelled two ways hashes and compares differently, and children such as
cmd.exe, gpg or uv refuse or record the prefix (uv would write it into
pyvenv.cfg).

native() now converts store-derived paths where their text leaves PM:
- process argv and cwd: uv via PythonEnvironment._run (its one exit),
  binary version probes, npm self-install, the PortableGit extractor,
  gpg provenance checks, the plugin-eviction interpreter probe;
- environment values: compose_env (PATH and package env diffs), the
  activation PATH dirs, HERMES_RUNTIME_DIR;
- hashed identities: the PM runtime inputs and isolated-environment
  identity, so existing records still match and nothing rebuilds;
- API results callers execute or compare: installed_package,
  uv_launcher, verified_tools entries;
- user-facing verification messages.

Facts records already store {STORE}-templated env, so no absolute path
reaches them. Tests pin that identities are spelling-independent and that
records, composed env and uv invocations from a verbatim root carry no
prefix (both fail on e8c97320ac).
2026-10-07 06:40:39 +05:30
ethernet
0978aca962 fix(pm): retry a plugin fetch failure once, then disable it
Sitting a plugin out after a fetch failure left the recorded stamp stale on
purpose, so every launch resynced, and the spawned-process guard in
prepare_launch raised "dependency sync left this install out of date".
One retry covers a blip; after that the plugin is disabled with the reason,
and hermes plugins enable restores it. Only requires_hermes still sits out,
which boot skips the same way.
2026-09-25 00:00:09 -04:00
ethernet
c500ee8771 fix(pm): disable a plugin only on evidence about the plugin
An update disabled any plugin that failed a trial build or its
requires_hermes check. Both can be about us, not the plugin: an untagged
source checkout reads as an older release (#122054), so requires_hermes
misjudges a fine plugin, and a download failure says nothing about the
plugin's code. Those now sit the plugin out of the build: config stays
untouched and it rejoins once the cause clears.

Disabling still happens on evidence about the plugin: requires-python vs
the pinned interpreter, manifest_version, an invalid declaration, a uv
resolution conflict, or its own build backend failing (new BuildFailure,
keyed on uv's 'The build backend returned an error').

enabled_member_dirs now skips a requires_hermes misfit instead of
raising. Boot's currency check raised on it before any sync could run, so
the launch path never reached the update sync. The loader skips such a
plugin anyway; admission still refuses enabling one.
2026-09-25 00:00:09 -04:00
ethernet
cae75f0ead fix(pm): an unreadable secondary profile config cannot fail an update
Venv.apply refused the whole graph when any secondary profile's
config.yaml was unreadable, so one broken sibling config failed every
update. Update syncs now leave that profile's plugins out of the union,
report it (stderr + receipt warning), and build the rest; the profile's
plugins rejoin on the next sync once its config is fixed. Boot currency
already skips broken secondaries, so the result reads as current.
Ordinary syncs keep refusing to shrink the recorded graph.
2026-09-25 00:00:09 -04:00
ethernet
ccf631701a fix(pm): disable plugins that no longer fit instead of failing the update
An update resolves the enabled plugin union against the NEW core. A plugin
admitted against the old core can stop fitting when core moves (managed
Python 3.13 -> 3.14 vs a member's requires-python <3.14, a requires_hermes
upper bound, a bumped pin), and the whole update then died after the
source swap with a non-resolver InstallError whose 'retry' hint failed the
same way every time.

Update syncs now pass evict_incompatible_plugins=True (update completion,
historical takeover, launch-time completion, venv_sync, post-update
drift). PM screens statically first (requires-python vs the target
interpreter, manifest/requires_hermes), then, if the rest still fails,
builds core alone to prove the plugins are the cause and re-adds members
in config order, disabling each one that breaks the build. Misfits land in
plugins.disabled (memory.provider cleared) in every home that enables
them, published through the existing journaled change hook (the journal
now carries several configs), and are reported on stderr + receipt
warnings. Admission and ordinary syncs still refuse; only a core that
cannot build on its own fails an update.
2026-09-25 00:00:09 -04:00