7524 Commits

Author SHA1 Message Date
unsupportedpastels
84a0301415 fix(review): the background review never asks the user for a skill's API key
The background review thread runs with the finished turn's ContextVars
(propagate_context_to_thread), so it inherits the session owner's
turn-scoped secret prompt. When the review opened a skill whose required
env var is missing (skill_view of the bundled linear skill without
LINEAR_API_KEY), the masked "Enter value for ..." panel popped up on the
user's screen after the turn had already ended, and the review waited up
to the 120s prompt deadline for an answer.

The review already resolves dangerous-command approvals to "deny" without
asking anyone. Give it the matching secret capture: bind a non-interactive
callback for the review fork that reports the setup as skipped. The bound
ContextVar wins over both the turn's viewer prompt and the classic CLI's
process-global callback, and /refine reviews take the same path.
2026-11-05 08:18:19 -05:00
Teknium
c55af2c93b fix(redact): braced ODBC literals with password characters are not templates
Delta review of 73c68b21330 (P3): widening the code-template test to
cover interpolations also exempted brace literals that open with a
letter or digit, so a code-mode read of appsettings.json left
PWD={P@ssw0rd!}, {Tr0ub4dor&3} and {9f$kL2@pq} readable (main leaks
them too). A template slot never contains @ $ & #, or a ! other than
a !r/!s/!a conversion, so those characters now mark an ODBC literal.
Every interpolation from the previous round ({os.environ['DB_PASS']},
{get_pw()}, {pw!r}, {pw!s:>10}, {1:s}) stays as written.

Still unmasked in code reads, as on main: a brace literal made only of
identifier characters ({hunter2-Secret.99}), which can't be told apart
from {cfg.secret_name}.
2026-11-05 04:05:45 -08:00
Teknium
05791d79b0 fix(redact): mask quoted Basic pairs in lists; keep interpolated ODBC templates
Delta review of 10680b3d15a found:

- The whole-value lookahead added for PROXY_DEST rejected a Basic pair
  whose quote opens before the NAME, so "MY_PROXY_BASIC=user:pw" in a
  YAML list, a JSON/Python array or a single-quoted string leaked again
  in force mode. Closing quotes, ] and } and a backtick now end the
  value too; a / still does not, so PROXY_DEST keeps its path.
- The ODBC template test accepted only bare identifiers, so code reads
  (cat app.py) masked f-string and C# interpolations:
  {os.environ['DB_PASS']}, {config["Db:Password"]}, {get_pw()},
  {pw!r}, { pw }, {1:s}. A brace opening with a digit or identifier
  and carrying no ; or nested brace is a template now. {Zq7x;LmP2},
  {abc}}def} and {#...} still count as ODBC literals and are masked.

The new cases fail on 10680b3d15a and pass here.
2026-11-05 04:05:45 -08:00
Teknium
19b7ab86f1 fix(redact): braced ODBC passwords in file reads, escaped JSON fields, partial Basic pairs
Fixes three review-bot findings on 500d5e91cfb:

- A braced ODBC password read from a file stayed readable:
  redact_terminal_output("Server=db;UID=app;PWD={Zq7x;LmP2};...",
  "cat appsettings.json") runs with code_file=True, and the template
  exemption took {Zq7x;LmP2} for a format slot. On a ;-delimited line
  only a format slot ({0}, {pw}, {db.password}) or ${VAR} counts as a
  template now, so ODBC's literal braces are masked.
- Affixed JSON keys missed escaped JSON: a tool result wrapping a config
  dump ({"output": "{\"DB_PASSWORD\": \"...\"}"}) and a value carrying
  an escape ("s3cret\\value"). An escaped twin of the affixed-key
  matcher shares the same key policy, and the value grammar now
  consumes \x escape pairs.
- The force-only NAME=user:pass rule matched a prefix of the value, so
  PROXY_DEST=buildhost:Release2026/artifact.tar lost its path. The pair
  must now be the whole value.

The new tests fail on 2e34be9dc4a and pass here.
2026-11-05 04:05:45 -08:00
Teknium
de894bad56 fix(redact): keep colon values, docs URLs and secret metadata readable
Independent review of 500d5e91cfb found three classes of ordinary output
that the new rules started masking:

- NAME=user:pass ran on any NAME, so force-mode callers (process output,
  session history, approval and MCP paths) turned IMAGE=redis:7-alpine,
  BRANCH=origin:feature-login2, LS_COLORS and Server=tcp:db,1433 into
  NAME=x:***. The rule now needs a NAME that says it holds a Basic pair
  (auth, basic, cred, login, proxy, userpass, userinfo):
  MY_PROXY_BASIC=user:pw and PROXY_CREDS=bob:pw are still masked.
- JSON keys that contain a secret word but don't end in one are metadata
  about it: passwordChanged, password_expires_at, password_policy,
  tokenUrl, secret_id, secret_arn and PASSWORD_STORE_DIR carry
  timestamps, URLs and ids, and the opaque-value test let those through.
  Only keys that end in the credential word (an optional _value suffix
  aside) are masked now, and a true/false/null answer to has_password
  is left alone.
- URL userinfo masked templates and docs samples outside code files:
  f"https://{user}:{pw}@host", user:{password}@ and
  "https://user:password@host" now stay as written everywhere.

Smaller fixes in the same files: a quoted Helm/Jinja template
(password: "{{ .Values.pw }}") stays readable, and "the pwd= flag and
host= flag" is no longer read as a conninfo field. "password = x" with
spaces on both sides still is.

All three leak families from the PR still mask. The new keep-cases fail
on 500d5e91cfb (11 of them) and pass here. The worst adversarial timing
is 0.28 s on 200k characters (9,000 JSON *_token keys).
2026-11-05 04:05:45 -08:00
Teknium
ab1c5e110d fix(redact): scan separator-glued prefixed keys in the one prefix pass
The separate after-separator pass doubled the cost of a 200k `-sk-` /
`_ghp_` flood. Fold it into the masking scan (lookbehind `(?<![A-Za-z0-9])`
admits a `-`/`_` before the prefix, the callback keeps a glued match only
when its body is opaque) and group the alternation by first char so each
candidate position is rejected in one step. The opaque-body test walks
16+ char alnum runs with finditer instead of splitting the whole match.
2026-11-05 04:05:45 -08:00
Teknium
a9d55a3603 refactor(redact): move keyword/value connection-string masking to agent/redact_connstr.py
No behaviour change. The ADO.NET/ODBC/libpq scanner from the previous
commits is self-contained; moving it keeps agent/redact.py under the
2,000-line file cap.
2026-11-05 04:05:45 -08:00
Teknium
fb637f5bc8 fix(redact): mask affixed JSON secret keys and separator-glued prefixed keys
Fixes #147240 families 2 and 3.

`{"API_TOKEN": "..."}`, `{"DB_PASSWORD": "..."}`, `{"client_secret": "..."}`
leaked because _JSON_FIELD_RE only matches a closed key list, while the
ENV and YAML passes accept affixes. A second JSON pass now takes any
identifier-shaped key, applies the YAML word set at a word boundary plus
the shared assignment gate, and for keys that do not END in a credential
word (`password_policy`, `secret_ref`) masks only opaque values, the
is_secret_field_name policy.

`backup-sk-...`, `backup_sk-...` and `x-ghp_...` leaked because the
prefix matcher's lookbehind rejects `-`/`_` (so `scikit-learn` stays
whole). A separate after-separator matcher keeps the known-prefix +
length shape and additionally requires a 16+ char mixed-class run in
the body, so `backup-sk-learn.txt` and `deploy-sk-prod-deployment-01`
stay readable.
2026-11-05 04:05:45 -08:00
Teknium
aaeecaf125 fix(redact): keep placeholder userinfo and word-only image tags readable
The userinfo and NAME=user:pass passes masked `https://user:${TOKEN}@host`,
`https://user:<password>@host`, `MY_BASIC=user:${PASSWORD}` (docs samples
main keeps readable for DSNs via _DSN_PW_PLACEHOLDER_RE) and
`TAG=myrepo:latest-release` (a lower-case word tag, never a password).
2026-11-05 04:05:45 -08:00
liuhao1024
4591a06208 fix(redact): a one-letter user: is a Windows drive and sha256: a digest label, not a Basic pair
The force-only NAME=user:pass rule (#125664) matched single-letter users, so
SRC=C:\Users\admin\Documents\report.pdf collapsed to SRC=C:*** at persistence
boundaries — unrecoverable data loss on a written-back .env. The same pass ate
CHECKSUM=sha256:<hex> digests (#125680 review).

- the user half now needs >=2 characters: a single-letter user: is a Windows
  drive; a secret-keyword NAME still masks via the ENV pass on every path
- a known hash-algorithm name as the user half (sha256:1234..., ubuntu@sha256:...)
  marks an algorithm:digest, not a credential
2026-11-05 04:05:45 -08:00
liuhao1024
ed3df402a6 fix(redact): stop the basic-pair rule from mangling tags, timestamps and registry paths
The force-only NAME=user:pass pass destroyed stored values that merely
look colon-y: an ISO timestamp with a fraction (TS=...T12:00:00.123456Z
lost its tail), a letter-bearing image tag (IMAGE=ubuntu:24.04-noble) and
a registry reference (TARGET=registry.example.com:5000/repo lost host,
port and path) — data loss at the persistence boundary, not display.
The password group is now a single token (no '/', ':' or '@'), so a
timestamp tail truncates to digits and a registry path stays whole, and
digit-led dotted version tails (24.04-noble, v1.2.3-alpine) are rejected
outright. '@' no longer ending up in the group also lets a
user:{pw}@host value keep its pure brace expression, to which the
promised #33801 f-string template exemption is now actually applied
(code_file), matching _redact_userinfo_passwords.
2026-11-05 04:05:45 -08:00
liuhao1024
dc6149b22d fix(redact): mask URL userinfo passwords and force-redact user:pass assignments
The userinfo password is masked on every path — #34029's pass-through
was about query-string round-trip tokens (magic links / OAuth callbacks
live in the query, never in userinfo), the same reasoning #6396 used
for the bare-token form; code_file keeps f-string {…} templates intact
(#33801's rule). NAME=user:pass pairs under innocuous names are masked
force-only with an 8-char letter-bearing floor, so the issue's negative
controls (host:port, scheme URLs, ISO timestamps, image tags) stay
untouched on every path.
2026-11-05 04:05:45 -08:00
arbianshkodra
fb4553d477 fix(redact): linear-time connection-string key scan and exact value grammars
Key patterns now start at the key name behind a fixed-width lookbehind;
the old (?:^|[;\s])\s* prefix rescanned whitespace runs from every offset
(16K spaces before password= took ~30s). Value extents come from a
non-backtracking scanner per grammar: ODBC braces with }} escapes,
ADO.NET doubled quotes, libpq backslash escapes and bare ';' inside
libpq values. One companion-key scan per line.

Reported by @Tsury.
2026-11-05 04:05:45 -08:00
arbianshkodra
037b8da607 fix(redact): mask PGPASSWORD/MYSQL_PWD/SSHPASS and libpq conninfo passwords
The word-boundary key rule means PGPASSWORD, MYSQL_PWD and SSHPASS never
count as password keys (the keyword is glued onto a prefix), so export,
env dumps, docker -e and systemd Environment= lines leaked them verbatim.
Treat those exact names as credential keys. Bare PWD/OLDPWD (cwd) and
PGPASSFILE (a path) are unchanged.

libpq's space-delimited conninfo (psql "host=db password=x") had no ';'
and skipped the keyword/value connection-string pass. Accept it when the
line carries a companion connection key; an unquoted value ends at
whitespace.
2026-11-05 04:05:45 -08:00
arbianshkodra
5eb9cfb731 fix(redact): mask passwords in keyword/value connection strings 2026-11-05 04:05:45 -08:00
Mark
22f12965e4 fix(redact): mask password-concatenated keys (dbpassword, rootpasswd)
agent/redact.py validates assignment keys with _has_word_bounded_keyword,
which needs the secret keyword to both START and END on a word boundary
(so `Secretary:` / `tokenizer:` prose is left alone). That also passes
concatenated credential keys in clear: on main `dbpassword: hunter2xyz`,
`dbpassword=hunter2xyz`, `rootpasswd: s3cr3t` and
`app.dbpassword=hunter2xyz` are returned unchanged with force=True.

No prose word ends in `password` / `passwd`, so for those two keywords
only the END boundary is required (_has_password_keyword), and such keys
are password-class: any literal value is masked, as for `db_password`.
`passwordless: enabled` stays readable; all other keywords keep the
two-sided boundary.

4 new concatenation cases fail on main and pass here (the camelCase
`mysqlPassword` already passed); the `passwordless` negatives pass on
both.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-05 04:05:45 -08:00
Teknium
50aacf7f92 fix(redact): keep empty and placeholder quoted YAML scalars readable
The quoted-scalar YAML pass masked `password: ""`, `api_key: "<your key>"`
and `api_key: "${API_KEY}"`, which main kept readable (the JSON pass skips
an empty value and _redact_db skips the same placeholder shapes). Reuse
_DSN_PW_PLACEHOLDER_RE so docs samples and env refs stay visible.
2026-11-05 04:05:45 -08:00
Evo
8e3321b871 fix(redact): mask quoted-value YAML config secrets missed by #53590
quoted values, deferring to _JSON_FIELD_RE -- but that rule requires a
quoted KEY, which bare-key YAML never has, so quoted scalars such as
`password: "secret"` / `api_key: "ak_live_..."` leaked verbatim with
redaction on by default (special-char passwords are forced to be quoted
in YAML, so the highest-risk values were exactly the skipped ones).

Drop the lookahead and match either a quoted scalar or an unquoted
token. The quoted alternatives are escape-aware (double-quote \", single
-quote doubling ''), bounded to a single line (LF and CRLF), and
fail-closed for an unterminated quote (masked to end-of-line). _redact_yaml
masks the inner secret while preserving the wrapping quotes; the prose and
URL carve-outs are unchanged. Adds regression tests.
2026-11-05 04:05:45 -08:00
yoniebans
8e7cf55eb6 fix(agent): a task with its own URL re-probes when that URL's pin changes
The route identity read a provider entry's context pin only for a task that names the entry. A task with `provider: custom` and its own `base_url` returned early, but the probe still reads the pin of the entry at that URL, so lowering only that pin (900K to 80K) left a warm agent's trigger on the old window. The identity now carries the pin for the route's own URL too.

Reported-by: greptile-apps[bot]
2026-11-05 12:09:34 +01:00
yoniebans
129e86cd1d fix(agent): a moved compression route clears the previous summariser's cooldown
A failure cooldown recorded for a retired summariser kept compression paused after the route moved to a working replacement (almost 300s in the reproduction), because nothing cleared it when only the side-task route changed. A detected route move now clears the cooldown through the compressor's own clear (in memory and in the session row), and preflight checks the route before it reads the cooldown, so the same pass can compress.

Reported-by: helix4u
2026-11-05 12:09:34 +01:00
yoniebans
6ac5474f28 fix(agent): the feasibility latch records the route read before the probe
The latch read the compression route after the probe, so an edit that landed while the probe ran was recorded as measured and the next request skipped re-probing. Each latching path now reads the route first and records that one.

Reported-by: helix4u
2026-11-05 12:09:34 +01:00
yoniebans
8a39468c52 fix(agent): a changed provider context pin re-probes a warm agent
The compression route identity recorded the task block and a named entry's URL and default model, but not the context_length pin the probe reads for that model. Lowering only that pin (a replacement summariser on the same endpoint, 900K to 80K) left a warm agent's trigger on the old window. The identity now carries the pin get_custom_provider_context_length resolves for the compression model at the entry's URL. The regression drives the warm path through ensure_compression_feasibility_checked.

Reported-by: helix4u
2026-11-05 12:09:34 +01:00
yoniebans
884a3bbbf7 refactor(agent): import the feasibility probe functions from their own module
The probe-timing functions moved to conversation_compression_feasibility.py but stayed re-exported from conversation_compression.py, against the AGENTS.md rule that internal moves get no re-export shim. Callers (route_binding, agent_runtime_helpers, chat_completion_helpers, turn_preflight) and the feasibility tests now import them from the new module, and the moved names leave conversation_compression's __all__. No behaviour change.

Reported-by: greptile-apps[bot]
2026-11-05 12:09:34 +01:00
yoniebans
ab0dde92fa fix(agent): a bypass session's compression probe keeps its own provider entries
Measuring the compression model read the profile's providers: entries even inside a --safe-mode or --ignore-user-config chat, the one remaining place such a chat consulted the profile. Inside a bypass session the probe now uses the entries captured at agent start.

Reported-by: unsupportedpastels
2026-11-05 12:09:34 +01:00
yoniebans
7c00c01c98 fix(gateway): bypass sessions keep the built-in side-task defaults
A --safe-mode or --ignore-user-config chat got an empty auxiliary section, so the built-in per-task defaults (vision's 120s timeout, goal_judge's 60s, voice_chat's reasoning setting) fell back to the 30s client default. Its side tasks now use the session's own saved section, which holds code defaults only, so the profile is still never read. The bypass test asserts the vision timeout inside a bypass policy_scope.

Reported-by: unsupportedpastels
2026-11-05 12:09:34 +01:00
yoniebans
e4066c1e5a fix(agent): measure the compression model against today's provider entries
The feasibility probe passed the provider entries captured at agent start, so a per-model context_length pin edited later (a replacement summariser on the same endpoint) was ignored and the old pin set the compression trigger. The probe now reads the entries from config.yaml, falling back to the captured list when config cannot be read.

Reported-by: greptile-apps[bot]
2026-11-05 12:09:34 +01:00
yoniebans
3ad3c4101a fix(agent): trust a feasibility latch that recorded no route
An agent marked as probed without a recorded route (set before route tracking existed, or by a caller that sets the latch directly) now keeps its verdict as it did before, instead of being treated as a moved route and probed again. CI caught this on the compaction suites, whose agents set the latch by hand; 28 tests across six files failed with the probe running on a stand-in agent.
2026-11-05 12:09:34 +01:00
yoniebans
95683f47fa fix(agent): re-probe compression feasibility when the compression route moves
The feasibility probe ran once per agent and lowered the compression trigger to the summariser's window. Now that a cached agent can meet a new compression route mid-session, every path that latches the probe (first near-threshold request, main-model switch, first compaction) records the route it measured: provider, model, URL, context length and the URL of a `providers:` entry the task names. A later request on a different route drops the old ceiling and probes again, measuring the new summariser with the context_length configured now rather than the one captured when the agent was built. A route the check cannot read (a malformed entry) re-arms the probe instead of raising out of the main request. The probe-timing functions move to conversation_compression_feasibility.py and stay re-exported.
2026-11-05 12:09:34 +01:00
yoniebans
2afffc46ba fix(gateway): side tasks read the profile's config.yaml, like every other side-task reader
A local session's compression, vision and title routes came from the copy of `auxiliary:` saved when the chat was created, while background review, /btw, /review, the curator, vision's model and every `providers:` entry the routes name were read from config.yaml. A retired side-task model therefore kept failing in every older chat, and a saved key could reach an entry's new URL. Side tasks now read the profile's config.yaml in every in-process chat, as messaging chats already do. The chat's main model and route keep the saved config, --ignore-user-config / safe-mode sessions still see no profile at all, and managed workers keep their session snapshot as a whole.

This replaces the earlier rule that a changed side-task key sends the task back to the main model; the recovery test now asserts the new key reaches the next call.

The automatic-selection case is adapted from Gille's reset-compression regression tests in #147679.

Co-authored-by: Gille <4317663+helix4u@users.noreply.github.com>
2026-11-05 12:09:34 +01:00
Teknium
36b29e812a fix(agent): anchor the intent-ack tool gate on this turn's own user row
`tool_results_this_turn` stops at the most recent user row, and the loop
appends synthetic user rows inside a turn (empty-after-tool, stall,
degenerate, dropped-tool-call and stop-gate nudges). After one of them
the gate saw zero tool rows, so a finished answer that had already run
a tool got the "execute the required tool calls" nudge and an extra
call. Anchor on the turn's own user message via the helper compaction
already uses (reanchor_current_turn_user_idx), so nudge rows start no
new turn while the earlier-turn fix stays.

Patch and test by @BearHuddleston from his review of #148866.

Co-authored-by: BearHuddleston <196404565+BearHuddleston@users.noreply.github.com>
2026-11-05 02:24:20 -08:00
ClaySecAI
6190ffdc32 fix(agent): scope the intent-ack no-tools gate to the current turn
looks_like_codex_intermediate_ack refused to fire whenever ANY message
in `messages` was a tool result. The turn loop passes the whole session
there (gateway, CLI, resumed sessions), so once a session had run one
tool the guard was dead for every later turn: an "I'll run the tests
now." with no tool call ended the turn instead of getting the bounded
continuation nudge. Fresh sessions were unaffected, which is why it read
as "works in one-shot, broken in the gateway".

The gate's intent (ce175d73722) is "the model has not acted yet this
turn"; it now reads tool_results_this_turn(), the same window the
degenerate-final guard already uses. Tool rows inside the current turn
still end it, so the codex_only "acted, then summarised" path is
unchanged.

Salvage of #69779 by @ClaySecAI (current-turn gate scoping, commit
cb7313d9e7f). The vocabulary widening, colon-ack, after-tool relaxation
and clarification-recovery atoms are not included.

Fixes #69778
2026-11-05 02:24:20 -08:00
Teknium
e26e0e4b67 fix(redact): long quoted flag values and bracketed key values stay masked
Two leaks that 6715bfd had opened relative to the previous head:

- A double- or single-quoted flag value with no closing quote within
  512 characters fell back to `\S+`, so only its first word was masked
  and the rest of the secret stayed visible. An unterminated or
  over-long quote now masks to the end of its line. The match is
  possessive, so it still never rescans the text.
- Under a qualified key (signing_key, private_key, ...), any value in
  angle brackets was treated as a docs placeholder, so
  `{"signing_key": "<hunter2>"}` passed through. Only word-shaped
  samples (`<your key>`, `<api_key>`, `<token>`) are exempt now.
2026-11-05 02:13:35 -08:00
Teknium
dcd213df8a fix(redact): escaped and multi-line quoted flag values mask whole, marker-prefixed values are masked, a SAS stops after its signature
Round-4 review of d5f78d3:
- "a\"b c" and the shell 'a'\''b c' splice were cut at the first inner quote,
  leaving the tail visible; a quoted value that spans a newline masked only
  line 1. The quoted branch now honours escapes, may span newlines and is
  capped at 512 possessive characters, so an unterminated quote falls back
  to \S+ without rescanning the text.
- A value that merely starts with ***, «redacted or [REDACTED was skipped
  (--password ***MyRealPass9, AccountKey=***<key>==, a file_read tail after
  «redacted:ghp_…»). Only a value that IS a marker is skipped now.
- A SAS value ran to ; or whitespace and ate &foo=bar, a markdown ) and a CSV
  ,col2. It now ends after its sig= parameter or at ) , | and backtick.
- Qualified key names (encryptKey, master_key, private_key) no longer mask
  the non-secret samples true/false/yes/no/null/none/default and <placeholder>.
2026-11-05 02:13:35 -08:00
Teknium
488e162610 fix(redact): mask key blocks before flag values, whole quoted values, full SAS, gutter .ppk, file-read markers, short signing keys
Greptile round on 6eb25fd:
- PEM bodies become visible: private-key block passes now run before the
  flag/connection-string passes, so AccountKey=-----BEGIN ... is masked whole.
- File masks resemble usable credentials: flag/connstr values take the
  file_read non-reusable sentinel and existing markers are not re-masked.
- Quoted password tails remain visible: single and double quoted flag and
  container-login values are matched separately.
- Azure signatures remain visible: a SharedAccessSignature value runs to the
  next ';' instead of stopping at '&'.
- PuTTY file reads reveal keys: .ppk body lines accept read_file's gutter.
- Short signing secrets remain visible: the JSON/ENV assignment gate uses
  the qualified-key policy is_secret_field_name already applies.
- The PEM pass gate requires -----END, which the pattern needs anyway; it
  drops a 1 s scan on repeated BEGIN headers.
2026-11-05 02:13:35 -08:00
Teknium
dad96e3b8e fix(redact): mask passphrase-shaped flag values and $/<>-prefixed URL passwords, AccountKey after , ? &
Round-2 review: the metavar skip let all-letter passphrases through
(--password correct_horse_battery_staple, --token correctHorseBatteryStaple);
it now only covers two short snake words or one-hump camelCase (db_name,
stringArray). The password-only URL placeholder exemption now requires an
upper-case env var (${REDIS_PASSWORD}) or a lower/ALL-CAPS name in angle
brackets (<password>), so redis://:$ecretPassw0rd@ masks. The Azure key
gate also opens a segment after , ? and &.
2026-11-05 02:13:35 -08:00
Teknium
11cd1a0d54 fix(redact): leave source and help text alone, mask CRLF .ppk, TLS URLs and YAML key names
Review findings on the salvage head:
- Azure connstr keys only match as a connection-string segment (``;AccountKey=``); Primary/SecondaryKey
  dropped, so ``this.primaryKey = x`` / ``dt.PrimaryKey = new ...`` pass through read_file and terminal.
- Flag values: no whitespace after ``=`` (``--password= or -p``); snake_case and camelCase metavars
  (``db_name``, cobra's ``stringArray``) and ``...xxx`` doc samples are placeholders.
- Password-only DSN placeholders (``redis://:<password>@``, ``:${REDIS_PASSWORD}@``) stay readable.
- PuTTY Private-Lines accept CRLF and JSON-escaped line ends.
- ``rediss://`` and ``amqps://`` are DSN schemes.
- YAML ``signing_key:`` / ``private_key:`` / ``signingKey:`` names join _YAML_CFG_NAMES.
- _DB_CONNSTR_RE userinfo and password runs are possessive: 100 KB of ``redis://:`` or ``redis://u:``
  goes from 4.7 s / 4.3 s to ~20 ms. PGP scan gated on its END marker (1 s -> 7 ms).
2026-11-05 02:13:35 -08:00
Teknium
82a26feefe fix(redact): leave --help metavars, prose and file paths after a secret flag alone
The space-separated flag rule masked whatever word followed `--token` /
`--password`, so ordinary output lost text: `--help` usage lines
(`[--password PASSWORD]`, `--token TEXT   API token`), prose ("use --token
to pass a token"), sub-option specs (`docker build --secret id=npmrc`) and
the next flag. `docker login ghcr.io; docker run -p 8080:80` also masked
the second command's port because the login context crossed `;`.

A space-separated value is now skipped when it is an upper-case metavar, a
short lower-case word, another flag/bracket, or a `name=` sub-option; a
non-password flag naming a file path (`--credentials ~/.config/x.json`) is
skipped the way the ENV passes skip path values. The login `-p` context
stops at `;`, `|` and `&`. `--account-key` (az CLI) is added to the flag
names. Equals-form values and quoted values are always masked.
2026-11-05 02:13:35 -08:00
Baophan00
8b595d0115 fix(redact): mask password-only connection strings
A connection string whose user part is empty printed its password in full.
The DB rule required a user, so `redis://:PASSWORD@host`,
`mongodb://:PASSWORD@host` and `amqp://:PASSWORD@host` -- how redis-cli and
Mongo URIs are usually written -- passed every surface (egress scrub, chat
text, terminal output). The fix only relaxes the user part, so
`https://host:8443` and `postgres://user:pw@host` behave as before.
2026-11-05 02:13:35 -08:00
Baophan00
57f284e700 fix(redact): mask PGP, PuTTY .ppk and age secret keys
All three reproduced on current main: PGP armour never matched the PEM pattern because
of its ' BLOCK' suffix, a .ppk keeps its key as base64 under 'Private-Lines:' (the usual
SSH key format on Windows), and age writes a bech32 AGE-SECRET-KEY-1... string. Each
reached the model, the transcript and every chat surface verbatim (#144023).

The .ppk rule keeps the header and masks the body, so the file still reads as a key
without carrying one.
2026-11-05 02:13:35 -08:00
Baophan00
99507568f4 fix(redact): mask key-qualified names, flag-passed secrets, conn-string keys and base64 PEM keys
Four credential shapes reached the model, the transcript and chat surfaces verbatim:

- field names ending in `key` (aws_secret_access_key, SECRET_KEY, privateKey,
  signing_key, encryption_key) were not secrets for is_secret_field_name, so the MCP
  trust-gate prompt and delegation redaction printed them in full (#143974).
- secrets passed as flags (--password=, --token=, docker login -p) and Azure
  connection-string keys (AccountKey=, SharedAccessKey=) skipped every ENV pass, which
  only reads NAME=value with an underscore boundary (#143982).
- kubeconfig's client-key-data, a base64 PEM, matched no private-key pattern and is
  skipped by the assignment passes on source-shaped terminal output (#144023).

The key-name rule needs a qualifier word (secret/private/signing/encryption/master/
hmac/access) before `key`, so key_id, public_key, hotkey and cache_key stay readable.
Flags keep their name and only the value is masked; $VAR references and bare numbers
are left alone.
2026-11-05 02:13:35 -08:00
kshitijk4poor
ddf69149ed fix(memory): keep refused saves a 400 across the plugin host; hooks survive SystemExit
- plugin_host_wire: an error crossing the host now carries the nearest builtin base
  class, so a ValueError subclass (json.JSONDecodeError) raised by a hosted provider's
  write_config_fields is still a ValueError in core and the dashboard returns 400, not 500.
- notify_memory_provider catches SystemExit as well as Exception: a provider hook that
  exits no longer skips rename's alias, active-profile and identity updates.
- Docs and docstring: a key missing from the target profile's .env reads as unset; the
  hooks never fall back to the caller's environment.
- Memory panel GET maps a provider read failure like PUT does (ValueError -> 400).
- One helper for submitted secrets; the Honcho placeholder rule moves into its storage
  branch so the field loop no longer branches on storage kind.
- Tests: wire round-trip of error classes, SystemExit hook, missing-secret fail-closed,
  and the failing-hook test now asserts both hooks ran.
2026-11-05 13:08:14 +05:30
kshitijk4poor
e090092285 feat(memory): profile lifecycle and config-storage seams for memory providers
A catalog memory provider (Honcho today) has no way to own its per-profile setup or its
dashboard config file, so core carries that code for it: profile create/rename edit Honcho's
host blocks and the dashboard has a Honcho-only storage kind that imports the plugin's private
modules. These seams let a provider do that work itself; core's Honcho code is untouched here
and is removed in a follow-up once the plugin implements them.

- MemoryProvider.on_profile_created(profile_name, hermes_home) / on_profile_renamed(old, new,
  hermes_home): called from create_profile (CLI, dashboard, Desktop/TUI) and rename_profile for
  the provider the profile's effective config selects, with that profile's home and its own
  .env secrets bound. A failing hook or unreadable config is logged and never fails the create
  or rename. No-ops by default.
- storage=STORAGE_PROVIDER in config_schema.py, with read_config_fields(hermes_home) /
  write_config_fields(values, hermes_home): the provider owns its file layout. Core keeps
  value coercion, placeholders, write-only secrets, the memory.provider switch and the 400 on
  a refused write, and saves secrets to .env only after the provider accepted them.

_record_profile_rename moves to profile_identity.py (profiles.py line budget).
2026-11-05 13:08:14 +05:30
Teknium
be765e31d8 fix(compression): scope the summary-abort to Gemini prompt blocks only
Other providers' content-policy refusals of the summary call keep main's fallback-summary
path; only the Gemini prompt block (which used to arrive as empty content) stays terminal.
2026-11-04 21:47:30 -08:00
Teknium
2c622fde37 fix(gemini): prompt-block guidance covers only real blockReason values and prefers blockReasonMessage
Review nit: RECITATION/SPII/LANGUAGE are candidate FinishReason values, never a
promptFeedback.blockReason, so drop them from the guidance table; use Vertex's
promptFeedback.blockReasonMessage when present.
2026-11-04 21:47:30 -08:00
Teknium
9c1799ed1a fix(compression): a safety-blocked summary request aborts with the transcript intact
Review finding: when Gemini blocks a compression summary request, compression
now drops the middle turns. The native adapter raises the prompt block as a
content-policy GeminiAPIError instead of returning empty content, so
_classify_summary_failure no longer put it in the terminal (refusal) class.
Count the classifier's content_policy_blocked verdict as that class, which also
aborts on other providers' content-policy refusals of the summary call.
2026-11-04 21:47:30 -08:00
Teknium
889b81e555 fix(gemini): surface promptFeedback.blockReason as a terminal content-policy error
Gemini answers a blocked prompt with HTTP 200, promptFeedback.blockReason
and no candidates. The adapter translated that into an empty "stop" turn,
so the user saw silence. Both the unary and the SSE path now raise a
GeminiAPIError (code gemini_prompt_blocked, no synthesized HTTP status)
carrying per-reason guidance, and the classifier routes that structured
code to content_policy_blocked (non-retryable, fallback-eligible).
2026-11-04 21:47:30 -08:00
Teknium
73bfb9ce7e feat(compression): keep uncertain claims labelled UNVERIFIED through compaction
Summaries shed qualifier words first, so "I suspect X" either hardens into
"X" (a fact the resumed agent acts on) or drops out entirely. The summarizer
prompt now asks for each uncertain claim as an explicit labelled line
("UNVERIFIED: <claim> — <basis>") under a new "## Unverified / Working
Hypotheses" section, on both the first-compaction and iterative-update paths.

The text lives in the new agent/context_compressor_prompt_rules.py sibling
(which also takes _today_for_prompt off the facade); the facade only
interpolates it. Summarizer prompt only: system prompt, cached
prefix and the persisted handoff prefix are unchanged. Cost: +288 chars per
summary call (~+79 prompt tokens measured live), down from +756 in the
first version of this change.
2026-11-04 21:31:47 -08:00
Teknium
5f0ea4b73d fix(lsp): no $/cancelRequest after shutdown or before InitializeResult 2026-11-04 21:30:14 -08:00
Teknium
0a801dbd65 fix(lsp): send $/cancelRequest when a request is abandoned
A request the caller gives up on (asyncio.wait_for timeout, or the pull/push
diagnostics race cancelling the loser) left the server computing the answer and
blocking requests queued behind it. The client now writes $/cancelRequest for
the abandoned id; the server's late answer to that id is dropped because the id
is no longer pending.

Live (pyright-langserver 1.1.x, documentSymbol on a 3000-def file abandoned at
1 ms): base -> pyright returns the full result for the abandoned id;
head -> pyright replies -32800 RequestCancelled. In both, the follow-up hover
(id 2) resolves with its own answer and the client stays running.
2026-11-04 21:30:14 -08:00
Teknium
0cb58a3647 test(pricing): drop the -0 sentinel row and its no-op copy_abs fold 2026-11-04 21:26:48 -08:00