fix(markdown): a rewritten assistant reply reseeds the session instead of resuming it
This commit is contained in:
@@ -296,6 +296,7 @@ class ClaudeSdkBackend:
|
||||
system: str | None = None, # noqa: ARG002 - the agent owns its prompt
|
||||
conversation_id: str | None = None,
|
||||
session_id: str | None = None,
|
||||
reseed: bool = False,
|
||||
capture: TurnCapture | None = None,
|
||||
kind: str = "deep",
|
||||
pinned: bool = False,
|
||||
@@ -315,7 +316,9 @@ class ClaudeSdkBackend:
|
||||
prior = history[:-1]
|
||||
key = conversation_id or fingerprint(prior)
|
||||
spec = _SessionSpec(kind=kind, pinned=pinned, tools=tools)
|
||||
live = await self._acquire(key, session_id=session_id, history=prior, spec=spec)
|
||||
live = await self._acquire(
|
||||
key, session_id=session_id, history=prior, spec=spec, reseed=reseed
|
||||
)
|
||||
message_id = f"msg_{uuid.uuid4().hex}"
|
||||
yield build_message_start(message_id=message_id, model=self._agent.model)
|
||||
turn = _Turn()
|
||||
@@ -484,10 +487,13 @@ class ClaudeSdkBackend:
|
||||
session_id: str | None,
|
||||
history: list[dict[str, Any]],
|
||||
spec: _SessionSpec,
|
||||
reseed: bool = False,
|
||||
) -> Session:
|
||||
live = self._pool.get(key)
|
||||
if live is not None:
|
||||
return live
|
||||
if not reseed:
|
||||
return live
|
||||
await self._pool.close(key)
|
||||
resume = session_id
|
||||
if resume is not None:
|
||||
await self.repair_session(resume)
|
||||
|
||||
Reference in New Issue
Block a user