Harden paged chat history loading

Close the per-thread history loading gate before launching requests, make live/history part reconciliation linear, and reject duplicate history envelope fields.

Complete task-owned history paging work remains preserved in the preceding recovery commit. Checked packaged templates and packaged authoring skill references: neither needs an update; docs/notes/large-chat-history.md records the stale shared documentation.
This commit is contained in:
2026-10-18 15:21:09 +01:00
parent ff1775e11f
commit 18e7d073a6
4 changed files with 40 additions and 14 deletions
+2 -1
View File
@@ -138,7 +138,8 @@ func TestHistoryLegacyLargeToolAndNonJSON(t *testing.T) {
func TestHistoryRejectsMalformedIncludingDiscardedDetail(t *testing.T) {
for _, raw := range []string{
`null`, `{"data":null}`, `{"data":{}}`, `{"data":[],"cursor":{"next":42}}`,
`{"data":[]} {}`, `{"data":[}`, `{"data":[],}`, `{"data":[],"x":01}`,
`{"data":[],"data":[]}`, `{"data":[],"cursor":{"next":"one"},"cursor":{"next":"two"}}`,
`{"data":[]} {}`, `{"data":[}`, `{"data":[],}`, `{"data":[],"x":01}`, `{"data":[],"x":1,"x":2}`,
`{"data":[],"state":{"text":"` + strings.Repeat("x", 1<<20) + `\q"}}`,
`{"data":[],"state":{"text":"` + strings.Repeat("x", 1<<20) + `\u12G4"}}`,
`{"data":[],"state":{"text":"` + strings.Repeat("x", 1<<20),