Commit Graph

276 Commits

Author SHA1 Message Date
Maciej Lisiewski
f821b5bac1 Merge pull request #155430 from NousResearch/sec3/134019-standalone-npmrc
fix(security): release-age gate for the standalone WhatsApp bridge and Photon sidecar npm packages
2026-11-15 01:32:38 +01:00
Teknium
803b3ec70c fix(telegram): an album's command caption still leads after an absorbed comment 2026-11-14 10:34:27 -08:00
Teknium
0896d4df55 fix(telegram): a comment absorbed by an inlined document survives the album's command caption 2026-11-14 10:34:27 -08:00
Teknium
f670c8b4a8 fix(telegram): a comment and the video, voice or file sent right after it are one turn
#151809 held a short text for the image sent right after it. Forward-with-comment and
"here's the clip:" then a clip send the TEXT first too, but for video, voice, audio and
documents the comment still flushed alone and the attachment became a second turn. The
media handler now claims the pending comment for any attachment and the generic dispatch
path absorbs it, the same claim/absorb seam the image path uses.

Co-authored-by: mene-crab <mene-crab@proton.me>
2026-11-14 10:34:27 -08:00
Teknium
da8e0d8c9d fix(gateway): an explicit config.yaml platform key beats an inherited env value
The YAML -> env bridge skipped any name already present in os.environ unless
its ownership marker matched. A value merely inherited from the launcher
(TELEGRAM_REACTIONS=true from a parent process, not .env, not a previous
bridge write) therefore beat platforms.telegram.reactions: false, against
configuration.md's "config.yaml wins for non-secret settings".

Now only a .env / managed .env / external secret source value is kept over
the YAML key (#109032); any other preset value is replaced and the bridge
takes ownership via its marker. Removed-key retraction is unchanged: it only
drops the bridge's own marked values.

Fixes #110295
2026-11-14 05:00:31 -08:00
Maciej Lisiewski
c0ef1ccba4 test(photon): pin the sidecar .npmrc mirror behaviourally; fix gate wording
Follow-up to the salvaged #134062 commit. Drop its repo-walking
structural test (banned shape per tests/AGENTS.md) and instead assert the
read-only-tree mirror actually carries .npmrc to where npm ci runs. The
.npmrc comments now say what the gate mirrors: the root .npmrc carries
only engine-strict; the 14-day floor lives in pnpm-workspace.yaml's
minimumReleaseAge, which npm never reads.

Fixes #134019
2026-11-14 13:24:16 +01:00
Maciej Lisiewski
dc965932a0 Merge pull request #155303 from NousResearch/fix/multiplex-host-allowlist-revoke
fix(gateway): a multiplexed host profile's allowlist edit revokes under its own scope
2026-11-14 04:35:05 +01:00
Teknium
d8eb43e424 fix(gateway): retract a removed setting's bridge leftover before env overrides read it
4c13c06 (#154562) moved the outer yaml_env_refresh() up to load_gateway_config() so a load
that fails in typed construction rolls its bridged writes back. The nested refresh in
load_yaml_layer() then only participated, so retraction of unchanged bridge-owned
leftovers moved to the outer exit, after GatewayConfig.from_dict and _apply_env_overrides.
A restart child that inherited TELEGRAM_REPLY_TO_MODE / DISCORD_REPLY_TO_MODE (plus marker)
for a key since removed from config.yaml built its first config with the stale value.

Split the two roles: yaml_env_transaction() is the rollback scope held across the whole
load; yaml_env_refresh() (the YAML layer) commits the retraction at its own end, before
anything reads the env. Each retracted value's prior is recorded first, so a load that
later raises restores it along with its writes. A bare yaml_env_transaction() with no
layer inside still retracts at exit, as the old single scope did.
2026-11-13 16:48:50 -08:00
Teknium
84654bcb8a fix(telegram): a backslash-escaped mark in a bare URL is never its emphasis closer
_UrlEmphasisScan probed each mark run inside a URL as a candidate closer for
emphasis opened before the URL. _star_token already skipped a backslash-escaped
first star for pairing, but the fallback cut used run.start(), so the escaped
star landed in the closer and the URL lost it:
`***Docs https://ex.com/a\** now` showed `*Docs https://ex.com/a\ now`
(main: `**Docs https://ex.com/a\* now`). `**x https://ex.com/a\** z` was
already wrong at 6b7e6cb6, and escaped `~~`/`||` marks were cut the same way.

The scan now starts a URL run after an escaped first mark (odd backslash run),
so that mark stays URL text and only the marks after it may close; a run that is
only the escaped mark is skipped.

Rows for the four re-review shapes added to
test_emphasis_around_a_url_pairs_as_around_any_word, and
test_no_bare_url_loses_a_character_to_formatting gains backslash-escaped
*, **, ~~ and || shapes (9 red on 8dd38f4f). Both fix-lane corpora (1,526
rows): 0 regressions vs main or 8dd38f4f, 0 URLs losing characters, 0
MarkdownV2 errors; 160k-input fuzz: 0 non-mark characters lost; 20k/80k/320k
timing stays linear.
2026-11-13 16:48:04 -08:00
Teknium
e51387fe80 fix(telegram): the bare-URL scan pairs star runs with the renderer's own rules
_UrlEmphasisScan kept its own star-run bookkeeping, which treated a run as one
indivisible opener. The renderer (_pair_emphasis) closes PART of a run, so for
`***bold* https://example.com/**` the scan saw separate `***` and `*` openers,
refused the URL's final `**` as a closer, and the stars stayed escaped inside
the URL while e4b1353c and main rendered bold.

The pairing loop of _pair_emphasis moves into _StarPairing (feed = pair for
real, probe = dry-run with an undo journal) and _star_token; _pair_emphasis
and the scan both drive it, so a URL star run closes exactly what the
renderer would close: partial runs, reach past literal `*` (`**rm *x
https://x/y**`), the rule of 3. The scan's rule is otherwise unchanged: a mark
run inside a URL is URL text unless it closes emphasis opened before the URL;
a later prose closer wins unless the URL run would have spent that opener.
Probes are bounded by _CLOSER_LOOKBACK, so the scan stays linear.

Greptile P2 4567931541.
2026-11-13 16:48:04 -08:00
Teknium
3c4c9c0f6e fix(telegram): one rule decides where a bare URL ends
Four rounds of URL-emphasis heuristics (right-to-left reopen/closer sets, /-run budgeted
re-pairing) each exposed a new edge; the latest cut `https://example.com/a*;b*c*` at the first
star and rendered `;b` italic, dropping two URL characters (Greptile 4567531365).

Replace them with one left-to-right scan: prose delimiters (`*` runs, `~~`, `||`, line and
paragraph breaks) keep a stack of open emphasis. Inside a URL, the first mark run with prose after
it that matches the innermost open marks is that emphasis's fallback closer; every other mark is
URL text. A later prose closer of the same emphasis wins (`*Open https://x/a*;b*c* now*` keeps the
URL whole); an opener left unclosed at its line/paragraph end, or by an enclosing closer, takes the
fallback and the URL ends there. Linear: each delimiter is pushed and popped once, and a URL run
looks at most 8 openers deep.

Adds the Greptile row, a strike twin and a property test over 56 internal-punctuation URL shapes x
11 wrappers: every URL is shown whole, or cut only at a run closing outer emphasis.
2026-11-13 16:48:04 -08:00
Teknium
e1172d2923 fix(telegram): a URL's emphasis closer survives a later bold span in the same word
`_closing_mark_run` (54c8d0b9) let any later run of the same marks that continued as
URL text "reopen" the URL, so in `**https://example.com/a**,next**word**` the
`**word` opener made the URL swallow its own closing `**`: one bold span with
literal stars instead of bold URL then bold `word`. In the right-to-left pass a run
that a later closer of the same marks pairs is now an opener, not URL text, so it no
longer reopens the URL; `a*;b*c` and `a**,b**c` (no closer after the reopener) stay
whole URLs.

The paragraph re-pairing used for `/`-ended runs cannot decide this: both readings
leave 0 unpaired marks for `Open u*;b*c now` and for `**u**,next**word**`, so it
would turn `a*;b*c` back into italics. Review corpus (616 rows): byte-identical to
54c8d0b9, 0 regressions vs main; 910 internal-punctuation rows: 112 change vs
54c8d0b9, every one to main's rendering (0 rows differ from both).
2026-11-13 16:48:04 -08:00
Teknium
bc1d157d26 fix(display,telegram): rebuilt insertText params never block the call; internal URL punctuation stays URL
browser_exec display masking: `params = {**params}` rebinds a name to itself, so
_dict_text followed the spread back to the same name forever (RecursionError);
masking runs before dispatch, so the browser call never ran. _dict_text now
tracks the names it followed (as _strings does), and a walk that still fails
masks every string literal in the snippet instead of raising (fail closed).

Telegram bare URLs: the first mark run followed by punctuation ended the URL even
when a later run of the same marks reopened it, so `https://example.com/a*;b*c`
was cut at `a` and `*;b*c` became italics. A run now closes emphasis only when no
later run of the same marks continues as URL text (one right-to-left pass); the
616-row review corpus renders byte-identical to the previous head, and the new
internal-punctuation rows match main or fix it, with 0 regressions.
2026-11-13 16:48:04 -08:00
Teknium
3e5b565766 fix(telegram): emphasis around a bare URL pairs as around any word; restore placeholders in one pass
_MarkRuns guessed emphasis closers from run parity on the URL's line, so
bold across a newline (**See\nhttps://x/**), nested emphasis
(*outer **https://x/** end*) and a closer followed by prose
(**https://x**—next, [**https://x/**]) rendered as literal stars where main
formats them. A mark run with prose after it now always ends the URL (main's
reading); only the ambiguous run right after a trailing '/' (/web/* vs a
closer) is decided by the real _pair_emphasis pairing over its paragraph:
kept as URL text only when that leaves fewer marks unpaired. The decision is
budgeted so a huge reply stays linear.

Placeholder restore did one whole-text str.replace per placeholder, and every
bare URL now adds one (30k URLs: 0.05s on main, 7.3s on head). Values are
expanded in insertion order and the text in one regex sub.
2026-11-13 16:48:04 -08:00
Teknium
3b6375e236 fix(telegram): a quoted URL keeps its emphasis closer
The per-URL tail check stripped only marks and `.,;:!?)`, so a closing quote
(`"*https://example.com/*"`) left an empty tail and the closer was never
released, keeping the `*` inside the URL. The tail now strips exactly what
`_url_end` may trim (`_URL_TAIL_CHARS` plus `)`), so quoted italic, bold and
strikethrough URLs render as they do on main.
2026-11-13 16:48:04 -08:00
Teknium
fc6489cc5a fix(telegram): a URL with no trailing mark never consumes an emphasis closer
`_MarkRuns.closers` advanced the per-line closer count for every URL inside open
emphasis, even one ending in plain text (`https://a.example/x`). The next URL
then saw an even count and kept the sentence's closing `*` as URL text, leaving
the opener unmatched. A mark now counts as closing only when this URL's own
tail actually carries it.
2026-11-13 16:48:04 -08:00
Teknium
ecf8fd67c3 fix(telegram): a wildcard inside a later URL never closes emphasis around an earlier one
A trailing `*`/`_`/`~` after `/` is judged against the emphasis marks of the
surrounding prose only: runs inside any bare URL (`/web/*`) are URL text and
are no longer counted. The next prose run of the mark is checked instead of
the parity of everything after the URL, so the sentence's own closer (`now*`)
keeps the earlier URL's wildcard as URL text, and URLs on one line are judged
left to right so two emphasized URLs still pair independently.
2026-11-13 16:48:04 -08:00
Teknium
a8b231e886 fix(display,telegram): mask pre-built insertText dicts; pair URL emphasis closers by run parity
- redact_browser_input: an Input.insertText call that passes a name
  (**params, positional params, {**params}) also masks the "text" value
  inside the dict literal assigned to that name.
- telegram_markdown: a trailing */_/~ after "/" closes emphasis iff an odd
  number of that mark's runs precede the URL on its line and an even
  number follow it, so `*https://a/* and *https://b/*` renders both
  italic. Run offsets and line bounds are precomputed once per call and
  bisected per URL (O(text + urls log n)).
2026-11-13 16:48:04 -08:00
Teknium
5aacc88c15 fix(display,telegram): mask more browser_exec typing shapes; close emphasis opened earlier around a URL ending in /
- telegram_markdown: a trailing */_/~ after "/" closes emphasis when the line
  before the URL leaves an odd number of that mark's runs open and the mark
  does not recur after the URL on the line ("**bold https://x.com/**",
  "*see https://x.com/docs/*" render as on main again); wildcard paths stay URL text.
- redact_browser_input: also mask type_text(...), fill_input selectors with
  parens/commas (selector parsed as a literal), f/r/b-prefixed literals, and the
  literal assigned to a name later passed as a typed value. text= is read only
  inside the insertText call; .value ==/=== is not an assignment.
2026-11-13 16:48:04 -08:00
Teknium
c486802f10 fix(telegram): emphasis around a URL ending in / renders instead of showing stray marks
A trailing * _ ~ right after a / is kept as URL text so wildcard paths like
/web/*/example.com/* survive. When the URL itself opens with that same mark
(*https://example.com/*, **...**, ~~...~~), the trailing mark is the closer of
the emphasis around the URL, so it is trimmed off the URL again.
2026-11-13 16:48:04 -08:00
Teknium
81c716d4e2 fix: address review on typed-secret masking, URL tails and the poll-ack test
- Typed values are found by a linear literal scanner: a backslash escape never ends the literal,
  triple-quoted values are whole, and an unclosed literal masks to the line end (fails closed).
- A `*`/`_`/`~` right after a `/` stays part of the URL (`/web/*`), so an italic sentence around a
  wildcard URL cannot borrow its last character as a closer.
- URL tail trimming counts parentheses once instead of rescanning per trailing `)`.
- The poll-ack test waits with tests.waiting.wait_until instead of a sleep loop.
2026-11-13 16:48:04 -08:00
Teknium
c61ac88a9b fix(telegram): a bare URL reaches the chat as literal text
to_markdown_v2 escaped a bare URL char by char after the emphasis pass, so `*`, `~~` or `||`
inside it paired into italic, strike or spoiler marks: Telegram dropped the characters or hid
part of the URL (#40667). Bare scheme URLs are now stashed whole behind the existing placeholder
and escaped as literal text; trailing prose punctuation stays outside, and a `)` stays only while
it closes a `(` in the URL.
2026-11-13 16:48:04 -08:00
Maciej Lisiewski
068629e769 test(gateway): pin the operator grant and stale-marker guards of follow_bridged_env
Co-authored-by: BearHuddleston <196404565+BearHuddleston@users.noreply.github.com>
2026-11-14 00:49:49 +01:00
Maciej Lisiewski
2314616c01 fix(gateway): land every followed list before any retraction
follow_bridged_env walked a hash-ordered set, so an edit moving users
from one bridged list to another could pop the old list first and, with
a grant on, show a concurrent reader no list at all. Mark the
provisional reload branch as the fail-safe it now is.
2026-11-14 00:49:49 +01:00
Maciej Lisiewski
dcad2cb461 fix(gateway): a foreign-stamped secret scope binds the adapter owner's scope
_owner_scope bound nothing when the home override already matched the
owner, even if the ambient secret scope was stamped with another home,
so a host adapter's reload snapshot read the secondary's lists for that
event.
2026-11-14 00:49:49 +01:00
Maciej Lisiewski
b3225923ae fix(gateway): revoke a retracted grant before the list it masked
A reader sharing the host mapping mid-update could see the list gone
while allow_all_users was still on. Revoke the grant first, and test
that following snapshots the env only under the YAML load lock.
2026-11-14 00:49:49 +01:00
Maciej Lisiewski
93030a84e9 fix(gateway): a multiplexed host profile's allowlist edit revokes under its own scope
Once the gateway multiplexes, the host (launch) profile's work runs under its bound scope, whose gate
env is launch_secret_scope: the env frozen at activation plus .env. The live allowlist reload
refreshed only os.environ and the adapter's extra, and under that bound scope it skipped the YAML env
bridge as well, so a Telegram or Discord user removed from the host's config.yaml stayed admitted by
the runner's env check (Telegram callback and prefilter), and a retracted allow_all_users grant kept
granting every sender.

The host's live reload now runs its YAML bridge even under its own bound scope (still never under a
foreign home), and launch_secret_scope plus the mapping already installed for the current body take
the bridge's current values. Only names the bridge owns in the frozen env (marker digest matches),
or names it lacks, follow: a live bridge-owned value replaces the frozen one, a value the bridge
retracted (name and marker both gone) is dropped, and anything else stays frozen. .env and secret
sources are applied over the result, so an operator's value still wins. A reload that cannot bridge
(a foreign-stamped scope) stays provisional, so the host's own next event applies the edit.

Repro tests by BearHuddleston.

Co-authored-by: BearHuddleston <196404565+BearHuddleston@users.noreply.github.com>
2026-11-14 00:49:49 +01:00
Maciej Lisiewski
75d61a1cff test(gateway): a non-strict load failing mid-bridge restores the last good env
The fallback swallows the YAML failure, so the outer yaml_env_refresh never
unwinds; only abort_yaml_env_refresh undoes the partial write.
2026-11-13 20:17:37 +01:00
Teknium
4c13c0603f fix(gateway): live allowlist refresh reads only its own source, publishes all-or-nothing
Two ways a refresh could authorize from a policy the operator did not set:

- An adapter built from `gateway --config <file>` (or any unstamped config) got
  the home config.yaml's version as its live-gate baseline, so an unrelated
  home-config save replaced the custom file's allowlist with the home one.
  mark_live_gate_baseline() now records an empty (unknown-source) baseline for
  a config load_gateway_config() did not stamp; refresh_live_gate_extra()
  already keeps the loaded gates for that.

- The YAML env bridge transaction ended inside load_yaml_layer(), before
  GatewayConfig.from_dict / env overrides / validation. A document whose
  Telegram list bridged fine but whose other blocks failed typed construction
  raised, the adapter kept its last good list, and the runner's env-reading
  authorization already saw the new grant. load_gateway_config() now holds the
  transaction across the whole load (a raise restores every bridged write); the
  non-strict fallback path aborts the bridge's writes before continuing on the
  env/gateway.json config.
2026-11-13 10:00:04 -08:00
Teknium
64930e62cf Merge origin/main into sec/144353-bridge-ownership
Resolves the docstring conflict in tools/environments/local_env_policy.py
additively: keeps main's HERMES_MODEL/DELEGATION/CUSTOM/PROVIDER key names and
this branch's HERMES_BRIDGED_* marker note.
2026-11-13 09:41:46 -08:00
Maciej Lisiewski
342b54fa53 Merge pull request #154614 from NousResearch/sec/46006-no-user-content-at-info
fix(gateway): keep user content and identities out of INFO+ logs (HX017)
2026-11-13 17:17:09 +01:00
Maciej Lisiewski
a5ea8d9e39 Merge origin/main into sec/144353-bridge-ownership 2026-11-13 16:55:43 +01:00
Maciej Lisiewski
bfccf86504 fix(qqbot): keep the signed download URL out of the voice STT WARNING
httpx's HTTPStatusError/TransportError text carries the full request URL,
signed query included. Log the exception type and HTTP status at WARNING
and the detail at DEBUG.

Co-authored-by: BearHuddleston <196404565+BearHuddleston@users.noreply.github.com>
2026-11-13 13:59:41 +01:00
Maciej Lisiewski
efe69bcc0b fix(qqbot): keep the voice STT failure URL out of WARNING logs
Same class as the attachment[%d] INFO line (#46006): log the URL length at WARNING, the URL prefix at DEBUG.
2026-11-13 13:59:40 +01:00
Kevin Rajan
02ef1204f8 fix(qqbot): omit inbound attachment metadata from INFO logs
One red-on-carrier regression test for QQ C2C attachments; logs still show metadata lengths and keep raw details at DEBUG.
Follow-up to c2h5oh's gateway privacy fix in NousResearch/hermes-agent#154614.
Refs NousResearch/hermes-agent#46006.
2026-11-13 13:59:40 +01:00
Maciej Lisiewski
bbfcf16ec5 fix(matrix): keep m.notice bot flag narrowing-only, drop MATRIX_ALLOW_BOTS
msgtype is chosen by the sender, so any Matrix user (federated strangers in
DMs included) can send m.notice. With MATRIX_ALLOW_BOTS=mentions|all and
process_notices on, that let an unlisted sender skip MATRIX_ALLOWED_USERS,
and 'mentions' was never enforced by the Matrix adapter anyway.

Keep m.notice -> is_bot (loop guard, no pairing reply), but don't declare
allow_bots_env until Matrix has an unspoofable bot identity; notice senders
still need a human rung.

Refs #143370
2026-11-13 13:57:48 +01:00
liuhao1024
9e11b317d7 fix(matrix): flag m.notice senders as bots on the session source
A Matrix notice author reached the gateway as a person: only Discord,
Slack, Telegram and Feishu stamped SessionSource.is_bot, so the bot
loop guard and the no-pairing-DM rule never saw a notice-writing bot
(#143370).

Flag msgtype=m.notice sources in _resolve_message_context. The flag only
narrows: a notice sender still needs a human authorization rung.
2026-11-13 13:57:47 +01:00
Teknium
ed4530e7ff fix(gateway): a secondary owner's edit loaded under a routed scope is acknowledged once
7af249ff made every reload under another profile's scope provisional, because
the LAUNCH profile's YAML lists live in the process env, which a bound scope's
bridge skips. A secondary owner's load is complete, though, and leaving it
unacknowledged made a routed voice loop reload the unchanged config.yaml on
every utterance. Only the launch-profile case stays provisional now.
2026-11-13 04:12:06 -08:00
Teknium
7af249ff94 fix(gateway): a reload under a bound owner scope is provisional
An edit to the launch profile's config first seen from a routed profile's
task reloaded under the launch home's bound scope, which skips the YAML env
bridge: the snapshot rebuilt the pre-edit lists, yet the edited version was
recorded, so the owner's own next event never reloaded. A reload under a
bound scope now updates the gates without acknowledging the version.

Adds a test for the owner-scope bind's key path (owner edit first seen
under a routed scope whose home has conflicting YAML and .env lists).

Co-authored-by: BearHuddleston <196404565+BearHuddleston@users.noreply.github.com>
2026-11-13 03:46:03 -08:00
Teknium
9fb6aef518 fix(gateway): a load that raises rolls back the bridged allow_all_users grant
bridge_core_env_settings writes GATEWAY_ALLOW_ALL_USERS straight into
os.environ and flips _BRIDGED_ALLOW_ALL_USERS, outside yaml_env_setter,
so _YamlEnvLoad.restore() never saw it. An edit adding
`allow_all_users: true` in the same file as a later-stage failure (a
boolean `telegram:` block with top-level `require_mention: true`) left
the grant published while the adapter kept its last good lists.

record_yaml_env_prior records the name's (value, marker) in the load's
prior plus an undo for the writer's ownership flag; a raising load now
restores both, so an operator's own GATEWAY_ALLOW_ALL_USERS set
afterwards is still treated as the operator's.

Co-authored-by: BearHuddleston <196404565+BearHuddleston@users.noreply.github.com>
2026-11-13 03:30:40 -08:00
Teknium
cff1c81343 fix(discord): a reconnect's on_ready keeps the username->ID map for resolved entries
discord.py fires on_ready again on a re-IDENTIFY without a new connect().
_resolve_allowed_usernames cleared _username_to_id first, then saw only
the numeric IDs the first resolution wrote into _allowed_user_ids and
returned at `if not to_resolve`, leaving the map empty. The next
config.yaml refresh re-read the configured username, could not map it,
and refused the previously allowed account (and dropped it from
resolved_allowlist_user_ids, the gateway-authz union).

The resolver now keeps every prior mapping whose ID is still in the
entry set it is resolving, and resolves the rest; connect() no longer
wipes the map before its own gate derivation, so a connect after a
resolution keeps the configured username's ID too. A username removed
from config drops out of the entry set, so its mapping goes with it.
2026-11-13 03:12:32 -08:00
Teknium
ff881d59f8 fix(gateway): live allowlist refresh reads the adapter's owning profile, never the ambient scope
A routed `/voice join` starts the receiving Discord adapter's voice loop
inside the ROUTED profile's scope (_async_profile_scope_for_source wraps
the plain handler; asyncio.ensure_future inherits it). Its
_is_allowed_user -> refresh_live_gate_extra computed the version from
get_hermes_home(), saw a different home tuple, reloaded the routed home's
YAML and overwrote the receiving bot's role/user gates, so a speaker with
a role allowed only by the routed profile passed voice admission.

The refresh now keys on the home recorded in the connect-time baseline
(the profile the adapter was loaded for), stats that home's config.yaml,
and binds that profile's runtime scope for the reload and the Discord
gate re-derivation (env snapshot included). An adapter with no baseline
keeps its loaded gates. Covers every caller (Telegram + Discord,
message, voice, slash, component).
2026-11-13 03:09:06 -08:00
Teknium
777212327b test(gateway): the topic/bot gate edit test runs as a multiplexed profile
As a single profile the reload also rewrote the bridged TELEGRAM_ALLOWED_TOPICS
env value, so the test passed even with allowed_topics dropped from
_LIVE_GATE_EXTRA_KEYS. A multiplexed secondary has nothing bridged into env,
so only the extra refresh can carry the edit: that mutant now fails.

Co-authored-by: BearHuddleston <196404565+BearHuddleston@users.noreply.github.com>
2026-11-13 02:34:09 -08:00
Teknium
af99913e88 fix(gateway): the live allowlist baseline is the config version that built the gates
mark_live_gate_baseline() recorded config.yaml's version at connect time, but
startup loads the config earlier and may spend minutes on dependencies first;
an allowlist tightened in that gap then matched the baseline and was skipped
until another edit. load_gateway_config() now stamps each PlatformConfig with
the version taken before its read, and the baseline uses that stamp (falling
back to the current version for a config built some other way).
2026-11-13 02:10:43 -08:00
Teknium
f4140920a1 fix(gateway): a config.yaml load that raises restores the env its hooks bridged
yaml_env_refresh() already skipped retraction after a failure, but values
yaml_env_setter() had rewritten earlier in the same load stayed in os.environ,
so the adapter (last good lists) and the runner (process env) checked different
policies. The load records each name's prior value and marker on first write and
restores them when the load raises.
2026-11-13 02:09:50 -08:00
Teknium
a743d654fb fix(gateway): the live allowlist refresh applies the one config.yaml load it checked
refresh_live_gate_extra preflighted load_yaml_layer and then called
load_gateway_config(), which read config.yaml again and swallowed a transient
failure into an env-only config: the refresh popped the YAML gates and recorded
the edit as applied. load_gateway_config(strict=True) raises that failure
instead, and the refresh applies the result of that single load.
2026-11-13 02:09:06 -08:00
Teknium
1f64e99210 fix(telegram): refresh allowed_topics and allow_bots with the other live gates
Co-authored-by: BearHuddleston <196404565+BearHuddleston@users.noreply.github.com>
2026-11-13 01:44:45 -08:00
Teknium
6d1b6300f7 fix(telegram): refresh live gates before the allowed_chats command gate
Co-authored-by: BearHuddleston <196404565+BearHuddleston@users.noreply.github.com>
2026-11-13 01:44:41 -08:00
Teknium
c96945314d fix(discord): refresh live gates before the bot-author branch
Bot-authored messages never reached _is_allowed_user's refresh, so an
allow_bots edit waited for human traffic.

Co-authored-by: BearHuddleston <196404565+BearHuddleston@users.noreply.github.com>
2026-11-13 01:44:36 -08:00
Teknium
fa6be51eb7 fix(gateway): keep last good allowlists when a config.yaml edit fails any loader stage
refresh_live_gate_extra guarded only the YAML parse; a later load_yaml_layer
failure made load_gateway_config() return the env-only config and popped the
YAML-held lists. Guard the whole YAML stage and warn once per failing version.

Co-authored-by: BearHuddleston <196404565+BearHuddleston@users.noreply.github.com>
2026-11-13 01:44:31 -08:00