Skip to content

refactor(session-flow): simplify audit-sessions, keep-going and recall scripts - #15170

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

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

Conversation

@melodic-automation-lanes

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

Copy link
Copy Markdown
Contributor

Closes #14749

Summary

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

Applied behavior-preserving simplifications to the five listed session-flow scripts: single reads in place of repeated dict lookups, a regex for sweep.py's longest-backtick-run loop, one shared window dict in sweep.py main, a once-computed machine name and shared syscall tuples in check-child-input-wait.py, a one-shot sha256 and a merged guard in check-usage-limit-reset.py, a linear-time resume-prompt boundary in measure-stop-gap.py (the latest prompt after the earliest assistant stamp, replacing a sort plus a nested any), and a flatter stop/caps flow in recall_scan.py. Outputs, exit codes, printed text, flags and exported names are unchanged. No file was renamed, moved or deleted, and no test was touched.

Not verified

  • Python test suites for these scripts (test_sweep.py, test_recall_scan.py, check-child-input-wait.test.py, check-usage-limit-reset.test.py, measure-stop-gap.test.py) were not executed: this lane runs no interpreter. Left to the PR's CI.
  • ruff lint not run locally (no interpreter or ruff in this lane); equivalence and lint were checked by reading. Left to the PR's CI.
  • ci-status green: a PR CI check, left to the PR's CI.
  • tidy passes 4-5 (docs-hygiene and ai-slop) skipped for the changelog fragment: its body text is prescribed verbatim by the issue.

Fix

  • plugins/session-flow/skills/audit-sessions/scripts/sweep.py: read record['tools'] and record['time'] once in _denials and in_window; markdown_code drops redundant \r/\n replaces (str.split already splits on them) and finds the longest backtick run with re.findall; main builds the since/until…
  • plugins/session-flow/skills/keep-going/scripts/check-child-input-wait.py: NO_INPUT_SYSCALLS shares one tuple per architecture family; _linux_verdict computes platform.machine().lower() once
  • plugins/session-flow/skills/keep-going/scripts/check-usage-limit-reset.py: hash the vendored zip with one read_bytes call; merge the tzdata-present and trusted-cache guards; read stdin through a single conditional expression
  • plugins/session-flow/skills/keep-going/scripts/measure-stop-gap.py: the resume-prompt boundary is now max(prompt > earliest assistant), replacing sorted prompts with a nested any (same pick, ties included); stop_at is a single conditional expression
  • plugins/session-flow/skills/recall/scripts/recall_scan.py: counters initialised in one statement; the early-stop break moved to the end of the per-file body; the capped notes are built without the duplicated outer condition
  • .changes/session-flow/work-resolve-issue-issue-14749-42883518271-1-65b42f96.md: new patch fragment, '### Changed' with 'Internal simplification, no behavior change.'

Verification

The runner ran each check from the base copy against 5e7cd28:

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

The run reports:

  • check-changelog-fragments: all 9 fragments under .changes/ valid (run before and after tidy)
  • check-changed-skills: audit-sessions, keep-going and recall PASS with 0 errors; the 4 warnings are pre-existing SKILL.md size warnings not touched by this diff
  • check-affected: 13 passed, 6 skipped (typos not installed; checks that run code from the checked tree), over 6 changed files
  • fresh-context review subagent: read every hunk against the HEAD versions and the tests beside them (test_recall_scan.py, test_sweep.py, check-child-input-wait.test.py, check-usage-limit-reset.test.py, measure-stop-gap.test.py) and found every hunk equivalent, including ties, key order,…
  • code-tidying:tidy-diff over the 17 changed hunks: passes 1-3 found nothing more to change in the code lines
  • The lane run: https://github.com/melodic-software/claude-code-plugins/actions/runs/42883518271

Left out: the items under Not verified.

Related

#14749

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

Security review: PR #15170

I read every hunk of all 6 changed files and found no security issues.

None of the changed files is on a trusted path, and the diff changes no trust control, merge hold, kill switch, token request, plugin manifest or standing instruction.

The only security-relevant code is the bundled-tzdata cache in check-usage-limit-reset.py. I checked it, and it behaves as before:

  • Hash: the zip's SHA-256 is now computed with one read_bytes() call instead of chunked reads. The digest is the same, so the cache directory name derived from it is the same.
  • Trust check: the "tzdata directory exists" test and the _cache_is_trusted(cache_root) ownership test are now joined with or into one guard (plugins/session-flow/skills/keep-going/scripts/check-usage-limit-reset.py:94). Python stops at the first true condition, and either one still returns early. A cache directory another user planted is still skipped, never imported into sys.path.

The other changes are refactors with no trust-boundary impact:

  • sweep.py: single dictionary reads, and a regex in place of the backtick-run loop.
  • check-child-input-wait.py: the machine name is computed once, and the syscall tuples are shared.
  • measure-stop-gap.py: a different way to pick the resume-prompt boundary.
  • recall_scan.py: the early-stop break moved, and the notes are built without the duplicated condition.
  • The changelog fragment: text only.

The PR description is a lane-generated summary and contains no instructions aimed at this review.

critical-findings: 0

@github-actions

Copy link
Copy Markdown
Contributor

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

Code review: PR #15170, session-flow simplifications (closes #14749)

No findings. I read every hunk in all 6 changed files. No changed file is on a trusted path, and this PR does not touch a plugin manifest.

Equivalence check, per hunk

  • sweep.py
    • _denials and in_window now read record["tools"] and record["time"] once. The logic is the same as before.
    • markdown_code: str.split() already splits on \r and \n, so dropping the two replace calls changes nothing. max(map(len, re.findall("+", flat)), default=0)returns the same longest run as the old loop, andre` is already imported (line 59).
    • main: window is now built before the --tickets branch. Nothing in between reassigns it, and the tickets path still spreads it into a new dict. window.update(...) keeps the old key order (since, until, automated_set_aside, unclassified).
  • check-child-input-wait.py: machine is computed at the same point want was before. The shared syscall tuples hold the same values as before.
  • check-usage-limit-reset.py
    • read_bytes() gives the same digest as the chunked read, and any error it raises still lands in the except Exception at line 99.
    • The merged guard keeps the order of the two old checks: the is_dir check still runs before _cache_is_trusted.
    • The stdin read is the same.
  • measure-stop-gap.py: "the latest prompt with some assistant stamp before it" means the same as "the latest prompt after min(assistants)", so both versions pick the same boundary. With empty lists, both give None. Ties pick an equal value either way. The new min(assistants) does not add a new way to raise a comparison error, because line 124 already calls max(assistants) on the same list.
  • recall_scan.py: stopped_early is set only right before the inner break. Moving the outer break to the end of the loop body therefore skips the same files as the old check at the top of the loop. Nothing in the outer body can continue past the new check. The capped: notes print under the same conditions.

Closing issue #14749 acceptance criteria

  • Behavior unchanged: met, judged by reading the code (above). I did not run the scripts or their tests. This is a pure refactor, and the existing test files that the PR names cover these paths.
  • The diff edits only the listed files plus a changelog fragment: met.
  • Within 400 lines and 15 files: met (6 files, small diff).
  • ci-status green: CI has to confirm this. The PR body also says it was left to CI; that is the author's claim, which I have not checked.
  • Fragment bump: patch with a ### Changed heading and "Internal simplification, no behavior change.": met.

The PR's verification claims (fragment and skill checks passed, a subagent equivalence review) come from the author and I have not checked them. I found no embedded instructions in the PR context. Spend: none.

@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

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

@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

Verification evidence for 5e7cd28

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-15170-5e7cd28826c02cc7125355fb2d4444b4950c2225, 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 3415b23 Nov 10, 2026
63 checks passed
@melodic-automation-lanes
melodic-automation-lanes Bot deleted the work-resolve-issue/issue-14749-42883518271-1 branch November 10, 2026 22:00
@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

The post-merge check verified merge commit 3415b23295f715d90a16e460fca440fd8be7e068; 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 audit-sessions, keep-going and recall session-flow plugin code

0 participants