The IdP token cache was keyed on (token_url, client_id, scope), so a
rotated GATEWAY_RELAY_IDP_CLIENT_SECRET kept serving the bearer cached
under the old secret until it expired. The key now includes a digest of
the secret.
`hermes config set display.skin ares` with `ares` already supplied by an
upper level printed "Set ... in Remote Config" but sent no PATCH: the
document save diffed the key away as unchanged. A later upper-level
change then replaced the user's choice.
Keyed Changes.set and keys named in a new `pinning_keys()` block (the
CLI's `config set` document save) are now sent even when unchanged,
matching the file backend, which always writes them to config.yaml.
A key a lock already freezes is skipped, not refused.
destination.display_url() drops user:password@ from a URL (an unparsable one is cut at the last
@). The boot error, describe(), the user-layer provenance, the destination policy's own errors,
the redirect refusal and the IdP failure all show that form; the request itself still checks
(and refuses) the URL as configured.
Addresses teknium1's P3 (refused URL echoed with credentials) on #122509.
backend.py and diff.py each defined _set_path/_pop_path, and the two _pop_paths already returned
different things (None vs bool). backend.py now imports diff.py's pair; its callers ignore the
result, so only the duplicate goes.
Addresses teknium1's P2-3 on #122509.
HERMES_CONFIG_REMOTE_POLL_SECONDS is gone: the interval is 300 s (the 30 s floor stays), so no
new non-secret HERMES_* env var is needed before config can be read. A plane-served interval is a
later cross-repo change. The environment-variables reference now lists HERMES_CONFIG_REMOTE_URL
and HERMES_CONFIG_INSTANCE_ID next to HERMES_CONFIG_BACKEND, with why each must be env.
Addresses teknium1's P2-2 on #122509.
HERMES_CONFIG_BACKEND=<kind> now resolves to plugins.config_backends.<kind>.get_backend() (a
direct import, never the general plugin loader, D11), with the kind checked against a package-name
pattern before any import. What core read from the remote plugin's internals is a protocol method
with a no-op FileBackend version: bootstrap_env_names() (env_loader's .env bootstrap),
preserve_read_base() (keeping_read_base) and doctor_warnings() (hermes doctor).
Addresses teknium1's P2-1 on #122509.
main (76f2fdb794, 5f02a8c19e) added cache_version to the ConfigBackend protocol and keys
every parse cache (load_config, the TUI raw read, profile reads) on config_cache_version.
The remote backend lacked it, so every cached read in remote mode raised AttributeError.
Its version is already exact (etag + local generation), so cache_version returns it
unchanged. Test: config_cache_version follows the remote version across a poll; without
the method 41 tests in test_remote_backend.py fail.
puts back what that build deliberately left for the remote backend, on
main's seam shape:
- RemoteBackend implements main's protocol (read_user_doc, probe_readable)
and is not a FileBackend; _route returns (backend, home) and explicit
files go through _ExplicitFile, so the is_layer branches are gone.
- One bootstrap: _ensure_bootstrap_env / bootstrap_deployment select the
backend from the process env, the launch home's .env and the managed .env.
#134362's _dotenv_backend_override did not survive its file-only refactor,
so nothing stacks; its rules are now tests (stale shell remote + .env file
boots file; empty .env value resets to file; .env-only remote selects
remote; an absent key keeps the shell value).
- The file-tooling gates main removed (backup/import/snapshot restore,
config edit, migration write-back, config backups, profile clone and
distribution install, raw config editor, xAI migration, gateway --config).
- profile_serve_signature uses the backend version for config.yaml.
- restore_config_model_settings_if_rewritten is a no-op without file tooling.
- PM's dependency runtime reads a home's selection from the local file it
publishes to (config_backend.local_file_layer), so a remote deployment
never needs the plane there or fails PM closed.
- Ratchet: _container_slots/_validate_quoted_containers move to
config_value_checks, _count_cron_jobs to backup_restore, the gateway
--config load to gateway/config_loader.
1. _resolve_assignment_credentials (POST /api/model/set) and the custom-endpoint make_default /
activate paths replaced an inherited model.api_key with the target provider's key_env by
popping it. Under Remote Config the block is the effective one, so the pop became a profile
unset that cannot reach the upper level, and the inherited inline key (which outranks key_env
at runtime) stayed active at the new endpoint. drop_model_key stores null for a key the
effective block holds (file backend: plain removal), the same mask apply_model_selection uses.
2. remote_model_selection_guard is a preflight; a lock published after it was still silently
omitted from the document save, landing a half route with ok=true. New
config_backend.refusing_locked_omissions("model") scope: the remote backend's document intent
raises ConfigLockedError (HTTP 403, nothing sent) when a lock it sees at save time covers a
changed key under the scoped prefix. Wrapped around every whole-document model assignment save
(dashboard main slot, profile builder, custom endpoint make_default / activate). The CAS retry
already refuses a locked key through _patch_body's write_check.
Regressions:
test_dashboard_model_switch_keeps_mask_when_target_provider_carries_key_env (fails with the pop
restored), test_dashboard_model_switch_refuses_when_a_lock_lands_after_the_guard[poll] (fails
with the scoped refusal disabled), [cas-retry] (coverage of the existing retry refusal).
1. A document save is diffed against the base the saving context READ (per-context
_READ_BASE recorded by read_user_layer / read_user_doc_readonly / version and after the
context's own acknowledged write), not against whatever a poll installed between the read and
the save. save_config's fail-closed guard read keeps the caller's read base. A poll before save
no longer turns its changes into our unsets/sets with the current expectedVersion.
2. persist_model_selection (remote): a key the switch clears that the effective model block
still holds is stored as null ("no value", contract 5.4), not unset at the profile level, so
an upper-level old-endpoint api_key/key_env/api_key_env/context_length stops applying at the
new endpoint. New config_backend.write_changes carries explicit nulls.
3. profiles.configure: skills / toolsets / MCP sections report applied only when the section
reads back as written; a bulk save that dropped a locked key is no longer acknowledged.
4. _dotenv_assignments decodes UTF-16 (BOM) and strips NULs as the runtime sanitizer does, so
stage2 / first-read selection agrees with the backend the runtime boots.
Regressions (each fails with the production change reverted):
test_poll_between_read_and_save_sends_only_the_callers_edit,
test_model_switch_masks_inherited_endpoint_credentials,
test_profile_editor_reports_a_locked_skills_edit_as_not_applied,
test_stage2_decides_like_the_runtime_for_utf16_dotenv[utf16-bom|utf16-no-bom].
The rebase onto main brought new lint rules (UP006/UP037/RUF100/RUF059/PLW1510/B009) that the
PR's own files did not meet, and main code that reads/writes config.yaml directly, which the PR's
reader gate (scripts/check_config_yaml_readers.py) refuses. No behaviour change in file mode.
- ruff --fix (safe fixes only) on the PR's files; explicit check=False / unused-name fixes in tests.
- gateway/session_config.py (new on main): the multiplexed 'mtime' getter uses config_version /
config_exists, like tui_gateway's _cfg_get_mtime.
- hermes_cli/prune_advisor.py (new on main): decide() writes sessions.auto_prune through
config_backend.write_config_key (a remote refusal is the existing "could not save" answer).
- hermes_cli/profiles.py _strip_multiplex_flag (new on main): config_exists, not Path.is_file().
- hermes_cli/config_backups.py / update_receipt.py: annotated as file tooling / pre-swap
interpreter (both already gated on file tooling or run without the backend importable).
andrexibiza P1-A. The plane bearer (client.request) and the IdP client secret (_idp_token) were
sent to whatever HERMES_CONFIG_REMOTE_URL / GATEWAY_RELAY_IDP_TOKEN_URL held, over urlopen's
default redirect-following opener.
New remote/destination.py is a transport policy, not a host allow-list (D19 keeps the plane URL
operator-selected):
- https only; plain http only to localhost / 127.0.0.1 / ::1 (tests, local development);
- no user info, query or fragment in the configured URL (an ambiguous destination);
- credentialed requests use an opener with no redirect handler: any 3xx raises
CredentialDestinationError instead of being followed.
The URL is checked before the bearer is resolved and before the IdP secret is encoded, so a refusal
sends nothing. CredentialDestinationError is a non-retryable PlaneCredentialError: boot fails
closed at once (no retry sleeps), writes refuse with config_plane_unreachable.
Tests (test_remote_credential_destination.py, 25): foreign ambient http origin, https->http
downgrade of the default, other schemes, userinfo/query/fragment refused before send with the
bearer never resolved; D19 default, on-prem https and loopback http allowed; real cross-origin
301/302/303/307/308 from a loopback plane and 302/307/308 from an IdP: the target listener sees
no request; boot through the real backend fails closed with zero plane/token requests. All 25
fail with client.py/credentials.py reverted.
With HERMES_CONFIG_BACKEND=remote the success line printed get_config_path() although the write
went to the plane's profile level and no local file exists. The backend now names its write
destination (ConfigBackend.destination); the file backend keeps the path byte for byte.
1. Grouped edits: new write_config_keys(path, {key: value}) sends related keys as ONE backend
write (one CAS PATCH in remote mode), so a lock on any key refuses all of them.
persist_model_selection, the TUI /focus setter and the thinking_mode setter use it; the TUI
gets _write_config_keys (one raw round-trip save with the file backend). File-mode writes
are unchanged (key by key, comment-preserving).
2. Migration reads: _postprocess has no single flight any more. A reader or writer that finds
the published doc unmigrated runs its own private pass; the first to finish publishes
(generation-fenced, st.postprocessed set only on publish). read_user_layer /
read_user_doc_readonly snapshot only completed output (_snapshot re-completes when a poll
lands in between), and write_changes prepares only against completed output. Waiting on the
other pass instead could deadlock on _CONFIG_LOCK; private recursion is unchanged.
3. Docs: developer-guide/config-backend.md says the remote backend ignores the managed
config.yaml while the managed .env still applies.
- Re-vendor conformance/ from gateway-gateway 36dff9281f (gg #328): the 35 v1 files are
byte-identical, plus the 12 multi-group fixtures of portal-groups contract §7.2 (each sha256
checked against the contract table). APPROVED_FIXTURE_DIGEST e7e92b9b… -> 3fdf7068…
- The runner reads only profile writes, expect.locks[path, level] and defaultsMerge, so v2 needs
no code change; a new check pins fixtureVersion to {1, 2} so a future format is reviewed.
- Stub plane can emit group levels, groupProvenance and lockedByGroupId; tests prove these are
ignored, a group lock refuses client-side as lockedBy group, the plane's group 403 maps to
ConfigLockedError + dashboard 403, and the ETag is echoed verbatim.
- env_loader: secret sources apply into a private staging copy of the
environment; the D32 protected-name check runs before anything is
published to os.environ, so a refused plane URL/credential is never
visible to a concurrent request (the poller reads them live).
- remote backend: the doc's schema version and generation are captured
together under st.lock; a migration whose doc was replaced before it
starts (or at any step/commit) never touches the replacement.
- remote backend: plane value refusals (config_value_invalid,
config_path_invalid/reserved, config_secret_literal, 413 too_large)
become ConfigValueError; the dashboard maps them to 400/413 with the
plane's message; config_request_invalid and others stay opaque.
- stub plane enforces the contract §11.1 depth limit; bulk-save test
asserts the exact PATCH.
Contract §5.3 (absent = unchanged): an unrelated write from a newer agent no longer
re-stamps a profile level that still stores pre-migration keys, so later readers keep
running those migration steps (D12, R6). A newer stamp is never lowered. The stub plane
now honours 'absent = unchanged' too.
1. Secret sources can no longer switch remote mode off. The backend is selected BEFORE
apply_all and the protected-name check judges by that backend; HERMES_CONFIG_BACKEND is
never a source's to set (reverted; remote mode exits, file mode warns and drops it).
2. A poll GET that a write (or a newer fetch) overtook is dropped instead of installed: every
install bumps a sequence the GET captured when it started. profileVersion alone cannot tell
(an upper-level change keeps it equal).
3. Writes diff against the doc readers got, i.e. migrated in memory (D12), also after the CAS
re-read: an unrelated edit no longer sends the migration's unsets. A migration step for a
doc a poll replaced mid-migration is dropped.
4. Dashboard: expected config refusals keep their message (lock 403, value 400, conflict 409)
through http_failure; anything else stays an opaque 500.
5. Conformance: the fixture digest is pinned to a literal (contract §13.4).
Stub plane: deep_merge now ignores null over a mapping (contract §6.2); docstring says it is a
test double, not server-conformance evidence.
plugins/config_backends/remote serves each profile's user layer from the
config plane: boot fetch inside load_hermes_dotenv with bounded retry and
fail-closed exit (D2), per-process ETag poller (D9), key-level diff writes
with CAS and one conflict retry (D10), client-side lock and secret-literal
checks (D7, D17), in-memory migrations (D12), managed config.yaml ignored
(D18), plane credential from auth.json or IdP client credentials only and
never from a secrets: source (D26, D32). Vendored gg conformance fixtures
run against the lock matcher, secret rule and _deep_merge.