Skip to content

fix: keep the original baseline for temporary reasoning effort - #23

Open
BaconDroid wants to merge 1 commit into
ian-pascoe:mainfrom
BaconDroid:fix/reliable-temporary-resets
Open

BaconDroid wants to merge 1 commit into
ian-pascoe:mainfrom
BaconDroid:fix/reliable-temporary-resets

Conversation

@BaconDroid

@BaconDroid BaconDroid commented Oct 19, 2026 •

Copy link
Copy Markdown

Summary

Fixes two bugs in temporary overrides and removes redundant session reads from the tool path.

Temporary overrides could reset to the wrong level, or not reset at all. The reset baseline was resolved after the override was sent, so the plugin's own synthetic message became the new baseline:

  • low then high in one turn reset to low on idle instead of the level from before the turn.
  • low then low again cleared the pending reset, making the temporary change permanent.

The baseline is now read before the first override and kept in state.reset until the change is persisted or a reset succeeds.

A failed session.messages call crashed the tool. (await client.session.messages(...)).data was used without checking .error, and resolveLatestModelInfo(undefined) then threw. Reproduced with a mocked client as TypeError: undefined is not an object (evaluating 'messages.length'). The tool now returns an error string instead.

Changes

  • One session.messages read per tool call instead of two or three, bounded to the latest 20 messages.
  • Cache the provider list for variant lookups (one fetch per plugin instance rather than per call).
  • Session state is now { variant?, reset?: { level, agent, model? } }; the first reset target wins.
  • Drop a stored baseline that the current model does not support.
  • Fall back to the cached current level when the recent history window has no variant, and read model identity and variants from assistant messages.
  • Merge guidance into an existing system[0] instead of pushing a second system message. This incorporates the fix from fix: merge adaptive guidance into existing system prompt #21; credit to @zoomdbz.
  • Replace Zod config parsing with a small validator and drop the zod dependency. Bundle: 500.85 kB → 381.15 kB.
  • Tests now cover the regressions: 16 tests, all passing.

Verification

pnpm verify (format, lint, typecheck, tests, build) passes on this branch.

New regression coverage: repeated temporary changes with different and identical levels, reset retry after a failed idle prompt, message fetch failure, provider lookup failure, stale cached variant after a model switch, assistant-shaped messages, and merging into an existing system prompt.

Behavior is otherwise unchanged: config keys, tool name and arguments, persisted semantics, the 500-session LRU bound, and preservation of the calling agent and model.

Related: this fixes the reset path discussed in #22. #20 (automatic initial effort selection) is out of scope.

Fix the temporary-reset baseline, read assistant-shaped messages, merge
guidance into the first system prompt, and replace Zod config parsing
with a small validator.
@BaconDroid
BaconDroid force-pushed the fix/reliable-temporary-resets branch from a8dae1a to f622615 Compare October 20, 2026 01:25
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.

1 participant