Skip to content

fix(server): recover Prime turns after daemon reconnect - #85

Merged
rynfar merged 1 commit into
pylonfrom
fix/prime-agent-reconnect-recovery
Aug 25, 2026
Merged

fix(server): recover Prime turns after daemon reconnect#85
rynfar merged 1 commit into
pylonfrom
fix/prime-agent-reconnect-recovery

Conversation

@rynfar

@rynfar rynfar commented Aug 25, 2026

Copy link
Copy Markdown
Collaborator

A live Prime Agent turn could fail when only Pylon’s daemon transport reconnected, even though Prime kept the native execution alive. The recovered prompt request could also remain unresolved or reject after the worker had already admitted it.

This change keeps the existing adapter context and turn through a proven in-process reconnect. It accepts complete Prime replay metadata or an exact completed-message suffix, reconstructs missing response/tool/child state, gates descendant quiescence on the new connection generation, and fails closed when continuity cannot be proven. It never sends an admitted prompt again. Pylon process-restart adoption remains separate in #84.

Verification:

  • 212 focused Prime adapter/runtime/MCP tests
  • server typecheck
  • targeted lint and formatting
  • real Prime Agent 0.8.0 client-only transport fault during IPython tool work; the original prompt appeared exactly once and completed with PYLON_TRANSPORT_RECONNECT_OK

Closes #79

Model: GPT-5.6 Sol
Harness: Prime Agent


View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith with what you need. Autofix is disabled.

@github-actions github-actions Bot added vouch:trusted PR author is trusted by repo permissions or the VOUCHED list. size:XL labels Aug 25, 2026
@github-actions

Copy link
Copy Markdown

Thread transfer impact

✅ Thread transfer remains within every enforced ceiling.

Provider Metric Main baseline This PR Impact PR ceiling
Codex Total thread wire 13.3 KiB 13.3 KiB +7 B (+0.1%) 15.1 KiB
Codex Thread snapshot wire 6.9 KiB 6.9 KiB 0 B (0.0%) 7.3 KiB
Codex Live turn WebSocket wire 6.4 KiB 6.4 KiB +7 B (+0.1%) 7.8 KiB
Codex Live turn WebSocket decoded 55.6 KiB 55.6 KiB 0 B (0.0%) 66.4 KiB
Codex Live turn messages 10 10 0 (0.0%) 21
Claude Total thread wire 13.3 KiB 13.3 KiB +54 B (+0.4%) 15.1 KiB
Claude Thread snapshot wire 6.9 KiB 6.9 KiB +7 B (+0.1%) 7.3 KiB
Claude Live turn WebSocket wire 6.4 KiB 6.5 KiB +47 B (+0.7%) 7.8 KiB
Claude Live turn WebSocket decoded 56.3 KiB 56.4 KiB +88 B (+0.2%) 66.4 KiB
Claude Live turn messages 9 11 +2 (+22.2%) 21

Baseline: 1baf147 · PR result: 89d3b9a · Source CI: success

Scenario and decoded snapshot size

10 historical turns, 5 command tools per turn, 878.9 KiB retained MCP result per historical turn, and a 1.05 MiB retained result in the measured turn.

  • Codex decoded thread snapshot: 109.4 KiB
  • Claude decoded thread snapshot: 110.1 KiB

Updated in place by a trusted workflow. PR artifacts are strictly validated and never executed.

@rynfar
rynfar merged commit 0c88313 into pylon Aug 25, 2026
14 checks passed
@rynfar
rynfar deleted the fix/prime-agent-reconnect-recovery branch August 25, 2026 19:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:XL vouch:trusted PR author is trusted by repo permissions or the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Prime Agent active turns fail after daemon reconnect

1 participant