Skip to content

fix(credentials): escape backslashes when the Credentials panel writes .env (abilityai/trinity-enterprise#1117) - #4297

Merged
vybe merged 13 commits into
devfrom
AndriiPasternak31/ent1117-s11-frontend-env-escaping
Nov 6, 2026
Merged

vybe merged 13 commits into
devfrom
AndriiPasternak31/ent1117-s11-frontend-env-escaping

Conversation

@AndriiPasternak31

Copy link
Copy Markdown
Contributor

Part of abilityai/trinity-enterprise#1117.

Journey Impact: none: the Credentials panel now keeps backslashes in saved values; no user step changes

Problem
The Credentials panel rewrites an agent's whole .env file every time a credential is saved. Its writer escaped " but not \. Its own reader, and the agent's unquote_env_value (#2023), both turn \\ back into \. So a credential containing two backslashes lost one the next time any credential in the file was saved, and the agent then authenticated with a value nobody supplied.

CodeQL flags this as incomplete sanitization:

  • one alert in the panel;
  • one in a composable that carries a copy of the same writer but that nothing imports;
  • one in ReplayTimeline.vue's formatGithubRepo, which has no caller.

The agent has a second reader of the same file. agent_server/mcp_template.py renders .mcp.json.template from .env at every container start. It reversed \" but not \\, so it already disagreed with the agent's own writer and the backend's. Once the panel escapes the backslash, it would also have rendered a panel-saved C:\path into .mcp.json as C:\\path.

Fix

  • The panel's .env value encoding moves, unchanged, into src/frontend/src/utils/envFile.js. The writer then escapes backslash before quote, which is the agent's own encoding. The reader is unchanged.
  • mcp_template.py now decodes each value exactly as execution_env.unquote_env_value does. One matched quote pair is stripped, and inside double quotes \" and \\ are reversed in a single scan. A rendered .mcp.json env value is therefore the same string the agent's executions receive.
    • The decoder is copied rather than imported because the module also loads flat, by file path, which is how its tests load it. In a flat load the name services can resolve to the backend package, which has no execution_env.
    • A test holds the copy equal to the original.
  • The comment and the feature-flow text that argued against widening the escaping predate bug(credentials): .env quote-escaping is write-only — a credential containing a double quote round-trips corrupted #2023, and are rewritten. The CLAUDE.md note calling .mcp.json.template rendering "not yet live" is corrected; startup.sh has run it since fix(agent): render .mcp.json.template at startup so declared MCP servers exist (#2007) #2013.
  • tests/unit/test_ent127_frontend_contract.py runs the panel's extracted reader and writer under node. It now loads utils/envFile.js into the same script, and its round-trip values include backslashes.
  • The unused useAgentCredentials composable and its re-export are deleted, and so is the uncalled formatGithubRepo.

Evidence

  • tests/fixtures/ent1117-env-escape-cases.json maps 19 values to the line the agent's format_env_line writes for each. The rows include a\\b, a"b, a trailing \, C:\path\new and a\"b.

  • tests/fixtures/ent1117-env-legacy-reads.json holds 21 lines the new writer never produces: the previous panel writer's output, plus single-quoted, unquoted, lone-quote, empty and malformed lines. For each line it records two values, both generated by running the reader:

    • what the previous panel reader returned;
    • what the agent's reader returns.

    The two differ on one row only: a lone ', which the panel reads as empty.

  • src/frontend/tests/unit/ent1117EnvEscape.spec.js (85 tests) checks:

    • the browser encoder and decoder against every row of the first table, including three read-write round trips;
    • the decoder against every row of the second;
    • two mounted Quick Inject runs, which show every existing line is carried over byte-for-byte, or as the value it was read as.

    Before the writer fix, 11 of 40 failed, including expected 'a\b' to be 'a\\b'. Breaking the decoder in any of five ways, for example unescaping any character or no longer stripping single quotes, turns it red, as in expected 'C:path' to be 'C:\path'.

  • tests/unit/test_ent1117_s11_env_escape_table.py (103 tests) checks the same tables against:

    • the agent's encoder, decoder and file parser;
    • the backend's agent_env_patch writer and reader;
    • mcp_template's reader per row, over a whole file, and through render() end to end;
    • every right-hand side of up to six characters drawn from \ " ' a (5,461 values), written both as K=v and as K = v.

    Before the mcp_template fix, 11 failed, including assert 'C:\\\\path\\\\new' == 'C:\\path\\new'. After it, all pass.

  • tests/unit/test_ent127_frontend_contract.py: 45 passed. With the encoder that escaped only ", the new a\\b values fail: assert 'a\\b' == 'a\\\\b'.

  • These 18 test files give 789 passed: test_ent1117_s11_env_escape_table, test_ent127_frontend_contract, test_2007_mcp_template_render, test_2008_dead_credentials_update, test_2392_execution_id_header, test_deploy_local_validation, test_ent127_service, test_ent128b1_compat_gates, test_1704_plugins_reinstall, test_1704_source_validator_parity, test_2023_env_quote_round_trip, test_ent966_agent_env_patch, test_1999_execution_env, test_2017_pat_line_escapes, test_ent1066_credential_sink, test_ent127_predicate, test_reload_token_endpoint and test_credential_sanitizer_agent, all under tests/unit/, run with pytest -p no:randomly.

  • The unit tests that walk the frontend or agent-server source pass, except three in test_3007_update_command.py that need apscheduler locally and fail identically on dev.

  • The Credentials panel specs, the raw-colour, loading-gate and source-text ratchets, and the source-walking frontend specs pass: 26 files, 406 tests. vite build succeeds, and there is no visual change.

  • Upgrade effect. mcp_template renders only one shape of existing line differently: a double-quoted value containing \\. For example, a line "a\\b" written by the old panel and not re-saved since used to render into .mcp.json as a\\b, and now renders as a\b, which is what the agent's executions have always received for it.

  • Both fixtures are in the frontend-build path filter.

Not covered

  • CodeQL confirmation that the three JavaScript alerts close, and that neither utils/envFile.js nor mcp_template.py raises a new one. That runs on this PR.
  • A run on a real agent built from this branch, showing a panel-saved C:\path\new rendered exactly into .mcp.json. The unit tests drive render() on files, not inside the image.
  • These are left as separate follow-ups:
    • Three single-key readers only strip quote characters: codex_runtime._parse_env_value for the OpenAI/Codex key, and the GITHUB_PAT lookups in startup.sh and git-credential-trinity.sh. Neither kind of key contains \ or ".
    • No .env writer refuses the Unicode line separators that str.splitlines() honours.
    • The uncalled utils.helpers.parse_env_content.

…e.js (Abilityai/trinity-enterprise#1117)

The Credentials panel's .env writer and reader move, unchanged, into one
module beside each other, so the encoding can be tested on its own and
against the agent's encoder. No behaviour change.
…s .env (Abilityai/trinity-enterprise#1117)

The panel rewrites an agent's whole .env on every save. Its writer escaped
`"` but not `\`, while its own reader and the agent's unquote_env_value
(#2023) both turn `\\` back into `\`. So a credential containing two
backslashes lost one the next time any credential in the file was saved,
and the agent then authenticated with a value nobody supplied.

The writer now escapes backslash before quote, which is the agent's own
encoding. The comment that argued against widening the escaping was
written before #2023 gave the agent a reader that unescapes, and is
rewritten to say what is true now.

One value -> line table (tests/fixtures/ent1117-env-escape-cases.json,
generated from the agent's format_env_line) is checked by a vitest spec
against the browser encoder, decoder and a mounted Quick Inject save, and
by a pytest against the agent's encoder, decoder and file parser and the
backend's agent_env_patch writer.
…ilityai/trinity-enterprise#1117)

Nothing imports it: the Credentials panel carries its own implementation,
and the composable's only reference was its re-export from
composables/index.js. It still held the old .env writer that escapes `"`
but not `\`, so it is removed rather than fixed.
…line (Abilityai/trinity-enterprise#1117)

The function has no caller in the component's script or template, or
anywhere else in the tree.
…er (Abilityai/trinity-enterprise#1117)

agent_server/mcp_template.py renders .mcp.json.template from .env at every
container start. Its reader reversed only \" and left \\ doubled, while every
writer of the file (the agent's format_env_line, the backend's agent_env_patch
and now the Credentials panel) escapes the backslash. A panel-saved C:\path
was therefore rendered into .mcp.json as C:\\path.

The reader now decodes exactly like execution_env.unquote_env_value: one
matched quote pair stripped, \" and \\ reversed in a single scan inside double
quotes, single-quoted values literal. The decoder is mirrored rather than
imported because importing the services package loads the runtime modules on
this standalone boot path.

The table test now holds mcp_template to the agent's reader per row, over a
whole panel-written file, over every right-hand side up to six characters, and
through render() end to end. A second fixture of lines the new writer never
produced (the old panel writer's output, single-quoted, unquoted and lone-quote
lines) pins every agent-side reader to what execution_env returns for them.
(Abilityai/trinity-enterprise#1117)
…ore (Abilityai/trinity-enterprise#1117)

The panel's reader also meets lines its new writer never produced: what it
wrote before backslashes were escaped, hand edits and Quick Inject pastes.
The spec now checks unquoteEnvValue against tests/fixtures/ent1117-env-legacy-reads.json,
whose panel column was produced by running the previous reader, asserts the
panel and the agent differ only on a lone single quote, and mounts the panel
to show a Quick Inject carries each such line over as the value it read.

Both fixtures join the frontend-build path filter, so a change to either runs
the browser spec as well as the pytest twin.
…Abilityai/trinity-enterprise#1117)

credential-injection.md still said the deleted useAgentCredentials composable
exists, that only " is escaped, and that widening the escaping would make the
agent-side mismatch worse; none of that has been true since #2023. It now
names the shared encoding, every reader of the file, the two fixtures that
hold them together, and the three single-key readers that only strip quotes.

CLAUDE.md said .mcp.json.template rendering is "not yet live"; startup.sh has
run it at every agent start since #2013.
…vers backslashes (Abilityai/trinity-enterprise#1117)

test_ent127_frontend_contract.py extracts parseEnvText and formatEnvContent
from CredentialsPanel.vue and runs them under node. Since the encoding moved
into utils/envFile.js those functions call the imported formatEnvLine and
unquoteEnvValue, so every round trip died with "ReferenceError: formatEnvLine
is not defined" (17 of 37 failed).

The script now defines both functions from utils/envFile.js itself, anchored
on the panel's import and the file's two exports, so it runs the code the
panel ships. VALUES gains a\\b, C:\path\new, a trailing backslash and a
backslash before a quote; with the quote-only encoder a\\b fails both round
trips.
…nks around = (Abilityai/trinity-enterprise#1117)

The exhaustive comparison now writes every value twice, once as K=v and once
as K = v, so dropping the strip before decoding fails it.

The docstring gave the wrong reason for copying the decoder. Under
python3 -m agent_server.mcp_template the package import has already loaded
execution_env. The real constraint is the flat, by-path load the module
supports: there the name "services" is ambiguous, and in a test process it
resolves to the backend package, which has no execution_env.

@obasilakis obasilakis left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed (code review + /validate-pr, lane C). Approving.

  • Decoders agree: the new mcp_template.unquote_env_value matches the agent's execution_env.unquote_env_value on all 349,525 values up to 9 chars over \ " ' a. Writer escapes backslash then quote, same as format_env_line and agent_env_patch.
  • Legacy unescaped values (C:\path, trailing \, PEM-like, regex) decode as before in every reader.
  • The 348 deleted lines (useAgentCredentials.js, formatGithubRepo) have no importers.
  • Mutation: reverting envFile.js:24 turns ent1117EnvEscape.spec.js (11) and test_ent127_frontend_contract.py (2) red; reverting the mcp_template.py:75 regex turns test_ent1117_s11_env_escape_table.py (11) red; the mounted spec pins the panel wiring.

Please fix in a follow-up push or before merge:

  • docs/memory/feature-flows/guided-credential-setup.md:391-395, 506 still says the agent reader does not unescape and that widening escaping would worsen the mismatch. That is now the reverse of the code; credential-injection.md was updated, this file was missed.

Release note: a legacy value holding a literal \\ (UNC path, \\d+) now renders into .mcp.json with one backslash removed. It matches what executions have received since #2023, but operators get no signal to re-save.

@github-actions

github-actions Bot commented Nov 6, 2026

Copy link
Copy Markdown

⚠️ Nightly unit-suite found regressions when this PR is merged into dev (1 of 3 seeds).

Regression details (head_sha: `97480f6cce0e1ce241b6154ee9b43b417777a027`)

Seed 67890

Backend unit-suite regression diff

Per-XML totals

Side Path Total Pass Fail Error Skip
base junit-base-pr4297-67890.xml 38473 38379 4 0 90
head junit-head-pr4297-67890.xml 38584 38489 5 0 90

❌ New failures introduced by HEAD (1)

Tests failing under HEAD that did not fail under BASE in any seed:

  • [F] test_4175_sqlite_to_postgres::test_enterprise_percent_error_does_not_print_the_password

Legend: [F] = assertion failure, [E] = collection or fixture error.
Identity = (classname, name, kind); union taken across all input XMLs.

Reproduce locally: git merge dev && ( cd tests && python -m pytest unit/ -m "not slow" -p randomly --randomly-seed=67890 )

…g mismatch open (#4297)

Mechanical, per the merge-train note on the PR. Section 6 still said the
agent's reader does not unescape and listed the mismatch as follow-up 5; this
PR closes both, so the paragraph now points at the shared rules in
credential-injection.md.

Part of Abilityai/trinity-enterprise#1117.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@vybe

vybe commented Nov 6, 2026

Copy link
Copy Markdown
Contributor

merge-train (2026-11-06): one mechanical docs commit pushed to this branch, 54dd41995.

docs/memory/feature-flows/guided-credential-setup.md still said two things this PR makes false:

  • §6 said the agent's reader "does not unescape" and that widening the escaping "would make the agent-side mismatch worse".
  • Follow-up 5 listed the escaping mismatch as open.

§6 now states that writer and readers agree and points to credential-injection.md. Follow-up 5 is struck through as closed. No code changed. This PR is on the current merge train.

@vybe
vybe merged commit e0e0306 into dev Nov 6, 2026
26 checks passed
vybe pushed a commit that referenced this pull request Nov 10, 2026
…ed root lockfile, WhatsApp/log/credential-panel fixes (Abilityai/trinity-enterprise#1117) (#4400)

* chore(deps): remove the unused repo-root package.json and package-lock.json (Abilityai/trinity-enterprise#1117) (#4316)

The root manifest dates from the initial commit and declares only
@modelcontextprotocol/sdk plus overrides. Nothing installs, copies or
resolves it: every npm call in CI runs in src/frontend, src/mcp-server or
src/helper-mcp; the frontend, mcp-server and base images build from their
own subfolder contexts; the backend and scheduler images use the repo root
as context but copy only named backend, scheduler, config and VERSION
paths; no script or doc runs npm at the root; and every bare import in
each Node package is present in that package's own lockfile.

Keeping it meant patching its lockfile for alerts on code that never runs.

(cherry picked from commit 9bae16e)

* fix(deps): bump vite in the git-sync test harness and black in the test requirements and backend image (Abilityai/trinity-enterprise#1117) (#4292)

* fix(deps): bump vite to 8.3.5 in the git-sync test harness lock (Abilityai/trinity-enterprise#1117)

vite 8.2.1 is inside GHSA-587h-7wmj-h5pm (>= 8.2.0, <= 8.2.3, High).
Lock-only change, regenerated with npm 11.20.0
(npm update vite --before=2026-11-04 --package-lock-only --ignore-scripts);
package.json is unchanged. vite 8.3.5 matches src/frontend. The only other
movement is vite's own rolldown 1.2.4 -> 1.2.16 and @oxc-project/types.
The harness's vitest suite passes 10/10 before and after; npm audit High 1 -> 0.

* fix(deps): bump black to 26.10.1 in the test requirements and the backend image (Abilityai/trinity-enterprise#1117)

black 26.5.1 is inside GHSA-cg8m-r9f2-5wm2 (< 26.10.1, High). black is not
a tool this repo runs: it is a declared runtime requirement of payments-py
1.18.0, and both files pin that runtime set exactly so the image and CI
exercise the same SDK stack. The pin moves in both files together, because
tests/unit/test_ent679_payments_pin_parity.py compares the Dockerfile pin
with the installed version and fails when only one file moves (checked in
both directions).

A fresh Python 3.13 venv resolves the full tests/requirements-test.txt
with exit 0 before and after, 174 packages each, and black is the only
version that changes; the same holds for the Dockerfile's pip install set
(171 packages). test_ent679_payments_pin_parity.py: 20 passed.

(cherry picked from commit adac3a5)

* fix(backend): linear WhatsApp markdown conversion, secret-free boot and fork logs, anchored consent check (Abilityai/trinity-enterprise#1117) (#4296)

* fix(whatsapp): markdown conversion runs in linear time (Abilityai/trinity-enterprise#1117)

The header and link rules in _markdown_to_whatsapp were quadratic in the
reply length: 8-11 s of CPU for one 64 KB agent reply, spent synchronously
on the event loop. The header title now starts and ends on a non-space so
the trailing \s* never competes with it; link text may not contain a
bracket, and the URL may contain anything but ')' except the '](' that
starts the next link, so IPv6 hosts and ?filter[]= queries still convert.
Regex input is clamped to the largest response the platform accepts
(4,000,000 chars, the result-callback cap); any excess passes through
unconverted.

Tests pin 4/16/64 KB growth on CodeQL's pump strings, bracket URLs, the
clamp, equivalence with the previous rules on realistic replies, and the
three intentional differences.

* fix(logs): boot warning and fork log carry no secret-derived detail (Abilityai/trinity-enterprise#1117)

A weak ADMIN_PASSWORD made the boot log list each failed rule, which gave
away the password's length, its missing character classes and whether it
is on the public common-password list. The warning now prints the fixed
rules line, identical for every password.

The fork-to-own clone-failure log scrubbed git output a second time;
_run_git already returns it scrubbed, so the line logs that output
directly. Output is identical (scrubbing is idempotent for tokens without
'*'), verified through a real _run_git against a git that prints the token.

* fix(sanitizer): anchor the consent client_id check and pin the key scan as linear (Abilityai/trinity-enterprise#1117)

The Google-consent client_id check is a re.fullmatch; a leading '^' is a
no-op there and lets static ReDoS analysis, which treats every pattern as
unanchored, see the anchor. Applied to the backend and agent-server copies
as a one-character change, so no other line in either file moves.

New growth-ratio tests time the key=value scan and the client_id check at
three sizes on the pump strings static analysis reports, in both copies,
and check that the same harness flags known-quadratic counterfactuals.

* test(whatsapp): declare the header-title difference and check that the declared differences are the only ones (Abilityai/trinity-enterprise#1117)

The linear header rule requires the title to start on a non-space, so a
header whose title starts with whitespace that the `[ \t]+` after the marks
does not take (`\r`, `\f`, `\v`, NBSP, U+3000, ...) is now left as it is
instead of becoming a bold line. That is a fourth intentional difference
from the previous rules; it is now pinned next to the other three.

A new test compares the conversion, on 20,000 seeded random strings over
markdown punctuation and every non-newline whitespace character, with an
independent statement of the previous rules plus the four declared
differences, and a second test checks the corpus reaches each difference on
its own. The header rule itself is unchanged: it stays the form already
confirmed linear.

* docs(whatsapp): state the reply caps the conversion clamp is sized against (Abilityai/trinity-enterprise#1117)

The comment on `_MARKDOWN_CONVERSION_MAX_CHARS` said agent replies reach
the conversion uncapped and that the clamp equals the largest response any
path accepts. Neither is exact: the sync task path cuts a reply at 10,000
chars, proactive text is capped at 4,096, the async result callback at
4,000,000, and the pull result route sets no length cap. The clamp is sized
to the callback cap, and on the pull path it is the only bound on the regex
work. Comment and test wording now say that; the value is unchanged.

* test(boot): tie the weak-password rules line to the validator's length bounds (Abilityai/trinity-enterprise#1117)

The boot warning's rules line is a literal so it can carry nothing derived
from ADMIN_PASSWORD, which means its "12-128 characters" could drift from
password_validation.MIN_LENGTH/MAX_LENGTH unnoticed. A test now reads both
constants and requires the boot output to state exactly that range.

* test(whatsapp): the completeness check names the expected output when it fails (Abilityai/trinity-enterprise#1117)

* docs(whatsapp): a channel reply has no length cap on push or pull, so the clamp is the only bound (Abilityai/trinity-enterprise#1117)

The previous wording named a 10,000-char sync task cap and implied the
push path was bounded. That cap is AgentClient's task parser, which no
WhatsApp path uses. A channel turn runs through execute_task, whose
inline /api/task response is not length-checked, and the 4,000,000-char
result-callback cap applies only to schedule and webhook triggers. On the
pull path the result route sets no cap either. The comment and test
wording now say that the clamp is the only bound; its value is unchanged.

* test(whatsapp): pin that a header takes one to six marks (Abilityai/trinity-enterprise#1117)

The random corpus never produced six or more `#` followed by a space, so
widening or narrowing `#{1,6}` passed every test. Two explicit rows and
two corpus tokens now cover six marks (a header) and seven (not one).

* merge-train: the WhatsApp feature flow states the linear conversion rules and its clamp (#4296)

Mechanical, per the merge-train note on the PR. The outbound markdown section
did not mention the 4,000,000-character clamp or the four inputs that now
convert differently.

Part of Abilityai/trinity-enterprise#1117.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

---------

Co-authored-by: trinity-ability <[email protected]>
Co-authored-by: Claude Opus 5.5 <[email protected]>
(cherry picked from commit 65d0b3e)

* fix(credentials): escape backslashes when the Credentials panel writes .env (Abilityai/trinity-enterprise#1117) (#4297)

* refactor(credentials): move the .env value encoding into utils/envFile.js (Abilityai/trinity-enterprise#1117)

The Credentials panel's .env writer and reader move, unchanged, into one
module beside each other, so the encoding can be tested on its own and
against the agent's encoder. No behaviour change.

* fix(credentials): escape backslashes when the Credentials panel writes .env (Abilityai/trinity-enterprise#1117)

The panel rewrites an agent's whole .env on every save. Its writer escaped
`"` but not `\`, while its own reader and the agent's unquote_env_value
(#2023) both turn `\\` back into `\`. So a credential containing two
backslashes lost one the next time any credential in the file was saved,
and the agent then authenticated with a value nobody supplied.

The writer now escapes backslash before quote, which is the agent's own
encoding. The comment that argued against widening the escaping was
written before #2023 gave the agent a reader that unescapes, and is
rewritten to say what is true now.

One value -> line table (tests/fixtures/ent1117-env-escape-cases.json,
generated from the agent's format_env_line) is checked by a vitest spec
against the browser encoder, decoder and a mounted Quick Inject save, and
by a pytest against the agent's encoder, decoder and file parser and the
backend's agent_env_patch writer.

* chore(frontend): delete the unused useAgentCredentials composable (Abilityai/trinity-enterprise#1117)

Nothing imports it: the Credentials panel carries its own implementation,
and the composable's only reference was its re-export from
composables/index.js. It still held the old .env writer that escapes `"`
but not `\`, so it is removed rather than fixed.

* chore(frontend): delete the uncalled formatGithubRepo from ReplayTimeline (Abilityai/trinity-enterprise#1117)

The function has no caller in the component's script or template, or
anywhere else in the tree.

* fix(agent): mcp_template reads .env values with the agent's own decoder (Abilityai/trinity-enterprise#1117)

agent_server/mcp_template.py renders .mcp.json.template from .env at every
container start. Its reader reversed only \" and left \\ doubled, while every
writer of the file (the agent's format_env_line, the backend's agent_env_patch
and now the Credentials panel) escapes the backslash. A panel-saved C:\path
was therefore rendered into .mcp.json as C:\\path.

The reader now decodes exactly like execution_env.unquote_env_value: one
matched quote pair stripped, \" and \\ reversed in a single scan inside double
quotes, single-quoted values literal. The decoder is mirrored rather than
imported because importing the services package loads the runtime modules on
this standalone boot path.

The table test now holds mcp_template to the agent's reader per row, over a
whole panel-written file, over every right-hand side up to six characters, and
through render() end to end. A second fixture of lines the new writer never
produced (the old panel writer's output, single-quoted, unquoted and lone-quote
lines) pins every agent-side reader to what execution_env returns for them.
(Abilityai/trinity-enterprise#1117)

* test(credentials): the panel keeps reading existing .env lines as before (Abilityai/trinity-enterprise#1117)

The panel's reader also meets lines its new writer never produced: what it
wrote before backslashes were escaped, hand edits and Quick Inject pastes.
The spec now checks unquoteEnvValue against tests/fixtures/ent1117-env-legacy-reads.json,
whose panel column was produced by running the previous reader, asserts the
panel and the agent differ only on a lone single quote, and mounts the panel
to show a Quick Inject carries each such line over as the value it read.

Both fixtures join the frontend-build path filter, so a change to either runs
the browser spec as well as the pytest twin.

* docs(credentials): describe the current .env encoding and its readers (Abilityai/trinity-enterprise#1117)

credential-injection.md still said the deleted useAgentCredentials composable
exists, that only " is escaped, and that widening the escaping would make the
agent-side mismatch worse; none of that has been true since #2023. It now
names the shared encoding, every reader of the file, the two fixtures that
hold them together, and the three single-key readers that only strip quotes.

CLAUDE.md said .mcp.json.template rendering is "not yet live"; startup.sh has
run it at every agent start since #2013.

* test(credentials): the ent127 round trip runs utils/envFile.js and covers backslashes (Abilityai/trinity-enterprise#1117)

test_ent127_frontend_contract.py extracts parseEnvText and formatEnvContent
from CredentialsPanel.vue and runs them under node. Since the encoding moved
into utils/envFile.js those functions call the imported formatEnvLine and
unquoteEnvValue, so every round trip died with "ReferenceError: formatEnvLine
is not defined" (17 of 37 failed).

The script now defines both functions from utils/envFile.js itself, anchored
on the panel's import and the file's two exports, so it runs the code the
panel ships. VALUES gains a\\b, C:\path\new, a trailing backslash and a
backslash before a quote; with the quote-only encoder a\\b fails both round
trips.

* test(agent): hold mcp_template's .env decoder to the agent's with blanks around = (Abilityai/trinity-enterprise#1117)

The exhaustive comparison now writes every value twice, once as K=v and once
as K = v, so dropping the strip before decoding fails it.

The docstring gave the wrong reason for copying the decoder. Under
python3 -m agent_server.mcp_template the package import has already loaded
execution_env. The real constraint is the flat, by-path load the module
supports: there the name "services" is ambiguous, and in a test process it
resolves to the backend package, which has no execution_env.

* docs(credentials): state both legacy fixture columns and the one mcp_template upgrade change (Abilityai/trinity-enterprise#1117)

* merge-train: guided-credential-setup no longer calls the .env escaping mismatch open (#4297)

Mechanical, per the merge-train note on the PR. Section 6 still said the
agent's reader does not unescape and listed the mismatch as follow-up 5; this
PR closes both, so the paragraph now points at the shared rules in
credential-injection.md.

Part of Abilityai/trinity-enterprise#1117.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

---------

Co-authored-by: trinity-ability <[email protected]>
Co-authored-by: Claude Opus 5.5 <[email protected]>
(cherry picked from commit e0e0306)

* chore(deps-dev): bump the patch-and-minor group across 1 directory with 2 updates (#3856)

Bumps the patch-and-minor group with 2 updates in the /tests/git_sync directory: [vitest](https://github.com/vitest-dev/vitest/tree/HEAD/packages/vitest) and [vue](https://github.com/vuejs/core).

Updates `vitest` from 5.0.3 to 5.0.5
- [Release notes](https://github.com/vitest-dev/vitest/releases)
- [Changelog](https://github.com/vitest-dev/vitest/blob/main/docs/releases.md)
- [Commits](https://github.com/vitest-dev/vitest/commits/v5.0.5/packages/vitest)

Updates `vue` from 3.5.43 to 3.5.44
- [Release notes](https://github.com/vuejs/core/releases)
- [Changelog](https://github.com/vuejs/core/blob/main/CHANGELOG.md)
- [Commits](vuejs/core@v3.5.43...v3.5.44)

---
updated-dependencies:
- dependency-name: vitest
  dependency-version: 5.0.5
  dependency-type: direct:development
  update-type: version-update:semver-patch
  dependency-group: patch-and-minor
- dependency-name: vue
  dependency-version: 3.5.44
  dependency-type: direct:development
  update-type: version-update:semver-patch
  dependency-group: patch-and-minor
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
(cherry picked from commit 990e190)

* chore(deps-dev): bump happy-dom in /tests/git_sync (#4220)

Bumps [happy-dom](https://github.com/capricorn86/happy-dom) from 20.14.6 to 21.0.4.
- [Release notes](https://github.com/capricorn86/happy-dom/releases)
- [Commits](capricorn86/happy-dom@v20.14.6...v21.0.4)

---
updated-dependencies:
- dependency-name: happy-dom
  dependency-version: 21.0.4
  dependency-type: direct:development
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
(cherry picked from commit 4c2dab7)

* test: the .env escape table on main has no backend agent_env_patch writer to check (Abilityai/trinity-enterprise#1117)

test_ent1117_s11_env_escape_table.py comes from dev, where it also holds
services/agent_env_patch.py to the shared table. That module arrived on
dev with later feature work and does not exist on main, so its fixture,
its one table test and its one legacy-read assertion are removed here.
Every agent-side and mcp_template check is unchanged.

---------

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: trinity-ability <[email protected]>
Co-authored-by: Claude Opus 5.5 <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants