Skip to content

Hosted compositions compose without the local group-commit writer - #603

Merged
kfallah merged 1 commit into
mainfrom
hosted-write-ledger-optional
Aug 23, 2026
Merged

Hosted compositions compose without the local group-commit writer#603
kfallah merged 1 commit into
mainfrom
hosted-write-ledger-optional

Conversation

@kfallah

@kfallah kfallah commented Aug 22, 2026

Copy link
Copy Markdown
Contributor

Platform #620 (merged) composes the native control plane over Postgres-backed components with no write_ledger; at the pinned revision NativeControlPlane.__init__ unconditionally runs SyncGroupCommitLedger(components.write_ledger), so the hosted worker crashes at startup:

AttributeError: 'HostedNativeGatewayComponents' object has no attribute 'write_ledger'

(reproduced against platform main's exact pin before writing this fix.)

Root cause: the hosted seam leaked local-engine implementation details — the components protocol demanded the SQLite group-commit batching writer, which a Postgres host cannot honestly provide.

  • write_ledger is now GroupCommitAttemptLedger | None; hosted stores return None or omit the attribute (getattr fallback keeps platform's current dataclass working with just a pin bump)
  • ledger is retyped as a structural SyncWriteLedger protocol: the synchronous, thread-safe durable surface data-plane threads settle through; the local composition still batches through the group-commit facade unchanged
  • Regression tests construct the control plane over hosted-shaped components (attribute absent, and None) and settle a request end to end through the raw path

After this merges, platform only needs to bump its experiential pin — no platform code changes.

🤖 Generated with Claude Code

Platform #620 merged a hosted composition whose components have no
write_ledger, and NativeControlPlane crashed constructing (AttributeError)
because the bridge unconditionally wrapped components.write_ledger in the
group-commit facade. The seam had leaked two local-engine implementation
details into the hosted contract: write_ledger typed as the SQLite
batching writer and ledger typed as SQLiteAttemptLedger.

The contract now says what it means: write_ledger is optional (hosted
stores return None or omit it) and ledger is a structural SyncWriteLedger,
the synchronous durable surface the data-plane threads settle through.
The bridge falls back to the host's own ledger when no group-commit
writer exists; the local composition is unchanged. Regression tests
construct the control plane over components with write_ledger absent and
None and settle a request end to end through the raw path.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@greptile-apps

greptile-apps Bot commented Aug 22, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR allows the native control plane to run over hosted components that lack the local SQLite group-commit writer, falling back to their synchronous durable ledger while preserving local batching.

  • Introduces a structural synchronous ledger contract for admission and settlement writes.
  • Makes the local group-commit writer optional and supports components that omit the attribute.
  • Moves shared quota-error construction into the settlement module.
  • Adds regression coverage for hosted-shaped components using both absent and null writers.

Confidence Score: 5/5

The PR appears safe to merge with no concrete blocking or independently actionable non-blocking issue identified.

The hosted fallback matches the bridge’s synchronous write call surface, local compositions retain their existing group-commit path, and regression tests cover both supported forms of a missing writer.

Important Files Changed

Filename Overview
exp/runtime/gateway/native_bridge.py Selects either the local group-commit facade or the hosted synchronous ledger and reuses the shared quota-error helper.
exp/runtime/gateway/native_components.py Defines the synchronous durable write protocol and makes the local group-commit writer optional.
exp/runtime/gateway/native_bridge_test.py Adds end-to-end regression coverage for hosted-shaped components with an absent or null group-commit writer.
exp/runtime/gateway/native_settlement.py Centralizes construction of the public monthly-quota protocol error.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[NativeControlPlane initialization] --> B{write_ledger present?}
    B -->|Yes| C[SyncGroupCommitLedger facade]
    B -->|No or None| D[Hosted synchronous ledger]
    C --> E[Accept request and start attempt]
    D --> E
    E --> F[Provider dispatch]
    F --> G[Durable terminal settlement]
Loading

Reviews (1): Last reviewed commit: "Hosted compositions compose without the ..." | Re-trigger Greptile

@kfallah
kfallah merged commit a0ec90f into main Aug 23, 2026
14 checks passed
@kfallah
kfallah deleted the hosted-write-ledger-optional branch August 23, 2026 00:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant