Skip to content

fix(prime): wait for async child continuations - #81

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

fix(prime): wait for async child continuations#81
rynfar merged 1 commit into
pylonfrom
fix/prime-agent-async-continuations

Conversation

@rynfar

@rynfar rynfar commented Aug 25, 2026

Copy link
Copy Markdown
Collaborator

Problem

Prime daemon sessions completed Pylon's canonical turn at the first native RunCompleted event. A depth-1 child could finish afterward and resume its parent internally, but Pylon had already emitted a false missing-final warning, completed the turn, dropped the resumed final answer, and left the client in a stale working state.

Fix

  • use Prime Agent 0.8.0's public waitForHeadlessCompletion({ waitForRlmQuiescence: true }) boundary after each Pylon-owned daemon prompt
  • correlate each FIFO quiescence marker with the canonical turn/input token and daemon connection generation
  • re-arm and serialize barriers after steering or follow-up input, ignoring stale markers from earlier inputs or turns
  • fail the turn and dispose the native session when a barrier rejects or reconnect makes event continuity uncertain
  • compute terminal usage from validated cumulative stats so child and continued-parent usage is included
  • retain legacy response-boundary behavior when the authoritative barrier is unavailable
  • document the completion, reconnect, usage, and version-fallback contracts

Closes #80.

Verification

  • combined Prime/MCP regression suite across eight focused files — 274 passed
  • vp run -F t3 typecheck — passed
  • targeted lint on all seven changed TypeScript files — 0 warnings, 0 errors
  • formatting and git diff --check — passed
  • real isolated Pylon web client on 7e3529c3a with Prime Agent 0.8.0 — one depth-1 child completed after the root response boundary and resumed its parent with PYLON-ASYNC-FINAL-7E35; SQLite recorded one completed canonical turn, both root response segments, no runtime error or false missing-final warning, and the terminal reported cost included the child-inclusive cumulative usage delta
  • fresh PR CI on 7e3529c3a — 11 checks passed, 3 expected skips, 0 failures

Implemented by GPT-5.6 Sol using 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 size:L vouch:trusted PR author is trusted by repo permissions or the VOUCHED list. labels Aug 25, 2026
@github-actions

github-actions Bot commented Aug 25, 2026

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 −2 B (−0.0%) 15.1 KiB
Codex Thread snapshot wire 6.9 KiB 6.9 KiB +2 B (+0.0%) 7.3 KiB
Codex Live turn WebSocket wire 6.4 KiB 6.4 KiB −4 B (−0.1%) 7.8 KiB
Codex Live turn WebSocket decoded 55.6 KiB 55.6 KiB −44 B (−0.1%) 66.4 KiB
Codex Live turn messages 11 10 −1 (−9.1%) 21
Claude Total thread wire 13.3 KiB 13.3 KiB +37 B (+0.3%) 15.1 KiB
Claude Thread snapshot wire 6.9 KiB 6.9 KiB −13 B (−0.2%) 7.3 KiB
Claude Live turn WebSocket wire 6.4 KiB 6.4 KiB +50 B (+0.8%) 7.8 KiB
Claude Live turn WebSocket decoded 56.3 KiB 56.4 KiB +44 B (+0.1%) 66.4 KiB
Claude Live turn messages 9 10 +1 (+11.1%) 21

Baseline: 14bad65 · PR result: 7e3529c · 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 force-pushed the fix/prime-agent-async-continuations branch from 998affa to 0e29409 Compare August 25, 2026 15:01
@rynfar
rynfar force-pushed the fix/prime-agent-async-continuations branch from 0e29409 to 7e3529c Compare August 25, 2026 16:40
@rynfar
rynfar merged commit 3038d83 into pylon Aug 25, 2026
14 checks passed
@rynfar
rynfar deleted the fix/prime-agent-async-continuations branch August 25, 2026 16:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:L 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 daemon turns finish before async child continuations

1 participant