feat: add --log flag for non-pausing logpoints#1
Open
mvanhorn wants to merge 1 commit intoillscience:mainfrom
Open
feat: add --log flag for non-pausing logpoints#1mvanhorn wants to merge 1 commit intoillscience:mainfrom
mvanhorn wants to merge 1 commit intoillscience:mainfrom
Conversation
Logpoints emit a formatted message at a source line without pausing
execution. Useful for inspecting state inside hot loops and async
paths where pause-eval-continue is too disruptive.
CLI:
vibe-debug debug-python script.py \
--log 'script.py:7 | iter={i} value={value}' \
--break script.py:18
Output (text and JSON) gains a 'logs' array containing the
formatted messages with file/line attribution. Combines naturally
with --break and --eval.
DAP plumbing:
- DebugSession.set_breakpoints accepts log_messages (per-line)
- DebugSession.drain_logpoints filters DAP output events for
matches by (source.path, line) when debugpy attributes them
or by template-regex fallback when source is empty
- MCP debug_set_breakpoints gains an entries[] schema with
optional logMessage / condition / hitCondition for DAP parity
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
vibe-debug debug-pythonnow supports--log 'FILE:LINE | MESSAGE'for non-pausing logpoints. The debugger continues past the line and emits the formatted message into the run's output (text and JSON), letting an agent observe state inside hot loops or async paths without paying the pause-eval-continue round-trip cost.Why this matters
Today the only observation surface in
debug-pythonis a pausing breakpoint plus--eval. For a function that runs many times (loop body, request handler, recursive call), an agent has two options: stop on every hit and re-eval (multiple round trips), or skip observation and guess. Logpoints are the standard third option: stop without stopping, get the formatted state in the response payload.The Debug Adapter Protocol exposes this natively as
logMessageonsetBreakpoints, and debugpy supports it. Two adjacent agent-debugger projects ship the same capability:Demo
The demo runs a 3-iteration loop with two invocations:
--log "loop_demo.py:5 | iter={i} value={value}"alone: prints three log lines and exits.--log ... --break loop_demo.py:6 --eval total: logs every iteration AND stops at line 6 to inspect the final state.Output appears in a
Logs:section aboveStopped:(text mode) and alogs[]array alongsidebreakpoints/stopped/locals/evaluations(JSON mode).Changes
cli.py: new_parse_logpointparser forFILE:LINE | MESSAGEsyntax,--logflag ondebug-python,Logs:block in human output, and a file-grouping helper so multiple breakpoints in the same source go through a singlesetBreakpointsrequest (DAPsetBreakpointsreplaces all breakpoints for that source, so per-line calls would clobber).session.py:set_breakpointsgains optionallog_messages(plusconditionsandhit_conditionsfor DAP parity, exposed via MCP only in this PR; CLI conditional/hit-count would be a follow-up). Newdrain_logpoints()filters DAPoutputevents for matches by(source.path, line)when debugpy attributes them, with a template-regex fallback for outputs that arrive without source info.mcp_server.py:debug_set_breakpointsgains anentries[]schema (alternative tolines) supportinglogMessage/condition/hitCondition.debug_python_reproanddebug_continuedrain logpoints into the response.README.md: documents the new flag in the Useful Options section.Testing
22 tests pass (
python -m unittest discover -s tests -v). New tests:tests/test_cli.py::test_debug_python_logs_and_stops_at_breakpoint- end-to-end CLI run combining--log+--break+--evaltests/test_cli.py::test_parse_logpoint_requires_separator- parser error casetests/test_session.py(new file, 4 tests) - DAP request body shape,drain_logpointshappy path, template-regex fallback, ignoring unrelated program stdouttests/test_mcp_server.py::test_debug_set_breakpoints_accepts_logpoint_entries- MCPentries[]shapevibe-debug doctorandpython tools/runtime_proof.pystill pass.Notes
This is a cold first PR. Happy to convert to a Discussion or close if the direction doesn't fit your roadmap. The scope creep on
conditions/hit_conditions(MCP-only, no CLI exposure) was added because it sits along the sameset_breakpointsseam; if you'd prefer to keep this PR strictly logpoints-only, I can strip those parameters and re-submit.