Skip to content

fix(session-bridge): put the data-framing note before the events it frames - #10354

Merged
melodic-automation-lanes[bot] merged 1 commit into
mainfrom
work-resolve-issue/issue-8831-40390465588-1
Oct 26, 2026
Merged

melodic-automation-lanes[bot] merged 1 commit into
mainfrom
work-resolve-issue/issue-8831-40390465588-1

Conversation

@melodic-automation-lanes

Copy link
Copy Markdown
Contributor

Closes #8831

Summary

Opened by the work-resolve-issue lane. The run's own summary:

The session bridge's /api/wait answer and the channel relay's take() line now insert note (DATA_NOTE) before events. dumps_line serializes with json.dumps and no sort_keys, so a reader now meets the data frame before the page text it frames. As the recorded decision says, only the canonical lib/session-bridge/session_bridge.py was edited, the five plugin copies were regenerated with sync-shared-copies, and the SSE path was left unchanged. Two tests check the serialized order, and the docs that spelled out the old order now give the new one.

Not verified

  • The Python unit tests (python3 -m unittest test_session_bridge test_view_bridge in lib/session-bridge) were not run: this lane allows no interpreter. The two new tests and the existing suites are left to the PR's CI.
  • sync-shared-copies --check-bump main refused to run because the wrapper runs from outside the repository. Instead, patch fragments for planning, review and work-items were added, and check-changelog-fragments validated them.
  • check-affected skipped typos (not installed), plus validate-plugins sub-checks and changed-skills (they run code from the checked tree); CI runs them and the CI-only checks it lists.

Fix

  • lib/session-bridge/session_bridge.py: the /api/wait handler sets body["note"] before body["events"]; ChannelRelay.take updates the line with note before events
  • lib/session-bridge/test_session_bridge.py: new test_the_wait_answer_puts_the_note_before_the_events (raw /api/wait JSON text) and test_the_relay_line_puts_the_note_before_the_events (dumps_line of take()), each asserting the index of "note": is before "events":
  • lib/session-bridge/README.md: the /api/wait answer shape now reads {seq, timedOut, replayed?, note, events}
  • plugins/planning/shared/session_bridge.py, plugins/planning/surface/session_bridge.py, plugins/planning/view-bridge/session_bridge.py, plugins/review/view-bridge/session_bridge.py, plugins/work-items/view-bridge/session_bridge.py: regenerated from the canonical file by sync-shared-copies
  • plugins/planning/skills/interview/context/lane-shared.md, plugins/planning/skills/interview/context/surface.md, plugins/planning/surface/README.md: the watcher line's key order now lists note before events
  • .changes/planning/fix-8831-session-bridge-note-first-5d3a9c17.md, .changes/review/fix-8831-session-bridge-note-first-5d3a9c17.md, .changes/work-items/fix-8831-session-bridge-note-first-5d3a9c17.md: patch changelog fragments for the three plugins that carry the bridge copy (written by hand because ne

Verification

The runner ran each check from the base copy against a1fdbb1:

  • scripts/check-changelog-fragments.sh --check: passed

The run reports:

  • grep for DATA_NOTE in lib/session-bridge/session_bridge.py: only the definition and the two sites changed (the /api/wait handler and ChannelRelay.take), so the SSE path builds no body with it
  • sync-shared-copies: regenerated the five session_bridge.py copies, exit 0
  • sync-shared-copies --check: all 528 registered copies match their canonical sources, exit 0
  • check-changelog-fragments: all 6 fragments under .changes/ are valid
  • check-affected: 10 passed, 6 skipped (shellcheck: no shell changed; typos: not installed; three validate-plugins sub-checks and changed-skills: they run code from the checked tree), the rest CI only
  • grep for session_bridge.py:<line> and session-bridge/README.md:<line> citations: none, so the added line shifts no cited line
  • fresh-context review subagent over the whole diff: no correctness issue; found three planning docs still giving the old key order (fixed) and a style nit asking the wait test to use BridgeCase.request() (declined: the issue asks for the raw JSON text, and TestLineSeparators reads raw text the same w
  • The lane run: https://github.com/melodic-software/claude-code-plugins/actions/runs/40390465588

Left out: the items under Not verified.

Related

#8831

Lane-Activity: work-resolve-issue/resolve-issue
@github-actions

Copy link
Copy Markdown
Contributor

claude-security-review reviewed a1fdbb14d232f8da0e2173980af3322c2457665e: 0 finding(s), 0 as inline comments.

No security issues found in this change.

What changed. The /api/wait handler and ChannelRelay.take now put note before events. The same edit is in the canonical lib/session-bridge/session_bridge.py and in the five regenerated plugin copies, which are byte-identical hunks. The diff also adds two order tests, updates the docs that spelled out the old key order, and adds three patch changelog fragments.

Trust boundary. The only code change is the insertion order of two dict keys, and dumps_line does not sort keys. The change adds no input, route, auth check, token handling or path handling. Nothing is read from or written to a new place. The data-framing note is now the first thing a reader meets, so the change tightens the prompt-injection framing and loosens nothing.

Trusted paths and manifests. No changed file matches a TRUSTED PATHS glob. No .claude-plugin/plugin.json or marketplace.json changed, so there are no manifest <field> lines. The diff deletes or softens no standing instruction. The doc edits only reorder key names in descriptions of the watcher line.

Tests. The new tests search the raw JSON for '"note":' and '"events":'. A page-supplied event string cannot spoof the "note": marker, because JSON escapes its quotes (\"note\":). They are a correct order check, not a security surface.

Spend. The change adds no model, turn-limit or schedule spend and no billed resource.

critical-findings: 0

@github-actions

Copy link
Copy Markdown
Contributor

claude-review reviewed a1fdbb14d232f8da0e2173980af3322c2457665e: 0 finding(s), 0 as inline comments.

No findings. I read the full diff and the PR context, and I read ChannelRelay (take, write_log, constructor) in lib/session-bridge/session_bridge.py. I ran no tests or commands.

Acceptance criteria from #8831

  • note before events at both sites: met. The /api/wait handler (session_bridge.py:534-535) and ChannelRelay.take (:1405) now set note first, and dumps_line does no key sorting. The SSE path builds no body with DATA_NOTE, so leaving it alone is right.
  • Two raw-text order tests: met, and both would fail on the old order.
    • The wait test reads the raw /api/wait response text.
    • The relay test serializes take() with dumps_line.
    • The constructor and write_log usage in the relay test matches the existing test at line 178.
    • Neither test's data can place "note": or "events": anywhere the index check could mistake.
  • Five regenerated copies: each one matches the canonical edit hunk for hunk.
  • sync-shared-copies.sh --check and the existing suites: these are author-claimed only. I did not run them, and the PR says the Python tests were not run in the lane, so CI has to confirm them.
  • Docs and changelog: the README and the three planning docs now give the new key order. The only remaining old-order text I found is a dated probe-output record in surface.md (line 304), which should stay as recorded. The patch fragments for the three plugins that carry a bridge copy are consistent with the change.

Manifests: the diff changes no plugin.json or marketplace.json, so no manifest lines apply.

Spend: the change adds no billed resource and does not change any spend.

Hold: none.

@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

The unattended merge path armed native auto-merge at head a1fdbb14d232f8da0e2173980af3322c2457665e.

@melodic-automation-lanes
melodic-automation-lanes Bot added this pull request to the merge queue Oct 26, 2026
Merged via the queue into main with commit f232fb8 Oct 26, 2026
50 checks passed
@melodic-automation-lanes
melodic-automation-lanes Bot deleted the work-resolve-issue/issue-8831-40390465588-1 branch October 26, 2026 22:16
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.

fix(session-bridge): put the data-framing note before the events it frames

0 participants