Skip to content

refactor(session-flow): simplify running-retro observer scripts - #15152

Merged
melodic-automation-lanes[bot] merged 1 commit into
mainfrom
work-resolve-issue/issue-14751-42883468702-1
Nov 10, 2026
Merged

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

Conversation

@melodic-automation-lanes

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

Copy link
Copy Markdown
Contributor

Closes #14751

Summary

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

Simplified three running-retro scripts without changing behavior. arm_observer.py now builds the observer argv from two name tuples in the same order instead of a 30-line literal list, and caches the sibling-module load with functools.cache instead of a hand-rolled global. observer.py shares one JSON-object reader between _extract_result and _result_error and uses contextlib.suppress for its two best-effort unlinks. stamp_plugin_usage.py's parser argv sits on one line. setup-apply.mjs is a 30-line wrapper around the shared lib/setup-apply.mjs and had nothing left to simplify, so it is unchanged. functools.cache needs Python 3.9; the plugin's stated floor is 3.10 (plugins/session-flow/reference/observer.md:15).

Not verified

  • test_observer.py and observer.test.sh were not run: this lane runs no Python interpreter or test runner. Left to the PR's CI.
  • ci-status green: a PR CI check, left to the PR's CI.
  • setup-apply.mjs not changed: it is already a minimal wrapper around the shared lib/setup-apply.mjs, and moving code across files is out of scope.
  • tidy pass 5 (ai-slop:audit fix) ran without its detector: detect.sh is not among the runnable wrappers, so the fragment got a manual read against the catalog instead.
  • Build and lint of the Python files (ruff/black) not run here: no interpreter or linter is runnable in this lane; left to the PR's CI.
  • Changes are left uncommitted in the working tree, per the lane's instruction, so the runner can turn them into a patch.

Fix

  • plugins/session-flow/skills/running-retro/scripts/arm_observer.py: _observer_mod uses functools.cache instead of the _OBSERVER_MOD global; the forwarded observer flags are built from _FORWARDED_VALUES and _FORWARDED_SWITCHES in the original order.
  • plugins/session-flow/skills/running-retro/scripts/observer.py: new private _json_object helper shared by _extract_result and _result_error; release_lock and _cleanup_observations use contextlib.suppress(OSError).
  • plugins/session-flow/skills/running-retro/scripts/stamp_plugin_usage.py: parser argv list collapsed onto one line.
  • .changes/session-flow/work-resolve-issue-issue-14751-42883468702-1-73b624c9.md: patch fragment, '### Changed' with '- Internal simplification, no behavior change.'

Verification

The runner ran each check from the base copy against 94f0219:

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

The run reports:

  • check-changelog-fragments: all 4 fragments valid (run before and after tidy).
  • check-changed-skills: running-retro PASS, 0 errors, 1 warning (pre-existing SKILL.md body length, file not touched).
  • check-affected: 13 passed, 6 skipped, the rest CI only, over 4 changed files.
  • Fresh-context review subagent over the whole diff: no behavior differences found. Argv order, flag names, the is_error/non-dict/non-JSON paths of _extract_result and _result_error, the unlink error handling and the tests' use of arm._observer_mod() all match the original; Python 3.10+ floor…
  • tidy-diff (code-tidying:tidy-diff) over the 14 changed hunks: no edits or proposals; the ai-slop pass on the fragment was a manual catalog read because detect.sh is not runnable in this lane.
  • The lane run: https://github.com/melodic-software/claude-code-plugins/actions/runs/42883468702

Left out: the items under Not verified.

Related

#14751

Merge-Risk: max=LOW demote=false head=94f02194cd82e118dd13fc42b3bbe07defd285e3 rubric=8.3.5 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 94f02194cd82e118dd13fc42b3bbe07defd285e3: read 4 of 4 changed file(s); 0 finding(s), 0 as inline comments.

Security review: PR #15152 (head 94f0219)

No security issues found.

I read every hunk in all 4 changed files. None of them matches a trusted path, and none touches a trust control, plugin manifest, workflow or standing instruction.

  • arm_observer.py: The forwarded observer argv is now built from _FORWARDED_VALUES / _FORWARDED_SWITCHES. I checked it against the removed literal list. The flag names are the same (_ → -), in the same order, each followed by the same args.<name> value. The two switches are still added only when set. cmd is still a Python list handed to spawn_detached, so it runs without a shell and there is no new injection surface. The functools.cache on _observer_mod() still loads the fixed sibling path Path(__file__).with_name("observer.py"), so the loaded module is unchanged.
  • observer.py: The _json_object helper behaves the same as before for non-JSON and non-dict input (empty result, no error text). is_error handling is the same in _extract_result and _result_error. The contextlib.suppress(OSError) unlinks match the old try/except OSError: pass. The _redact ledger-write redaction path is not touched.
  • stamp_plugin_usage.py: The subprocess argv list was reformatted onto one line. Same list form, same arguments.
  • .changes/ fragment: A changelog entry only.

The PR context holds no embedded instructions aimed at the lane.

critical-findings: 0

@github-actions

Copy link
Copy Markdown
Contributor

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

Code review: PR #15152, simplify the running-retro observer scripts

No findings. I read every hunk of all 4 changed files. None of them matches a trusted-path glob. Nothing here needs a hold.

How I checked that behavior is unchanged (by reading the code; I ran no tests or interpreter):

  • arm_observer.py, the observer's command line. _FORWARDED_VALUES and _FORWARDED_SWITCHES produce the same flags, in the same order, with the same values as the old hand-written list.
    • Every forwarded value comes in as a string, because each argparse option has a string default.
    • name.replace('_', '-') turns each name back into the original flag spelling.
    • --analysis and --bare are still added only when they are set, and in the same order.
    • test_observer.py:1827-1873 captures this command line and checks --idle-confirm-seconds and --effort, so a mistake in the new loop could fail a test.
  • arm_observer.py, _observer_mod. @functools.cache matches the old global-variable cache. Neither one keeps a failed load, so a load that raises is tried again on the next call. The tests still call arm._observer_mod() (test_observer.py:1743, :1797), and that still works.
  • observer.py, the new _json_object helper. It returns {} when the output isn't JSON or isn't a JSON object.
    • _extract_result returns "" in both of those cases, as before.
    • _result_error returns "" in both of those cases, as before.
    • The is_error results and the result/text/terminal_reason fallbacks are the same as before.
    • Tests at test_observer.py:988-997 cover these cases.
  • observer.py, the two file deletions. contextlib.suppress(OSError) does the same thing as the old try/except OSError: pass.
  • stamp_plugin_usage.py. The command-line list only moved onto one line.

Closing issue #14751, acceptance criteria:

  • Behavior unchanged: met, by my reading above. No exported name, flag or file was renamed or removed.
  • Edits only the listed files and changelog fragments: met.
  • Within 400 lines and 15 files: met.
  • ci-status green: the author left this to the PR's CI. I did not verify it.
  • Fragment with ### Changed and "Internal simplification, no behavior change.": met, with bump: patch.
  • setup-apply.mjs: not changed. The PR body says it was already minimal. The issue asks for the files to be simplified "if useful", so leaving one unchanged doesn't break a criterion.

The PR's Verification section lists check results. Those were run by the author's lane, and I have not confirmed them myself.

No plugin manifest changed, so there are no manifest lines. I found no prior findings and no settled threads.

@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

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

@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

Verification evidence for 94f0219

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-15152-94f02194cd82e118dd13fc42b3bbe07defd285e3, expires on 2026-12-10.

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 10, 2026
Merged via the queue into main with commit 06d891b Nov 10, 2026
63 checks passed
@melodic-automation-lanes
melodic-automation-lanes Bot deleted the work-resolve-issue/issue-14751-42883468702-1 branch November 10, 2026 20:03
@github-actions

Copy link
Copy Markdown
Contributor

Post-merge mutation testing

Killed 5, survived 2, timeout 0, no coverage 0, invalid 0, not run 0.
Covered-code score 71%; mutation score 71%.

File Killed Survived Timeout No coverage Invalid Not run
plugins/session-flow/skills/running-retro/scripts/arm_observer.py 1 1 0 0 0 0
plugins/session-flow/skills/running-retro/scripts/observer.py 3 1 0 0 0 0
plugins/session-flow/skills/running-retro/scripts/stamp_plugin_usage.py 1 0 0 0 0 0

Surviving mutants

Location Operator Disposition Cause
plugins/session-flow/skills/running-retro/scripts/arm_observer.py:158 SBR productive input-gap
plugins/session-flow/skills/running-retro/scripts/observer.py:934 other productive input-gap

The run's summary has the full report.

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 running-retro and setup session-flow plugin code

0 participants