Skip to content

refactor(desktop-notification): simplify the notification hook and mod register - #14543

Merged
melodic-automation-lanes[bot] merged 1 commit into
mainfrom
work-resolve-issue/issue-14440-42595410865-1
Nov 9, 2026
Merged

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

Conversation

@melodic-automation-lanes

@melodic-automation-lanes melodic-automation-lanes Bot commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor

Closes #14440

Summary

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

Simplified desktop-notification.sh: write the OSC 9 sequence straight into SEQ, drop the no-op C0 strip of the literal HEADLINE, and build the telemetry channels array with one printf over the fixed channel literals instead of a per-item jq-escape loop. register.ts folds the channel list into a single every() check. Behavior is unchanged: same terminalSequence output, telemetry data JSON for 0, 1 and 2+ channels, exit codes and exports. hook-test-sink.sh is left as is because it must stay byte-identical to its canonical copy in lib/hook-test-sink.sh, which this issue's diff may not touch.

Not verified

  • plugins/desktop-notification/hooks/hook-test-sink.sh not simplified: it is a byte-identical copy of the canonical lib/hook-test-sink.sh, and editing it alone would break the shared-copy sync while editing lib/ is outside this issue's allowed diff (listed files only) and its out-of-scope rule on…
  • cant-fail-scan wrapper timed out after 2 minutes when run with no arguments; it is a CI-only check (scripts/check-cant-fail-scan.sh <base>) left to the PR's CI
  • typos and shellcheck not run locally (typos not installed; check-affected reported SKIP); left to the PR's CI
  • tidy pass 5 (/ai-slop:audit fix) skipped: its detect.sh and digest-guard.sh scripts cannot run under this lane's Bash allowlist; the one-line fragment was read by hand and carries issue-mandated text
  • ci-status green is left to the PR's CI

Fix

  • plugins/desktop-notification/hooks/desktop-notification.sh: removed the redundant strip_c0_to HEADLINE (HEADLINE is always a fixed literal), wrote the OSC 9 sequence with printf -v SEQ directly, and replaced the telemetry channel loop with printf -v ch_json '"%s",' plus a trailing-comma strip;…
  • plugins/desktop-notification/hooks/register.ts: inlined the channels array into one every() condition
  • .changes/desktop-notification/work-resolve-issue-issue-14440-42595410865-1-007b14d4.md: patch fragment, ### Changed, "Internal simplification, no behavior change."

Verification

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

  • scripts/check-changelog-fragments.sh --check: passed
  • scripts/check-changed-skills.sh --merge-base: passed

The run reports:

Left out: the items under Not verified.

Related

#14440

Merge-Risk: max=MEDIUM demote=false head=fb2d8f169316bdc5fe08c1a85d24fbe274474f8d rubric=8.1.4 rater=claude-opus-5-5 checker=claude-opus-5-5

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

github-actions Bot commented Nov 9, 2026

Copy link
Copy Markdown
Contributor

claude-security-review reviewed fb2d8f169316bdc5fe08c1a85d24fbe274474f8d: read 3 of 3 changed file(s); 0 finding(s), 0 as inline comments.

Security review: PR #14543 (desktop-notification simplification)

I found no security issues. I read every hunk of all 3 changed files, plus the whole head copy of desktop-notification.sh.

What I checked:

  • Removed C0 strip of HEADLINE. The case at desktop-notification.sh#L99-L115 sets HEADLINE to a fixed literal in each branch that continues ("Permission Required", "Input Needed", "Claude Code"). Every other path exits. No untrusted bytes can reach HEADLINE, so dropping the defensive strip does not open a way to inject escape sequences into the OSC 9 output, the osascript argv or the notify-send argv. The untrusted fields MESSAGE and TYPE are still stripped at L91-L92, and BRANCH is still stripped at L156.
  • printf -v SEQ '\033]9;%s\007'. The untrusted text goes in as a %s argument, never as the format string. SEQ is set to empty just before, at L135, so writing it directly instead of appending gives the same result. It is still JSON-escaped before it is sent (L207).
  • Telemetry ch_json without escaping. CHANNELS only ever gets the fixed literals terminal_notify, bell and os_toast (L138, L142, L170, L177). No untrusted value enters the array, so skipping JSON escaping cannot inject anything. TYPE still goes through hook::json_escape_jq_to (L196).
  • register.ts. The inlined every(... === false) check behaves the same as the old map-then-every version. The kill-switch and opt-out returns are unchanged.
  • Instruction surface. The diff deletes two lines of code comments (about the HEADLINE strip and the jq loop). They are not standing instructions to a model, and the code behaviour they described is covered above.

No trusted path matched any changed file. No plugin manifest changed. The PR context holds no embedded directives. There were no prior findings and no settled threads, and this was a full review (not blocking only).

critical-findings: 0

@github-actions

github-actions Bot commented Nov 9, 2026

Copy link
Copy Markdown
Contributor

claude-review reviewed fb2d8f169316bdc5fe08c1a85d24fbe274474f8d: read 3 of 3 changed file(s); 0 finding(s), 0 as inline comments.

Code review: no findings

I read every change in all 3 files (desktop-notification.sh, register.ts and the changelog fragment). I checked each one against the head file, and none of them changes behavior.

  • Removing strip_c0_to HEADLINE: every branch of the case that doesn't exit sets HEADLINE to a fixed literal (desktop-notification.sh#L99-L115). None of those literals contains a control byte, so the strip did nothing. The untrusted MESSAGE and BRANCH are still stripped.
  • printf -v SEQ replacing the append: SEQ="" is set on the line just before, so writing the value directly gives the same string. The BELL branch still appends after it.
  • Telemetry channels JSON: printf -v ch_json '"%s",' followed by [${ch_json%,}] gives [], ["a"] and ["a","b"] for 0, 1 and 2+ channels, the same as the old loop. The ((${#CHANNELS[@]})) guard stops printf from emitting "", when the array is empty. The channel names are only ever the literals terminal_notify, bell and os_toast, so they need no JSON escaping. status still gets ok or skipped as before.
  • register.ts: putting the every(... === false) check inline is the same test. Nothing else used the channels local.
  • I searched the repository for the removed names (__osc, __ch_e, strip_c0_to HEADLINE) and found nothing outside this diff.
  • Tests: desktop-notification.test.sh checks the 2-channel case (Case 11) and the 0-channel case (Case 12) of the telemetry channels array. No test checks exactly one channel. I'm not flagging that, because the format string is the same code path for every count above zero.

Closing issue #14440, acceptance criteria

  • Behavior unchanged: met, as described above.
  • Diff edits only the listed files plus a fragment: met. hook-test-sink.sh is left alone, and the PR body explains why: it is a shared copy of lib/hook-test-sink.sh.
  • Size limit: met (3 files, about 30 lines).
  • Fragment with bump: patch, ### Changed, and the line "Internal simplification, no behavior change.": met.
  • ci-status green: left to CI. I could not check it.

No plugin manifest changed. The PR body's verification steps are the author's claims and I did not check them; I ran nothing myself. I found no embedded instructions in the PR context.

@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

The unattended merge path armed native auto-merge at head fb2d8f169316bdc5fe08c1a85d24fbe274474f8d, the head its arming checks judged.

@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

Verification evidence for fb2d8f1

The verifier passed this head. The capture artifact holds the capture summary, which says whether the capture ran, and any screenshot or video that passed the mask check; this comment uploads no file.

Capture artifact: pr-capture-14543-fb2d8f169316bdc5fe08c1a85d24fbe274474f8d, expires on 2026-12-09.

One comment per pull request, updated in place for each new head.

@melodic-automation-lanes
melodic-automation-lanes Bot added this pull request to the merge queue Nov 9, 2026
Merged via the queue into main with commit f6240de Nov 9, 2026
66 checks passed
@melodic-automation-lanes
melodic-automation-lanes Bot deleted the work-resolve-issue/issue-14440-42595410865-1 branch November 9, 2026 11:08
@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

The post-merge check verified merge commit f6240def025b5b2047456cdc21e379551e9c7b5d; later checks count it verified from this comment.

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.

Simplify the hooks desktop-notification plugin code

0 participants