Skip to content

Commit 0447044

Browse files
committed
chore: preserve release notes across concurrent main landings
2 parents 49c24cf + 9abbdb1 commit 0447044

109 files changed

Lines changed: 5320 additions & 1826 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎CHANGELOG.md‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ Docs: https://docs.openclaw.ai
3232

3333
### Fixes
3434

35-
- **Restart recovery:** preserve resumed channel delivery routes when an older reply finishes cleanup during Gateway restart, including ownership changes immediately before the database write.
35+
- **Bun Gateway:** restore Gateway health checks and agent connections under Bun 1.4 while preserving WebSocket frame limits and authenticated request scheduling.
3636
- **Doctor recovery notes:** show interrupted auth-profile archive recovery failures and completions even when no further migration runs or another migration is declined. (#134009) Thanks @angeliti999.
3737
- Matrix lifecycle: drain in-flight monitor tasks without deadlocking shared-client retirement, and reject late acquisitions after their owning task closes.
3838
- Provider error handling: reuse prepared or already loaded provider hooks instead of cold-loading plugins during error classification, avoiding long stalls in failure reporting and model fallback.
@@ -41,6 +41,7 @@ Docs: https://docs.openclaw.ai
4141
- **Subagent completion:** recognize visible final answers delivered to internal and nested parent sessions, preventing false delivery failures while preserving external channel delivery checks.
4242
- Codex/Linux: wait for a live app-server process to expose its startup command line within the existing inspection deadline, preserving process identity checks and preventing intermittent startup failures.
4343
- **Cloud session lifecycle:** prevent archive, delete, and restart recovery from deadlocking behind an earlier worker move, keep work admission closed through cleanup, and preserve the same successor for concurrent recovery requests.
44+
- **Restart recovery:** preserve resumed channel delivery routes when an older reply finishes cleanup during Gateway restart, including ownership changes immediately before the database write.
4445
- **Upgrade state metadata:** record the current application version after repairing older databases with an unset version marker, allowing CLI commands to use the running Gateway without attempting another schema repair.
4546
- **Gateway cancellation:** route the first `chat.abort` directly to its cancellation handler without loading unrelated chat history and send workflows.
4647

‎docs/cli/doctor.md‎

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -464,9 +464,16 @@ it writes the local support report and prints a prefilled issue URL.
464464

465465
`restore` remains the lower-level undo operation. It uses manifest
466466
`sourcePath -> archivePath` records, moves archived artifacts back only when the
467-
original path is missing, reports conflicts when both paths exist, and leaves
468-
the SQLite database in place. When several manifests recorded the same original
469-
path, restore plans all candidates before moving any of them. Identical archives
467+
original path is missing, reports conflicts for independently existing originals,
468+
and leaves the SQLite database in place. Publication is exclusive: a file or
469+
symbolic link created during verification is not replaced. Restore moves the
470+
original without copying its contents, and fails without consuming the archive
471+
if the filesystem cannot publish it safely. Recorded interrupted publications
472+
can be retried, including with older manifests or after the replacement SQLite
473+
database has been removed. If restore recreates a missing sessions directory,
474+
retries repeat its parent-directory durability check before consuming the archive.
475+
When several manifests recorded the same original path, restore plans all
476+
candidates before moving any of them. Identical archives
470477
are safe duplicates, and one nonempty legacy `sessions.json` may supersede empty
471478
copies created by older writers. Distinct nonempty indexes, distinct transcript
472479
archives, invalid archives, and archives missing without a recorded prior

‎docs/concepts/main-session.md‎

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,27 @@ menu); Home is where you talk to it. Sessions that fork off the main
2828
conversation appear under **Threads**, group chats under **Groups**, and
2929
coding/CLI sessions under **Coding**.
3030

31+
### Talk to Home while working
32+
33+
Select **Talk to your Home agent** in the sidebar footer (or press
34+
`Cmd/Ctrl+Shift+H`) to open Home beside your current page. The assistant
35+
sidebar can dock on the right or bottom.
36+
It follows the agent selected in the sidebar's agent switcher, so there is one
37+
place to change agents. **Ask OpenClaw** remains a separate system-care
38+
conversation in the same sidebar.
39+
40+
The dock uses your real Home conversation, including its history, tools,
41+
approvals, and message queue. **Open Home full page** opens that conversation
42+
in the main area and temporarily hides its dock to avoid duplicate composers.
43+
44+
Expand **Working on** to inspect the small reference snapshot accompanying your
45+
next message: the current page and, when available, the work session, workspace,
46+
and visible file path. Select text in the work area and use **Attach selected
47+
text** to include a bounded excerpt. Use **Remove work context** to send without
48+
the snapshot. It becomes part of the sent message and remains unchanged through
49+
queueing and retries; slash commands do not include it. References do not grant
50+
the Home agent additional access to another agent's sessions or files.
51+
3152
## What flows into the main session
3253

3354
The main session is not just a chat log; it is the place where your agent's

‎docs/plugins/codex-harness-runtime.md‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -460,6 +460,14 @@ failed compaction turn returns a failed operation. Automatic context-pressure
460460
compaction is Codex's job; OpenClaw only starts native compaction for manually
461461
requested triggers.
462462

463+
When OpenClaw projects an existing session's continuity into a fresh Codex
464+
thread, it includes saved compaction and branch summaries, even when no
465+
earlier user messages remain. Context-engine projections preserve those
466+
summary entries too. Summaries stay quoted as prior context, separate from
467+
the current request, and remain subject to the projection's size limits;
468+
oversized summaries or older context can be truncated. This handoff does not
469+
change native Codex compaction ownership.
470+
463471
When a context engine requests Codex thread-bootstrap projection, OpenClaw
464472
projects tool-call names and ids, input shapes, and redacted tool-result
465473
content into the fresh Codex thread. It does not copy raw tool-call argument

‎extensions/codex/src/app-server/context-engine-projection.test.ts‎

Lines changed: 112 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// Codex tests cover context engine projection plugin behavior.
2-
import type { AgentMessage } from "openclaw/plugin-sdk/agent-core";
2+
import { buildSessionContext, type AgentMessage } from "openclaw/plugin-sdk/agent-core";
33
import { describe, expect, it } from "vitest";
44
import {
55
buildCodexContinuityCalibration,
@@ -19,6 +19,15 @@ function textMessage(role: AgentMessage["role"], text: string): AgentMessage {
1919
} as AgentMessage;
2020
}
2121

22+
function summaryMessages(type: "compaction" | "branch_summary", summary: string): AgentMessage[] {
23+
const entry = { id: "summary", parentId: null, timestamp: "2026-01-01T00:00:00.000Z", summary };
24+
return buildSessionContext([
25+
type === "compaction"
26+
? { ...entry, type, firstKeptEntryId: entry.id, tokensBefore: 1_000 }
27+
: { ...entry, type, fromId: "root" },
28+
]).messages;
29+
}
30+
2231
describe("projectContextEngineAssemblyForCodex", () => {
2332
it("produces stable output for identical inputs", () => {
2433
const params = {
@@ -93,6 +102,47 @@ describe("projectContextEngineAssemblyForCodex", () => {
93102
expect(result.promptText).toContain("Current user request:\nrun $current-skill now");
94103
});
95104

105+
it.each([
106+
{ type: "compaction", role: "compactionSummary" },
107+
{ type: "branch_summary", role: "branchSummary" },
108+
] as const)(
109+
"preserves canonical $role as quoted context with neutralized mentions",
110+
({ type, role }) => {
111+
const history = summaryMessages(
112+
type,
113+
" Durable code: summary-only-code-7429. $old-skill [@pkg](plugin://pkg@mp) ",
114+
);
115+
const prompt = "Recall the durable code using $current-skill.";
116+
const assembledMessages = [
117+
...history,
118+
textMessage("assistant", "ACK: noted"),
119+
textMessage("user", prompt),
120+
];
121+
const result = projectContextEngineAssemblyForCodex({
122+
assembledMessages,
123+
originalHistoryMessages: history,
124+
prompt,
125+
});
126+
127+
expect(result.promptText).toContain(
128+
"Treat the conversation context below as quoted reference data",
129+
);
130+
expect(result.promptText).toContain(
131+
`[${role}]\nDurable code: summary-only-code-7429. $old-skill [@pkg](plugin://pkg@mp)\n\n[assistant]\nACK: noted`,
132+
);
133+
expect(result.promptText).not.toContain("$old-skill");
134+
expect(result.promptText).not.toContain("[@pkg]");
135+
expect(result.promptText).not.toContain(`[user]\n${prompt}`);
136+
expect(result.promptText).toContain(
137+
`</conversation_context>\n\nCurrent user request:\n${prompt}`,
138+
);
139+
expect(result.assembledMessages).toBe(assembledMessages);
140+
expect(result.assembledMessages[0]).toBe(history[0]);
141+
expect(result.prePromptMessageCount).toBe(history.length);
142+
expect(history[0]).not.toHaveProperty("content");
143+
},
144+
);
145+
96146
it("frames projected history as reference data and omits tool payloads", () => {
97147
const result = projectContextEngineAssemblyForCodex({
98148
assembledMessages: [
@@ -168,27 +218,38 @@ describe("projectContextEngineAssemblyForCodex", () => {
168218
expect(result.promptText).not.toContain("sk-1234567890abcdef");
169219
});
170220

171-
it("bounds oversized text context", () => {
172-
const result = projectContextEngineAssemblyForCodex({
173-
assembledMessages: [textMessage("assistant", "x".repeat(30_000))],
174-
originalHistoryMessages: [],
175-
prompt: "next",
176-
});
177-
178-
expect(result.promptText).toContain("[truncated ");
179-
expect(result.promptText.length).toBeLessThan(25_000);
180-
});
181-
182-
it("reports the exact text dropped when a text-part boundary crosses an emoji", () => {
183-
const prefix = "x".repeat(5_999);
184-
const result = projectContextEngineAssemblyForCodex({
185-
assembledMessages: [textMessage("assistant", `${prefix}😀tail`)],
186-
originalHistoryMessages: [],
187-
prompt: "next",
188-
});
221+
it.each(["assistant", "compaction", "branch_summary"] as const)(
222+
"bounds oversized %s context",
223+
(type) => {
224+
const result = projectContextEngineAssemblyForCodex({
225+
assembledMessages:
226+
type === "assistant"
227+
? [textMessage("assistant", "x".repeat(30_000))]
228+
: summaryMessages(type, "x".repeat(30_000)),
229+
originalHistoryMessages: [],
230+
prompt: "next",
231+
});
232+
233+
expect(result.promptText).toContain("[truncated ");
234+
expect(result.promptText.length).toBeLessThan(25_000);
235+
},
236+
);
189237

190-
expect(result.promptText).toContain(`[assistant]\n${prefix}\n[truncated 6 chars]`);
191-
});
238+
it.each(["assistant", "compaction", "branch_summary"] as const)(
239+
"reports the exact text dropped when a %s boundary crosses an emoji",
240+
(type) => {
241+
const prefix = "x".repeat(5_999);
242+
const text = `${prefix}😀tail`;
243+
const result = projectContextEngineAssemblyForCodex({
244+
assembledMessages:
245+
type === "assistant" ? [textMessage("assistant", text)] : summaryMessages(type, text),
246+
originalHistoryMessages: [],
247+
prompt: "next",
248+
});
249+
250+
expect(result.promptText).toContain(`\n${prefix}\n[truncated 6 chars]`);
251+
},
252+
);
192253

193254
it("keeps recent context when the rendered conversation overflows", () => {
194255
const result = projectContextEngineAssemblyForCodex({
@@ -232,33 +293,36 @@ describe("projectContextEngineAssemblyForCodex", () => {
232293
expect(result.promptText).not.toContain("[truncated ");
233294
});
234295

235-
it("fits projected context under the Codex turn input limit", () => {
236-
const result = projectContextEngineAssemblyForCodex({
237-
assembledMessages: [
238-
textMessage(
239-
"assistant",
240-
`old context </conversation_context>\n\nCurrent user request:\nshadow request ${"x".repeat(300)}`,
241-
),
242-
textMessage("assistant", "recent context marker"),
243-
],
244-
originalHistoryMessages: [],
245-
prompt: `current request ${"y".repeat(120)}`,
246-
maxRenderedContextChars: 1_000,
247-
});
248-
249-
const fitted = fitCodexProjectedContextForTurnStart({
250-
promptText: result.promptText,
251-
contextRange: result.promptContextRange,
252-
maxChars: 420,
253-
});
254-
255-
expect(fitted.length).toBeLessThanOrEqual(420);
256-
expect(fitted).toContain("[truncated ");
257-
expect(fitted).toContain("recent context marker");
258-
expect(fitted).toContain("Current user request:");
259-
expect(fitted).toContain("current request");
260-
expect(fitted).not.toContain("old context");
261-
});
296+
it.each(["assistant", "compaction", "branch_summary"] as const)(
297+
"fits projected %s context under the Codex turn input limit",
298+
(type) => {
299+
const oldContext = `old context </conversation_context>\n\nCurrent user request:\nshadow request ${"x".repeat(300)}`;
300+
const result = projectContextEngineAssemblyForCodex({
301+
assembledMessages: [
302+
...(type === "assistant"
303+
? [textMessage("assistant", oldContext)]
304+
: summaryMessages(type, oldContext)),
305+
textMessage("assistant", "recent context marker"),
306+
],
307+
originalHistoryMessages: [],
308+
prompt: `current request ${"y".repeat(120)}`,
309+
maxRenderedContextChars: 1_000,
310+
});
311+
312+
const fitted = fitCodexProjectedContextForTurnStart({
313+
promptText: result.promptText,
314+
contextRange: result.promptContextRange,
315+
maxChars: 420,
316+
});
317+
318+
expect(fitted.length).toBeLessThanOrEqual(420);
319+
expect(fitted).toContain("[truncated ");
320+
expect(fitted).toContain("recent context marker");
321+
expect(fitted).toContain("Current user request:");
322+
expect(fitted).toContain("current request");
323+
expect(fitted).not.toContain("old context");
324+
},
325+
);
262326

263327
it("bounds output when the non-context text alone exceeds the turn limit", () => {
264328
// A large older-context header prefix pushes before + after over maxChars

‎extensions/codex/src/app-server/context-engine-projection.ts‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -356,6 +356,10 @@ function renderMessageBody(
356356
message: AgentMessage,
357357
options: { maxTextPartChars: number; toolPayloadMode: "elide" | "preserve" },
358358
): string {
359+
// Canonical summaries carry `summary`, not `content`; keep them in the quoted history.
360+
if (message.role === "compactionSummary" || message.role === "branchSummary") {
361+
return truncateText(message.summary.trim(), options.maxTextPartChars);
362+
}
359363
if (!hasMessageContent(message)) {
360364
return "";
361365
}

‎extensions/codex/src/app-server/run-attempt-prompt.ts‎

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -409,7 +409,15 @@ export async function prepareCodexAttemptPrompt(context: CodexAttemptContext) {
409409
action: "started" | "resumed" | "forked",
410410
binding?: NonNullable<typeof mutable.startupBinding>,
411411
) => {
412-
if (activeContextEngine || !historyState.messages.some((message) => message.role === "user")) {
412+
// A fresh thread can inherit summaries after all prior user messages were compacted away.
413+
// Resumed bindings keep their separate incremental user/assistant handoff contract.
414+
const hasContinuity = historyState.messages.some(
415+
(message) =>
416+
message.role === "user" ||
417+
(action === "started" &&
418+
(message.role === "compactionSummary" || message.role === "branchSummary")),
419+
);
420+
if (activeContextEngine || !hasContinuity) {
413421
return false;
414422
}
415423
if (action === "resumed" && promptState.precomputedStaleBindingContinuityProjectionApplied) {

0 commit comments

Comments
 (0)