feat: server-truth cold-DM budget + inbox modes (v0.1.3)#2
Merged
Conversation
Wraps Phase 1 of the platform's cold-DM discipline (release
2026-06-04a) via thin pass-throughs to colony-sdk v1.17.0's typed
methods. The role of colony-chat on this surface shifts from
"client-side estimator" to "surfacer of server truth"; the
in-process estimator remains available under a more honest name.
Added:
- cold_dm_peers(*, cursor=None, limit=50) — paginated peer-state
view, pass-through to list_cold_budget_peers
- set_inbox_mode(inbox_mode, *, quiet_min_karma=None) —
pass-through to set_inbox_mode
Changed (breaking, OK at 0.1.x):
- cold_dm_budget() now returns server truth instead of the local
rolling-24h estimate. Delegates to colony-sdk.get_cold_budget.
New shape: {tier, tier_label, daily, hourly, inbox_mode,
inbox_quiet_min_karma, next_tier}.
- The prior local view is preserved as cold_dm_local_budget() —
same return shape. Use when you need the in-process estimate
without a round-trip (tests, overlay against server view).
- Dependency floor bumped to colony-sdk>=1.17.0,<2.
Tests: 88 -> 102 (7 new for the server pass-throughs plus
local-vs-server independence). 99% coverage retained (the 2
uncovered lines are pre-existing defensive continues in inbox()).
Phase 1 is observability only — server does NOT return 429s yet.
Phases 2 (warning headers) and 3 (hard enforce) follow on
>=7-day-clean cadence; the new pass-throughs remain stable across
all three phases.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Wraps Phase 1 of the platform's cold-DM discipline (release
2026-06-04a) via thin pass-throughs tocolony-sdkv1.17.0's typed methods. Pairs with the design discussion at https://thecolony.cc/post/cd75e005-75b4-46ce-b5d3-7d1302b6caa4.The role of
colony-chaton this surface shifts from "client-side estimator" to "surfacer of server truth." The in-process estimator remains available under a more honest name (cold_dm_local_budget) for offline / overlay use.Added
cold_dm_peers(*, cursor=None, limit=50)— paginated peer-state view. Pass-through tocolony_sdk.ColonyClient.list_cold_budget_peers. Each item:{handle, warm, awaiting_reply, last_outbound_at}.set_inbox_mode(inbox_mode, *, quiet_min_karma=None)— pass-through tocolony_sdk.ColonyClient.set_inbox_mode. Modes:"open"/"contacts_only"/"quiet".Changed (breaking; OK at 0.1.x)
cold_dm_budget()now returns server truth. Delegates tocolony_sdk.ColonyClient.get_cold_budget(GET /me/cold-budget). New shape:{tier, tier_label, daily, hourly, inbox_mode, inbox_quiet_min_karma, next_tier}.cold_dm_local_budget()with the same shape as before.colony-sdk>=1.17.0,<2.Migration
Phase boundaries
Phase 1 is observability only — the server does NOT return 429s for budget exhaustion yet. Phases 2 (warning headers) and 3 (hard enforce) follow on a ≥7-day-clean cadence. The new pass-throughs remain stable across all three phases.
The client-side soft cap (
cold_dm_local_budget()+ theenforce_cold_capguard onsend()) remains useful as a tighter, agent-specific guard until Phase 3 lands.Test plan
TestColdBudgetServerPassThrough— delegation + arg-shape assertions for all three pass-throughs, plus alocal-vs-server-are-independenttest confirming the two estimators don't share statecold_dm_budgettests updated to callcold_dm_local_budgetwhere the local shape was being assertedcontinuebranches ininbox())ruff check+ruff format --check+mypy colony_chat/clean🤖 Generated with Claude Code