Skip to main content

Module phase_timing

Module phase_timing 

Source
Expand description

Named phases of a long tool call (#2063).

LEAN_CTX_PHASE_TIMING=1 prints each phase’s start and duration to stderr, so a slow call can be attributed without a debugger — also a call that never finishes, whose phases would otherwise print nothing. Independently, the phases that are still running are kept, so lean-ctx call can say where it is stuck instead of going silent.

Each guard owns its own entry, so concurrent calls (the MCP server runs many at once) cannot overwrite or resurrect each other’s phase when their guards drop out of order.

Structs§

PhaseGuard

Functions§

current
The most recently entered phase still running and how long it has run.
enter
Marks name as running until the guard drops.
note_slow
Reports one slow step inside phase (one source of a scan, say) when phase timing is on. detail names the step; it goes to stderr only.