proposal: represent model and effort replacements as generations of one chat
Nobody has claimed this yet.
- Dominant language
- Go
- Stars
- 152
- Forks
- 16
- Avg merge
- 14h 48m
- Merged PRs (30d)
- 536
Description
Problem
Model and reasoning-effort changes currently create durable replacement sessions. /sessions consequently displays each replacement as an independent chat, although users perceive these operations as continuing one conversation.
This issue proposes a direction for discussion; it does not record an accepted architectural decision.
Proposed direction
Introduce a stable logical chat identity above immutable physical session generations:
- Each main chat has a stable
ChatID. - A model or effort replacement creates a new physical session that retains the source
ChatID. - The replacement records
PredecessorSessionID = source.ID. - Explicit user-created forks start independent chats with new
ChatIDvalues and no predecessor. - Keep generation metadata separate from
SessionRelationship, whose current kind-specific validation requires main sessions to carry no relationship.
The target's predecessor field would be authoritative. The source would not receive a corresponding SupersededBy update, avoiding a two-record consistency protocol.
Proposed lifecycle
- Compare the requested effective model and effort with the source configuration.
- If unchanged, keep the existing session and create no generation.
- Otherwise, validate and construct a replacement under the existing source lock and lease.
- Publish the target with the inherited
ChatIDand the source as its predecessor. - Treat target publication as the commit point.
- Release source-local resources only after the target is usable.
- Retain the source snapshot and event log as historical data.
- Make retries discover and reuse an already-published valid successor.
Proposed inventory behavior
/sessionsshows only the latest generation of each chat by default.- Replaced generations remain available through an optional historical view.
- Filtering occurs server-side before counting and pagination; client-side deduplication is insufficient.
- Reverse/head indexes are derived from authoritative predecessor metadata and can be rebuilt.
- Legacy sessions without a
ChatIDmay behave as thoughChatID == SessionID, avoiding an eager migration.
Potential contract changes
- Persist on main sessions:
ChatID- optional
PredecessorSessionID
- Consider a dedicated
ReplaceSessionConfigurationoperation while leavingForkSessionsemantics unchanged. - Add an
IncludeReplacedinventory option. - Extend storage discovery metadata so pagers can identify heads before filtering, counting, and pagination.
Failure posture
- Failure before target publication leaves the source visible and unchanged.
- Failure after publication leaves the target as the recoverable head.
- No source-side durable update is needed for correctness.
- Missing, cyclic, or conflicting generation metadata fails visible: affected sessions remain listed rather than being hidden.
- Reconciliation repairs only derived indexes and never deletes historical generations.
Alternatives to evaluate
- Updating model and effort in place despite the provider-per-session invariant.
- Deleting the source after successful replacement, accepting loss of its independent snapshot and event log.
- Persisting bidirectional predecessor/successor fields with a transactional or reconciliation protocol.
- UI-only grouping, accepting pagination and cross-client inconsistencies.
Related bugs
- #1485 — selecting auto reasoning effort inherits the previous override.
- #1486 — failed effort-switch hydration unbinds the session and leaks its successor.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by tracing model and reasoning-effort replacement, SessionRelationship validation, and /sessions inventory behavior; the issue names no files or tests. First resolve the architectural alternatives and contract choices with maintainers. Done would mean an accepted design covering ChatID and predecessor persistence, head filtering, retries, and failure and reconciliation semantics.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- api, backend, distributed-systems
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Active
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100