9p: fix offset to point past user prompt in chat
Capture chatOffset after the user event is appended rather than before Submit, so tail -c +$((offset+1)) yields only the model response for that turn. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
de1bf9612d
commit
261fa547fb
|
|
@ -104,9 +104,6 @@ func (s *SessionFileStore) Put(name string, data []byte) error {
|
|||
}
|
||||
switch name {
|
||||
case "prompt":
|
||||
s.sess.mu.Lock()
|
||||
s.sess.chatOffset = len(s.sess.chatLog)
|
||||
s.sess.mu.Unlock()
|
||||
s.sess.core.Submit(s.sess.ctx, input, s.makePublish())
|
||||
s.sess.trackMutable()
|
||||
|
||||
|
|
@ -199,6 +196,11 @@ func (s *SessionFileStore) makePublish() func(agent.Event) {
|
|||
}
|
||||
}
|
||||
s.sess.appendChat(formatEvent(ev))
|
||||
if ev.Role == "user" {
|
||||
s.sess.mu.Lock()
|
||||
s.sess.chatOffset = len(s.sess.chatLog)
|
||||
s.sess.mu.Unlock()
|
||||
}
|
||||
s.sess.trackMutable()
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Reference in New Issue