Open
Conversation
_run_reasoning_loop returned 2-tuples but perceive() unpacked 3, and _check_interval_rules passed an unsupported timepoint= kwarg to IntervalRule.matches(). Both errors were swallowed by broad except handlers, silently degrading every prediction to "early" and preventing interval rules from ever firing. Also adds initial_stage/initial_confidence to PerceptionResult and completes the messages history at early returns so the multishot scaffold is type-clean and continuable.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Four changes:
_run_reasoning_loop()returned 2-tuples butperceive()unpacked 3 — every call raised, got swallowed, and degraded tostage="early"._check_interval_rules()passed an unsupportedtimepoint=kwarg toIntervalRule.matches()—TypeErrorwas swallowed, so interval rules never fired.initial_stage/initial_confidenceonPerceptionResultso the multishot block's assignments are real fields._run_reasoning_loop()now returns a complete conversation history — the model's final assistant turn (and on the verification path, its tool_result) is appended tomessagesbefore returning. This is behaviorally inert today (multishot_turns=0means nothing consumesmessages), but it changes what context any future continuation sees: the model will now have its own prior answer in history when asked to reconsider, rather than a conversation that skips straight from the last user turn to the reconsider prompt.Changes
1.
_run_reasoning_loop()returns(result, trace, messages)at all exits +NotImplementedErrorstubs —engine.pyperceive()unpacks 3 values from_run_reasoning_loop()(line 456), but the function returned 2-tuples at every exit. TheValueErrorwas caught byPerceptionManager.process_imageand converted tostage="early", confidence=0.0, so every prediction silently degraded. All three returns now includemessages. The undefined_build_reconsider_prompt/_call_claudereferenced in the multishot block are stubbed to raiseNotImplementedErrorpointing atmultishot_turns=0.2. Drop
timepoint=kwarg fromIntervalRule.matches()call —timelapse.py_check_interval_rules()passedtimepoint=estate.timepoints_acquired, butIntervalRule.matches()has no such parameter. TheTypeErrorwas swallowed by the broad except wrapping perception, so configured interval rules never applied. Dropped the kwarg at the call site for now — if we want timepoint-based triggering later,IntervalRule.matches()(timelapse_models.py:42) needs atimepoint: int | None = Noneparameter added alongside.3. Add
initial_stage/initial_confidencetoPerceptionResult—session.pyThe multishot block assigns these (engine.py:466, 495-496) but they weren't declared on the dataclass. Now real
Optionalfields; pyright is clean and the values survivedataclasses.asdict().4. Append the assistant turn to
messagesbefore early returns —engine.pyThe end-turn and verification return paths parsed the model's final answer but never appended it to
messages, so any caller continuing the conversation would send a user turn directly after a user turn with the model's own answer missing. Both paths now append the assistant turn; the verification path also appends atool_resultso the history is API-valid. No effect on the default path today sincemessagesis only consumed whenmultishot_turns > 0, but it changes the contract of what the function returns.Testing
pytest tests/— 489 passed, 3 skipped, 0 regressions (14 pre-existing async-test failures frompytest-asyncionot being installed reproduce identically on clean HEAD)pyright session.py— 0 errorspyright engine.pylines 460-509 (multishot block) — 0 errors; remaining engine.py errors are pre-existing and unrelatedtimepoint=raisesTypeError; invoking either stub raisesNotImplementedError