Skip to content

fix(compaction): preserve drafts and queue messages through durable admission - #512

Merged
rynfar merged 7 commits into
pylonfrom
upstream/2026-09-12-runtime
Sep 12, 2026
Merged

fix(compaction): preserve drafts and queue messages through durable admission#512
rynfar merged 7 commits into
pylonfrom
upstream/2026-09-12-runtime

Conversation

@rynfar

@rynfar rynfar commented Sep 12, 2026

Copy link
Copy Markdown
Collaborator

Compacting context now sends /compact separately while preserving the composer draft, attachments, and cursor. Messages submitted during compaction are persisted in FIFO order and sent afterward with their selected model, permissions, and interaction mode.

Pylon previously rejected these messages in the pure decider because compaction still owned the pending turn admission. The port adds a durable queue and correlated internal completion/resume receipts, preserving exact admission and provider-incarnation checks. Provider snapshots cannot erase the queue; only the queued admission's validated session bind can move it to a new provider incarnation during a settings transition. Stop and interrupt cancel unsent entries, while failure and restart leave explicit per-message explanations. An interrupted in-flight send is labeled as uncertain delivery rather than replayed automatically. Slow compaction startup uses the existing bind-pending CAS so a late provider cannot overwrite Stop.

Prime Agent's native compact/abort controls, provider availability gates, and rollback fences remain authoritative. The new queue applies to the shared slash-command compaction path across local, remote, relay, and tunnel clients; it adds no provider-specific protocol behavior.

Upstream cycle #497, frozen range 6c583620ff7ad3235b135af7107c0543467eecfa..4a4c6dd2adc350a68ba18bb28b24b5a7e4660dab:

  • Adopted ef6fa118749572da1905eca5d0543d1e98f0b1b2 — preserve drafts when compacting context (#11103), adapted to Pylon's settings and source-epoch APIs.
  • Adopted 57aee3e19f1910f3323f06384bb2a1d02b79e369 — queue messages during context compaction (#11107), adapted to the persisted decider/admission architecture rather than a reactor-only memory map.

Migration 059 from merged #510 precedes compaction migration 060. This branch is rebased onto Pylon after #510 and #511.

Validation: 377 focused tests across reactor, decider, lifecycle, projection, engine, migration, contracts, and web dispatch logic; typechecks for server, contracts, shared, client-runtime, web, desktop, and mobile; scoped lint and formatting; frozen install. Regression cases cover FIFO settings, single projected bubbles, stale provider snapshots/completion, stop before send and during slow session startup, and restart cancellation. Independent adversarial review is approved; CI is pending on the final rebased head.

Upstream UI recording demonstrates preserved draft/cursor behavior in T3. This is upstream evidence; no Pylon UI recording or manual provider/device session was captured for this port. Native Prime compaction is unchanged.

Implemented and reviewed with GPT-6 in Codex.

@vercel

vercel Bot commented Sep 12, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
pylon-marketing Ready Ready Preview Sep 12, 2026 7:08am UTC

@github-actions

github-actions Bot commented Sep 12, 2026

Copy link
Copy Markdown
Contributor

Thread transfer impact

✅ Thread transfer remains within every enforced ceiling.

Provider Metric Main baseline This PR Impact PR ceiling
Codex Total thread wire 14.1 KiB 13.9 KiB −153 B (−1.1%) 15.1 KiB
Codex Thread snapshot wire 7.2 KiB 7.2 KiB +6 B (+0.1%) 7.3 KiB
Codex Live turn WebSocket wire 6.9 KiB 6.7 KiB −159 B (−2.3%) 7.8 KiB
Codex Live turn WebSocket decoded 58.8 KiB 58.0 KiB −910 B (−1.5%) 66.4 KiB
Codex Live turn messages 10 8 −2 (−20.0%) 21
Claude Total thread wire 14.1 KiB 14.1 KiB −3 B (−0.0%) 15.1 KiB
Claude Thread snapshot wire 7.2 KiB 7.2 KiB +7 B (+0.1%) 7.3 KiB
Claude Live turn WebSocket wire 6.9 KiB 6.9 KiB −10 B (−0.1%) 7.8 KiB
Claude Live turn WebSocket decoded 59.7 KiB 59.7 KiB 0 B (0.0%) 66.4 KiB
Claude Live turn messages 10 10 0 (0.0%) 21

Baseline: a1f748b · PR result: c9c901d · 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: 115.7 KiB
  • Claude decoded thread snapshot: 116.3 KiB

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

maria-rcks and others added 7 commits September 12, 2026 01:20
(cherry picked from commit ef6fa118749572da1905eca5d0543d1e98f0b1b2)
Adapt upstream compaction queueing to the pure decider and exact provider admission. Persist FIFO and in-flight ownership, settle compaction through correlated commands, and expose explicit cancellation receipts on stop, failure, and restart. Preserve composer drafts and acknowledge queued messages without waiting for provider startup.

Upstream-Commit: 57aee3e19f1910f3323f06384bb2a1d02b79e369

Completes Pylon API adaptation of ef6fa118749572da1905eca5d0543d1e98f0b1b2.
Use the ordinary pending-session bind CAS for compaction startup, retain explicit null expectations, and emit uncertain-delivery receipts for dequeued messages interrupted before admission. Add deterministic slow-start Stop and in-flight cancellation regression coverage.
…trap

Keep migration 48 assertions on its historical schema, then apply current migrations before comparing a modern projector rebuild. This includes the compaction queue column required by the current session repository and matches production startup ordering.
@rynfar
rynfar force-pushed the upstream/2026-09-12-runtime branch from 48fbfcb to c9c901d Compare September 12, 2026 07:21
@vercel

vercel Bot commented Sep 12, 2026

Copy link
Copy Markdown

Deployment failed for project pylon-marketing with the following error:

Resource is limited - try again in 24 hours (more than 100, code: "api-deployments-free-per-day").

Learn More: https://vercel.com/pylon-code?upgradeToPro=build-rate-limit

@github-actions github-actions Bot added size:XL and removed size:XXL labels Sep 12, 2026
@rynfar

rynfar commented Sep 12, 2026

Copy link
Copy Markdown
Collaborator Author

Final landing review verified head c9c901df5ac115af1dcdb194698575488ae19743. Independent adversarial review covered durable FIFO admission, exact session ownership through completion/restart/Stop, receipt ordering and migration compatibility. The final two CI-driven changes affect test fixtures only and were independently reviewed. All 10 Actions CI jobs passed in run 34680517219.

The exact compaction and settings heads were also composed at 7b07ec9e621c84d7c18d17b7c18bf6436cc70678: both owners approved the four automatic overlaps, with 266 focused tests and server/web typechecks passing. Vercel preview status is unavailable due to the account build-rate limit; branch protection has no required Vercel context. No quota, deployment configuration, or external plan was changed.

@rynfar
rynfar merged commit cf07138 into pylon Sep 12, 2026
18 of 19 checks passed
@rynfar
rynfar deleted the upstream/2026-09-12-runtime branch September 12, 2026 07:29
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.

2 participants