Skip to content

refactor(session-flow): simplify observer-arm hook - #15319

Merged
melodic-automation-lanes[bot] merged 1 commit into
mainfrom
work-resolve-issue/issue-14724-42995314150-1
Nov 11, 2026
Merged

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

Conversation

@melodic-automation-lanes

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

Copy link
Copy Markdown
Contributor

Closes #14724

Summary

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

observer-arm.sh now reads its four stdin fields through one input_field helper in place of four copies of the same jq pipeline. The five single-use config variables (MODEL, EFFORT, IDLE, POLL, MAX) and MEMORY_DIR are inlined into the launcher argv and LEDGER_DIR. The jq filters, exit paths, defaults and the argv passed to arm_observer.py are byte-for-byte the same. lib/python-probe.sh is left unchanged: it is already one 10-line function whose header comment carries the bash 3.2 constraint (printf -v rather than a nameref), so the four /simplify checks found nothing to cut without losing that reason.

Not verified

  • No test suite was run here (test_observer.py, observer.test.sh and the bash test wrappers): this lane's Bash runs only the named wrappers. Left to the PR's CI.
  • ci-status green (an acceptance criterion) is checked by the PR's CI.
  • Edge case the reviewer noted, not a defect: the old script assigned MODEL/EFFORT/IDLE/POLL/MAX/MEMORY_DIR, which overwrote those names if the parent environment had exported them, before launching arm_observer.py. The new script leaves them as inherited. Neither arm_observer.py nor observer.py…
  • Tidy pass 5 (ai-slop) used only its rubric on the one-line fragment: the deterministic detect.sh could not run, because the lane's Bash allows only the named wrappers. Passes 1 to 4 made no edits: the code lines were already simplified, the one comment states a default and was kept, there is no…
  • Untracked dotfiles in the checkout root (.bashrc, .bash_profile, .gitconfig, .idea, .mcp.json, .profile, .ripgreprc, .vscode, .zprofile, .zshrc) were not created by this run (they look like sandbox mount points) and are not part of the change.

Fix

  • plugins/session-flow/hooks/observer-arm.sh: an input_field helper replaces the four repeated printf | jq -r '.<field> // ""' reads; the single-use MEMORY_DIR, MODEL, EFFORT, IDLE, POLL and MAX variables are inlined (17 lines removed, 13 added)
  • .changes/session-flow/work-resolve-issue-issue-14724-42995314150-1-18791212.md: patch fragment, ### Changed / Internal simplification, no behavior change.

Verification

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

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

The run reports:

  • check-changelog-fragments: all 8 fragments valid (run before and after tidy)
  • check-changed-skills: no changed skills, nothing to gate (run before and after tidy)
  • check-affected: 13 passed, 6 skipped over 2 changed files (run before and after tidy)
  • fresh-context review subagent over the diff: no defects; it confirmed the jq filters expand to the original strings, the argv to arm_observer.py is unchanged in order and value, the code stays safe under set -uo pipefail and runs on bash 3.2, and no other file references the removed variable names
  • Grep for tests on these files: none assert on observer-arm.sh text; test_observer.py covers the launcher argv shape, and the six bash test wrappers that source python-probe.sh call it unchanged
  • scripts/check-hook-userconfig-argv.sh (read, not run): it scans hook JSON configs only, so the inlined CLAUDE_PLUGIN_OPTION_* expansions in the shell script are outside its scope
  • The lane run: https://github.com/melodic-software/claude-code-plugins/actions/runs/42995314150

Left out: the items under Not verified.

Related

#14724

Merge-Risk: max=MEDIUM demote=false head=3777109b43e55c39e05c81f26a9620289db7c2c5 rubric=8.4.2 rater=claude-opus-5-5 checker=claude-opus-5-5

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

Copy link
Copy Markdown
Contributor

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

Security review: PR #15319 (refactor(session-flow): simplify observer-arm hook)

I found no security issues.

I read both changed files in full: plugins/session-flow/hooks/observer-arm.sh and the changelog fragment .changes/session-flow/work-resolve-issue-issue-14724-42995314150-1-18791212.md. Neither matches a trusted-path glob.

What I checked in observer-arm.sh:

  • jq filter injection. The new input_field() helper builds its jq filter from $1. Every caller passes a fixed word written in the script (source, agent_type, transcript_path, session_id). Hook stdin ($INPUT) reaches jq only as data on stdin, never as filter text. The filters come out identical to the old ones (.source // "" and so on).
  • Exit paths. The source case gate and the agent_type early exit behave the same as before, in the same order. The TRANSCRIPT and SESSION_ID checks are unchanged. If jq is missing, the script still exits.
  • Launcher arguments. The CLAUDE_PLUGIN_OPTION_* values are now placed directly in the argument list. Each one is still a single double-quoted array element with the same default as before, so the userConfig values are not word-split and cannot inject anything new. The values passed to arm_observer.py and their order are unchanged, as are LEDGER_DIR (still ${CLAUDE_PROJECT_DIR:-$PWD}/.work/running-retros) and WORK_DIR.
  • Inherited variables. The script no longer assigns MODEL, EFFORT, IDLE, POLL, MAX or MEMORY_DIR. Those names could only come from the user's own parent environment, and this script no longer reads them. No untrusted actor reaches this.

Changelog fragment: text only, with nothing that runs and no instruction text.

No standing instruction, trust control, merge hold or plugin manifest is touched. This is the lane's first review of the PR (blocking only: no). The PR context contains no embedded directives aimed at the review.

critical-findings: 0

@github-actions

Copy link
Copy Markdown
Contributor

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

Code review: refactor(session-flow): simplify observer-arm hook

No findings. I read every hunk of both changed files.

plugins/session-flow/hooks/observer-arm.sh

  • jq filter: input_field() builds ".$1 // \"\"". For each of the four fields (source, agent_type, transcript_path, session_id) this gives the same filter string as before, e.g. .source // "". It still sends stderr to /dev/null, and $INPUT is set at line 38, before any call, so set -u is satisfied.
  • Order and exit paths: the source and agent_type guards still run in the same order and exit the same way.
  • LEDGER_DIR: inlining it gives the same ${CLAUDE_PROJECT_DIR:-$PWD}/.work/running-retros path.
  • Launcher argv: the argv passed to arm_observer.py keeps the same flags, order and defaults (900 / 5 / 86400, empty model and effort).
  • Inherited variables: the removed shell variables (MODEL, EFFORT, IDLE, POLL, MAX, MEMORY_DIR, SOURCE, AGENT_TYPE) were never exported by the script. I grepped plugins/session-flow and found no Python or hook code that reads them from the environment, so leaving an inherited value in place changes nothing the observer sees.

.changes/session-flow/…-18791212.md

  • The fragment uses bump: patch with ### Changed and "Internal simplification, no behavior change.", as the closing issue requires.

Closing issue #14724, acceptance criteria

  • Behavior unchanged: met, based on reading the code as described above. I ran no tests. No test asserts on this script's text; test_observer.py covers the launcher argv shape, per the author (not checked by me).
  • Diff edits only the listed files and fragments: met. lib/python-probe.sh was left unchanged, and the PR explains why.
  • Within 400 lines and 15 files: met.
  • ci-status green: left to CI, not checked here.
  • Fragment present: met.

No plugin manifest changed, so no manifest lines apply. I found no paved-path or path-scoped rule concerns for these files. The PR context contained no embedded instructions aimed at this lane.

@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

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

@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

Verification evidence for 3777109

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-15319-3777109b43e55c39e05c81f26a9620289db7c2c5, expires on 2026-12-11.

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 11, 2026
Merged via the queue into main with commit 388b9d5 Nov 11, 2026
65 checks passed
@melodic-automation-lanes
melodic-automation-lanes Bot deleted the work-resolve-issue/issue-14724-42995314150-1 branch November 11, 2026 10:55
@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

The post-merge check verified merge commit 388b9d505b9f24f9796e23c727f2603f7c606acd; 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 and lib session-flow plugin code

0 participants