Skip to content

refactor(session-flow): simplify hop_chain.py harness, part 1 of 2 - #14900

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

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

Conversation

@melodic-automation-lanes

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

Copy link
Copy Markdown
Contributor

Closes #14739

Summary

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

Simplified the functions that start in the first half (lines 1-1082) of plugins/session-flow/scripts/harness/hop_chain.py without changing behavior: fill_skeleton merges its two identical cumulative-slot branches via str.removesuffix and builds its id map in one expression, measure_skeleton runs FILL_RE once per line in a single loop, a new private _assistant_blocks helper replaces the assistant-content extraction duplicated in _tool_uses and final_assistant_text, assess_hop seeds its checks with dict.fromkeys, live_runner's ignored second timeout uses contextlib.suppress, and execute_chain computes cfg.model or "" once. Choice basis: each edit was limited to code the issue's range rule allows and checked equivalent input by input; no exported name, flag, output or exit code changed.

Not verified

  • Python test suites for this file (plugins/session-flow/scripts/harness/hop_chain.test.sh, which runs --dry-run and --budget; scripts/tests/test_hop_chain_load_transcript.py; harness/test_resume_cases.py) were not executed: this lane runs no interpreter. Left to the PR's CI.
  • ci-status green on the PR: a PR CI check, left to the PR's CI.
  • tidy passes 4-5 (docs-hygiene, ai-slop) skipped on the changelog fragment: its only line is fixed verbatim by the issue's acceptance criteria, so any rewrite would break that criterion.
  • Lint (ruff) and a Python build/byte-compile of the touched file not run here: no interpreter or linter is available in this lane; left to the PR's CI.

Fix

  • plugins/session-flow/scripts/harness/hop_chain.py: behavior-preserving simplifications in fill_skeleton, measure_skeleton, _tool_uses, final_assistant_text (new private _assistant_blocks helper), assess_hop, live_runner and execute_chain; all in functions starting in range 1 of 2 (lines 1-1082)
  • .changes/session-flow/work-resolve-issue-issue-14739-42716222905-1-9a0a58e7.md: patch fragment, ### Changed with "Internal simplification, no behavior change."

Verification

The runner ran each check from the base copy against 65dd591:

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

The run reports:

  • check-changelog-fragments: all 26 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 (shellcheck: no shell; typos not installed; three validate-plugins sub-checks that run tree code; changed-skills), over 2 changed files (run before and after tidy)
  • fresh-context subagent review of the whole diff: no behavior difference or bug found; confirmed removesuffix is 3.9+, dict.fromkeys keeps key order, no caller or test depends on HopRow.checks identity, contextlib is imported
  • tidy-diff (code-tidying:tidy-diff) over 12 hunk rows: passes 1-3 ran with no edits needed; one proposal (inline content in final_assistant_text needs an unlisted line)
  • The lane run: https://github.com/melodic-software/claude-code-plugins/actions/runs/42716222905

Left out: the items under Not verified.

Related

#14739

Merge-Risk: max=MEDIUM demote=false head=65dd5915afa2fd7c90482794a9c71cd60549cc00 rubric=8.3.1 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 65dd5915afa2fd7c90482794a9c71cd60549cc00: read 2 of 2 changed file(s); 0 finding(s), 0 as inline comments.

Security review: PR #14900 (head 65dd591)

I found no security issues.

I read every hunk of both changed files:

  • plugins/session-flow/scripts/harness/hop_chain.py is a test-harness refactor meant to keep behavior the same. The changes are:

    • fill_skeleton builds its id map in one expression and merges its two cumulative-slot branches using str.removesuffix.
    • measure_skeleton now uses a single loop.
    • A new private _assistant_blocks helper holds the assistant-content extraction that _tool_uses and final_assistant_text used to repeat.
    • assess_hop fills its checks with dict.fromkeys.
    • live_runner uses contextlib.suppress for the second timeout, which it ignores.
    • execute_chain computes cfg.model or "" once.

    None of these touch a subprocess command line, a path built from untrusted input, credentials, tokens or anything that grants trust. The timeout path still kills the process tree before the bounded communicate(timeout=30), so a hung child is handled as before.

  • .changes/session-flow/...md is a changelog fragment with prose only.

No changed file matches a trusted-path glob. The diff touches no trust control, merge hold, plugin manifest or standing instruction, and it uses no extra prepaid spend. The PR context contains no embedded directives aimed at this lane. There are no prior findings, and this is the lane's first review of the PR.

critical-findings: 0

@github-actions

github-actions Bot commented Nov 9, 2026

Copy link
Copy Markdown
Contributor

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

Code review: PR #14900, part 1 of 2 of the hop_chain.py simplification

No findings. I read every hunk of both changed files and checked each edit against the head file for equivalence.

Equivalence checks

  • fill_skeleton, cumulative slots (hop_chain.py:472-478): the two old branches become one removesuffix("-new") lookup. This is the same behavior because CUMULATIVE_SLOTS (L343) has no -new name. A bare slot maps to itself, and an X-new slot maps to X as before. The trail-new case is still handled earlier, at L458, so it never reaches the new code.
  • fill_skeleton, ids: the new conditional expression gives the same result as before.
  • measure_skeleton: one pass over the lines now produces the same kept lines and padded-slot count.
  • _assistant_blocks: the new helper returns [] where the old code ran continue. In _tool_uses this means no blocks are yielded and the ordinal is never used. In final_assistant_text, parts is empty, so text keeps its last value. Both match the old behavior.
  • assess_hop: row is created just before at L702, and its checks defaults to an empty dict (L540). Replacing it with dict.fromkeys(CHECKS, "FAIL") gives the same contents. L1145 already uses the same assignment form.
  • live_runner: contextlib is already imported (L32), so the suppress change is safe.
  • execute_chain: cfg.model or "" is now computed once into model, with the same value.

Closing issue #14739

  • Behavior unchanged: met, per the checks above. The harness's existing self-tests (hop_chain.test.sh, test_resume_cases.py) cover these paths.
  • Edits only the listed file plus a fragment: met.
  • Within 400 changed lines and 15 files: met.
  • Fragment with bump: patch, ### Changed and "Internal simplification, no behavior change.": met.
  • Only functions starting in range 1: met. The file has about 2,160 lines, and the last changed function, execute_chain, starts at about L1051.
  • ci-status green: not something I can see here. The author's test runs are author-claimed and I did not verify them, because this lane has no interpreter.

str.removesuffix needs Python 3.9 or later. The same plugin's tests already use it, so the change adds no new version requirement.

No manifest changes, no embedded instructions in the PR context, and no prior findings to carry over.

@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

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

@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

Verification evidence for 65dd591

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-14900-65dd5915afa2fd7c90482794a9c71cd60549cc00, 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 1839241 Nov 9, 2026
65 checks passed
@melodic-automation-lanes
melodic-automation-lanes Bot deleted the work-resolve-issue/issue-14739-42716222905-1 branch November 9, 2026 23:55
@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

The post-merge check verified merge commit 18392414a11ae0a4a14949220ba726b6e7554c69; 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 hop_chain.py session-flow plugin code (part 1 of 2)

0 participants