Skip to content

Restore raw machine communication in the Console (Show verbose) - #576

Merged
knipknap merged 4 commits into
mainfrom
fix/console-verbose-raw-lines
Oct 17, 2026
Merged

knipknap merged 4 commits into
mainfrom
fix/console-verbose-raw-lines

Conversation

@knipknap

@knipknap knipknap commented Oct 17, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Since the GRBL protocol stack moved into the raydriver Rust session, raw lines no longer reached the Python logging pipeline, so the console's "Show verbose" switch had nothing left to display besides high-level state changes (#573).

  • raydriver typed events: the session delivers a single typed SessionEvent (PyO3 complex enum) instead of (name, payload) string tuples; raydriver 0.5.1 additionally types event_callback as Callable[[SessionEvent], Any] in its stubs.
  • _on_session_event matches on the event variants — no string matching, no hand-written union; each former branch is a small named handler with typed payloads, and unknown events fall through to the debug log.
  • The driver logs raw lines with the same categories the old Python driver used: STATUS_POLL for status reports, MACHINE_RESPONSE for ok/error: acknowledgements, MACHINE_EVENT for other incoming lines, and RAW_IO for outgoing commands — so the console shows the full conversation again, with status polls gated behind "Show verbose".
  • Bumps raydriver to ==0.5.1, regenerates pixi.lock, and syncs requirements.txt / debian/requirements-bundle.txt with the pin.

Test plan

  • TestRawLogging tests in tests/machine/driver/grbl/test_grbl_serial_driver.py run against the GRBL firmware emulator through the real Rust session; all 238 tests under tests/machine/driver/grbl pass.
  • pixi run lint (ruff + pyright) green; pyright checks the callback against the typed Callable[[SessionEvent], Any] stub signature.

Closes #573

Since the GRBL protocol stack moved into the raydriver Rust
session, raw lines no longer reached the Python logging pipeline,
so the console's 'Show verbose' switch had nothing to display
(besides high-level state changes).

raydriver 0.4.0 now reports each complete line via raw_rx/raw_tx
session events; the driver logs them with the same categories the
old Python driver used: STATUS_POLL for status reports,
MACHINE_RESPONSE for ok/error acknowledgements, MACHINE_EVENT for
other incoming lines, and RAW_IO for outgoing commands.

Bumps the raydriver requirement to ==0.4.0.

Closes #573
raydriver 0.5.0 delivers a typed SessionEvent to the driver's
event callback instead of (name, payload) string tuples, so
_on_session_event now matches on the event variants; each former
branch became a small named handler. The callback is annotated as
a union of the stub's variant classes with assert_never in the
fall-through, so an event added on the Rust side fails the type
check here until it is handled.

Also regenerates pixi.lock (raydriver 0.3.0 -> 0.4.0) and syncs
requirements.txt and debian/requirements-bundle.txt with the
pixi.toml pin; both were left at 0.3.0.

Requires the raydriver typed-events change (barebaric/raydriver#5);
the pin and lockfile move to 0.5.0 once it is released.
Raydriver 0.5.0 delivers the typed SessionEvent consumed by the
driver's event callback. Relocks pixi.lock and syncs the
requirement files with the pin.
Raydriver 0.5.1 types event_callback as Callable[[SessionEvent],
Any] in its stubs, so _on_session_event takes the SessionEvent
directly and the hand-written union of all variant classes is no
longer needed; unknown events fall through to the debug log.

Bumps raydriver to 0.5.1, relcoks pixi.lock and syncs the
requirement files with the pin.
@knipknap
knipknap merged commit e485bc2 into main Oct 17, 2026
35 checks passed
@github-actions

Copy link
Copy Markdown

🤖 Estimated LLM implementation cost

Replayed each of the 4 commits in this pull request and counted the code lines each commit added or rewrote:

Commit Message Lines (add/rewrite) Est. output tokens Est. output cost
84a88f45 Restore raw machine communication in the Console (Show verbose) 53 / 1 540 $0.0081
b4aef443 refactor: consume typed raydriver session events 70 / 47 1,170 $0.0175
103c9c63 Bump raydriver to 0.5.0 3 / 3 60 $0.0009
cb3bea7c Type the session event callback, drop the duplicated event union 5 / 17 220 $0.0033
Total 199 1,990 $0.0299

Added lines by language: Python 122, Plain Text 6, TOML 3

Full estimate

Component Est. tokens Est. cost
Code emission (199 add/rewrite lines) 1,990 $0.0299
Context input (reading touched files) 39,499 $0.1185
Conversation replay (≈15× output) 29,850 $0.0896
Prompting (pull request description) 277 $0.0008
Debug cycles (20 failed checks) 420,000 $1.5000
Lower bound (output only) 1,990 $0.0299
Best estimate 491,616 $1.7387

Cost model: ≈10 tokens per code line at $15/Mtok output and $3/Mtok input (assuming heavy prompt caching); input ≈ 15× output for conversation replay; a review round ≈ 42,000 tokens; a failed CI run ≈ 21,000 tokens; file reads capped at 20 kB each.

Active window from first commit to merge: <1 day.

⚠️ Caveat: the lower bound covers only the tokens for emitting the code. The best estimate adds modeled overhead for exploration, conversation replay, review and debug turns, but real sessions vary by tool and task — treat it as an order-of-magnitude figure. Human engineering time is not included.

This branch was successfully deployed

1 active deployment
pypi — cb3bea7c Deployed Oct 17, 2026 by knipknap via Build and Publish Wheel #2362
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.

Console "Show verbose" does not show raw machine responses (e.g. $?)

1 participant