Skip to content

fix(omp): restore ADHD mode after /new, /resume and /fork - #292

Open
Camof1ow wants to merge 1 commit into
ayghri:mainfrom
Camof1ow:fix/omp-session-switch
Open

Camof1ow wants to merge 1 commit into
ayghri:mainfrom
Camof1ow:fix/omp-session-switch

Conversation

@Camof1ow

Copy link
Copy Markdown

Summary

On OMP, a session opened with /new, /resume or /fork inside a running process never gets the ruleset, so ADHD mode is silently off there, even with alwaysOn or --adhd.

OMP emits session_start once per process. Session changes emit session_switch (reason new, resume or fork), which the extension did not handle. This PR restores state on session_switch the same way as on session_start. Pi 1.5.2 has no session_switch event (it emits session_start with a reason), so nothing changes on Pi. Pi's ExtensionAPI types do not declare the event, hence the narrow cast.

  • Before: after new_session, the new session has no i-have-adhd-rules message.
  • After: it has exactly one.

The OMP branch of scripts/check_pi_extension.py now opens a new session and checks for the ruleset.

Fixes #291. #228 also covers this, together with session_branch handling and unrelated eval-budget changes. This PR is only the session-switch part; close it if #228 lands first.

Authorship and provenance — select exactly one

  • Human-authored — substantive implementation and text were produced by a human.
  • Autonomous agent-authored — an agent planned and produced most of the substantive change.
  • Hybrid — a human and one or more agents both made substantive contributions.

Agent/tool and model/version: oh-my-pi (omp) 18.20.0 with Claude Opus 5.5 (claude-opus-5-5)

Agent contribution: Diagnosis from session files and an RPC repro, the code change, the smoke-test step, the checks below, and this description.

Human verification: The submitter reported the missing ruleset after /new, reviewed the complete diff, and approved submitting it. The checks below were run by the agent, not by the submitter.

Known limitations or uncertain results: /resume and /fork use the same handler but were not exercised separately. Checked on Windows 11 only. Three test_judge.EndToEndTest tests fail on this machine on both main and this branch.

Labels

Target label: Target:Integrations

Author label: Author:AI

Workflow labels: bug

Safety and side effects

  • The change does not access or expose secrets, private files, or unrelated user/repository data.
  • Scripts, hooks, workflows, and evals are bounded and do not create surprising or irreversible side effects.
  • No destructive, privileged, production, externally visible, or persistent action occurs without explicit user intent and appropriate safeguards.
  • Network access, third-party code, permissions, and provider costs are minimized and documented.
  • Prompt text, examples, and fixtures contain no hidden instructions that weaken safety or expand agent authority.

Side effects, permissions, network access, and cost:

None. On OMP the handler re-runs the existing state restore when the session changes. The smoke-test step adds one new_session RPC call to the existing --no-session run; no model request.

Compatibility

  • This is not a breaking change.
  • This is a breaking change; it was discussed, and migration/deprecation documentation is included below.
  • Canonical and mirrored skill files are synchronized when applicable. (Not applicable: the skill does not change.)
  • Relevant platform manifests and installation documentation were reviewed. (No manifest or installation change; the smoke test validates the pi and omp fields in package.json.)

Migration or rollback notes: None. Revert the commit to roll back.

Verification

Windows 11, OMP 18.20.0, PYTHONUTF8=1 for the smoke tests (see #245).

  • python scripts/check_pi_extension.py --runtime omp, new smoke step with main's extension — fails: AssertionError: Rules were not injected into the session opened by /new
  • python scripts/check_pi_extension.py --runtime omp on this branch — omp extension smoke test passed
  • python scripts/check_pi_extension.py with Pi 1.5.2 (npm install --prefix <tmp> --ignore-scripts @earendil-works/pi-coding-agent@1.5.2) — pi extension smoke test passed
  • python -m unittest discover -s tests — 78 tests, 3 failures in test_judge.EndToEndTest; the same 3 fail on main
  • tsc --noEmit --strict (TypeScript 5) on extensions/i-have-adhd.ts against Pi 1.5.2 types — 0 errors on main and on this branch; an uncast pi.on("session_switch", ...) fails with TS2769

Behavior evals: Not run; the ruleset text does not change.

Final accountability

  • I reviewed the complete diff, removed unrelated generated changes, and take responsibility for the submitted content.
  • All failed, skipped, or unrun checks are disclosed above.

OMP emits session_start once per process. Opening a session with /new,
/resume or /fork emits session_switch, which the extension ignored, so
the new session never got the ruleset. Restore state on session_switch
the same way as on session_start. Pi does not emit session_switch.

The OMP smoke test now opens a new session and checks for the ruleset.

Fixes ayghri#291
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.

OMP: ruleset not injected after /new, /resume or /fork (session_switch not handled)

1 participant