Add task_id to SessionSourceType::User#15
Draft
cephalonaut wants to merge 3 commits into
Draft
Conversation
Decorate `SessionSourceType::User` with an `Option<String> task_id`
field so manually-shared local sessions can plumb the conversation's
server-side `ai_tasks` row id through to orchestration discovery, just
as cloud-spawned `AmbientAgent` sessions do today.
Wire compatibility is preserved in both directions:
* The custom `Deserialize` accepts all three shapes: bare `"User"`
(legacy), `{"User":{"task_id":"..."}}` (new), and
`{"AmbientAgent":{"task_id":"..."}}` — mirroring the existing
`AmbientAgent` handling.
* A new manual `Serialize` impl emits the bare legacy form when
`task_id.is_none()` and the struct form otherwise, so older readers
that only understand the unit-variant shape stay forward-compatible
until they pick up the new deserializer.
* `From<&SessionSourceType> for LegacySessionSourceType` now matches
`User { .. }` instead of the unit variant, so the legacy
`JoinedSuccessfully.source_type` field continues to round-trip.
Adds a `SessionSourceType::orchestrator_task_id()` helper that returns
the `task_id` regardless of variant, so downstream orchestration sites
can key off task-id presence rather than the variant discriminant.
Includes unit tests covering legacy + new wire shapes in both
directions, default value, the helper, and the `From` mapping for both
variants.
Co-Authored-By: Oz <oz-agent@warp.dev>
Mirror the existing deserialize_new_user_with_null_task_id test for the AmbientAgent variant so we keep wire compatibility with any already-persisted Redis SessionManifest rows that were written before the manual Serialize impl collapsed the None case to the bare unit-variant form. Co-Authored-By: Oz <oz-agent@warp.dev>
Trim the multi-line doc comments left by the previous cleanup: - SessionSourceType::User: drop the orchestrator-discovery paragraph and fold the `task_id` description into a single sentence. - Default impl: collapse the 4-line "default matches previous behavior" note to a 2-line stable-Rust workaround note. - orchestrator_task_id: drop the "Used to drive orchestration discovery" postscript — the function name carries it. - Serialize impl doc: collapse the 6-line variant explanation to 3 lines. - session_source_type_tests module doc: drop the multi-paragraph migration narrative and keep the one-line summary. - deserialize_new_ambient_agent_with_null_task_id: shorten the inline rationale to one line. Co-Authored-By: Oz <oz-agent@warp.dev>
1 task
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.
What
Extends
SessionSourceType::Userfrom a unit variant toUser { task_id: Option<String> }, mirroring the existingAmbientAgentshape. Adds a manualSerializeimpl that emits the legacy bare"User"form whentask_idisNoneand the struct form when populated, keeping older readers wire-compatible. The newtask_idcarries the conversation's server-sideai_tasksrow id so downstream orchestration discovery can enumerate the share's descendants.Why
Required by the warp client to support session sharing of manually-shared local orchestrator conversations. Previously only cloud-spawned
AmbientAgentshares could drive orchestration discovery; manual shares had no way to carry atask_idon the wire.Related
Co-Authored-By: Oz oz-agent@warp.dev