fix(agent): keep latency traces out of checkpointed graph state #277

Closed
nsaspy wants to merge 0 commits from rage/249-latency-trace-checkpoint into master
Owner

Closes #249

Problem

Every wake voice turn routed to the agent crashed the whole listener at the end of the turn:

TypeError: Type is not msgpack serializable: LatencyTrace

The #209 per-turn InMemorySaver serializes every AgentState channel after every superstep, and AgentManager passed the live LatencyTrace (locks, clock callables) through graph state. Text paths passed None and survived, hiding the regression since PR #211.

Fix

  • latency_trace is no longer an AgentState channel: no checkpoint ever serializes it.
  • run_conversation_loop extracts the trace from a copy of the incoming state and binds it to the agent_node closure; the same instance serves pre-interrupt and post-resume supersteps.
  • Direct-node callers keep the state-dict contract via a fallback; AgentManager and all public signatures unchanged.

Evidence (RAGE run rage/249-latency-trace-checkpoint, start ec0c74a)

  • RED 1: new regression test failed with the exact user TypeError at the checkpoint put.
  • RED 2: closure contract test failed on the missing create_agent_node parameter.
  • GREEN after the minimal graph.py change; #209 approval suite green (54/54 focused).
  • Exact head d823a03: scripts/test-all.sh 11/11 phases, nix flake check all checks, nix build produced zarathushtra-full.
  • Research/design artifacts: rage/249-latency-trace-checkpoint-{research,design}.org.
Closes #249 ## Problem Every wake voice turn routed to the agent crashed the whole listener at the end of the turn: ``` TypeError: Type is not msgpack serializable: LatencyTrace ``` The #209 per-turn `InMemorySaver` serializes every `AgentState` channel after every superstep, and `AgentManager` passed the live `LatencyTrace` (locks, clock callables) through graph state. Text paths passed `None` and survived, hiding the regression since PR #211. ## Fix - `latency_trace` is no longer an `AgentState` channel: no checkpoint ever serializes it. - `run_conversation_loop` extracts the trace from a copy of the incoming state and binds it to the `agent_node` closure; the same instance serves pre-interrupt and post-resume supersteps. - Direct-node callers keep the state-dict contract via a fallback; `AgentManager` and all public signatures unchanged. ## Evidence (RAGE run `rage/249-latency-trace-checkpoint`, start `ec0c74a`) - RED 1: new regression test failed with the exact user `TypeError` at the checkpoint put. - RED 2: closure contract test failed on the missing `create_agent_node` parameter. - GREEN after the minimal `graph.py` change; #209 approval suite green (54/54 focused). - Exact head `d823a03`: `scripts/test-all.sh` 11/11 phases, `nix flake check` all checks, `nix build` produced `zarathushtra-full`. - Research/design artifacts: `rage/249-latency-trace-checkpoint-{research,design}.org`.
nsaspy closed this pull request 2026-09-04 23:09:14 +00:00
Some checks failed
CI / test (pull_request) Failing after 9s
CI / android skeleton gate (pull_request) Failing after 13s
CI / shared mic / Arch Linux (pull_request) Failing after 11m51s
CI / shared mic / Ubuntu 24.04 (pull_request) Failing after 14m41s

Pull request closed

Sign in to join this conversation.
No description provided.