Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
Show all changes
82 commits
Select commit Hold shift + click to select a range
8c42d32
feat(engine): record where a turn's history starts and open the windo…
claude Oct 28, 2026
822db69
feat(core): historySummary capability and fold, and a capability hist…
claude Oct 28, 2026
f8afedb
feat(workforce,client): beforeAnswer step and historyStart on the cli…
claude Oct 28, 2026
966b1d9
FIX-2154: wire the Teammates lab to the real packages
claude Oct 28, 2026
830c32d
FIX-2154: record the goal's verdicts and controls, file the gaps
claude Oct 28, 2026
944bbca
FIX-2154: say user, not person, in the lab's comments
claude Oct 28, 2026
2fd0c09
FIX-2154: name the Teammates lab's server config as a fallow entry
claude Oct 28, 2026
95fe4cf
FIX-2154: keep host.mts's own constants unexported
claude Oct 28, 2026
4d397d8
FIX-2154: answer review on the adapter and the goal
claude Oct 28, 2026
0660cd6
FIX-2154: read the feed's snapshot again when the history moves while…
claude Oct 28, 2026
fa17caf
test(goals): history window goal check, and the changeset (FIX-1613)
claude Oct 28, 2026
ed88b9f
FIX-2154: hand the lab's Codex runs only the environment Codex needs
claude Oct 28, 2026
e8207d9
FIX-2154: follow a task's run by the session its card already names
claude Oct 28, 2026
e7ea812
FIX-2154: name the issue in the Codex pass-list changeset
claude Oct 28, 2026
76912b7
docs: summarizing turns past the history window (FIX-1613)
claude Oct 28, 2026
2b7d23d
fix(core): a failed fold records the oldest unfolded turn, so lost tu…
claude Oct 28, 2026
b4a59d6
Merge remote-tracking branch 'origin/fix/fix-1613' into claude/projec…
claude Oct 28, 2026
82caf8a
fix(engine): history after a mark that has not settled starts after i…
claude Oct 28, 2026
9812eaa
fix(core): a fold is stale when any other fold committed, not only on…
claude Oct 28, 2026
aace8e4
FIX-2154: the Teammates lab keeps what left its history window, and d…
claude Oct 28, 2026
6693940
fix(core): a fold keeps the summarizer's key points with its summary …
claude Oct 28, 2026
bb004bc
Merge remote-tracking branch 'origin/fix/fix-1613' into claude/projec…
claude Oct 28, 2026
ae48471
fix(core): FIX-1613 keep a turn sharing the mark's start time once th…
claude Oct 28, 2026
04cd8b9
fix(engine): FIX-1613 trim the window's extra row before reordering it
claude Oct 28, 2026
7c98af9
fix(engine): FIX-1613 order same-millisecond turns by id everywhere
claude Oct 28, 2026
4e01de4
FIX-2289: render worker text as Markdown in the Teammates lab
claude Oct 28, 2026
068ae50
FIX-2154: step 4 waits for each answer, and the summary keeps earlier…
claude Oct 28, 2026
920da34
FIX-2289: keep MessageResponse internal to the lab's Markdown component
claude Oct 28, 2026
0fa923c
fix(engine,core): FIX-1613 a summary mark newer than the loaded window
claude Oct 28, 2026
cac199d
fix(core): FIX-1613 waiting turns no longer take the fold's places
claude Oct 28, 2026
5c49f84
Merge remote-tracking branch 'origin/claude/project-thread-e54cfm' in…
claude Oct 28, 2026
e40aca5
FIX-2154: step 3 may redden under the step-4 controls, with the reason
claude Oct 28, 2026
a2caae9
FIX-2154: the lab's inventory table, current
claude Oct 28, 2026
649e971
FIX-2289: read the lab's entries as shown in the goal check
claude Oct 28, 2026
fd11163
Merge remote-tracking branch 'origin/claude/project-thread-e54cfm' in…
claude Oct 28, 2026
b854692
FIX-2154: step 4's verdict log
claude Oct 28, 2026
8d89ce6
Merge remote-tracking branch 'origin/fix/fix-1613' into claude/projec…
claude Oct 28, 2026
7102c9e
FIX-2289: show a worker's answer as it is written
claude Oct 28, 2026
c2b6995
Merge remote-tracking branch 'origin/main' into claude/project-thread…
claude Oct 28, 2026
0e07742
fix(engine): FIX-1613 a retried turn keeps its place in turns()
claude Oct 28, 2026
cb5024e
Merge remote-tracking branch 'origin/main' into fix/fix-1613
claude Oct 28, 2026
c295253
Merge main into FIX-2154 lab branch
claude Oct 28, 2026
7366a3c
Merge remote-tracking branch 'origin/claude/project-thread-e54cfm' in…
claude Oct 28, 2026
2fbbedc
FIX-2154: the lab's inventory table, current
claude Oct 28, 2026
14fa6b0
Merge remote-tracking branch 'origin/fix/fix-1613' into claude/projec…
claude Oct 28, 2026
6318c46
fix(core): FIX-1613 a resumed pending turn stays pending; lost check …
claude Oct 28, 2026
7bd40d0
Teammates lab: an unlinked task answer is not drawn as failed; lead n…
claude Oct 28, 2026
5ca7328
fix(engine): FIX-1613 a retried turn read by id has nothing to read
claude Oct 28, 2026
f00be8d
Merge remote-tracking branch 'origin/fix/fix-1613' into claude/projec…
claude Oct 28, 2026
00e8f07
FIX-2154: step 4 reads lead's answer once it is fully drawn
claude Oct 28, 2026
b82f66d
Teammates lab: researcher answers only through sendMessage; goal wait…
claude Oct 28, 2026
0ca38f2
fix(engine): FIX-1613 read turns by id fresh, and ended turns as empty
claude Oct 28, 2026
2c3596a
FIX-2154: record step 4's pass at 00e8f07
claude Oct 28, 2026
1f46ec3
Merge #4079 at b82f66de into claude/project-thread-6ydn0c
claude Oct 28, 2026
73315bd
Merge remote-tracking branch 'origin/fix/fix-1613' into claude/projec…
claude Oct 28, 2026
6cff931
FIX-2154: the lab's inventory table, current
claude Oct 28, 2026
a8a7e5f
FIX-1613: read a shared dependency's history once through dynamic uses
claude Oct 28, 2026
406590f
FIX-1613: say turns were lost when settled turns leave behind an olde…
claude Oct 28, 2026
d2034b1
FIX-1613: list a continuable interrupted turn as open
claude Oct 28, 2026
9074de4
Merge remote-tracking branch 'origin/fix/fix-1613' into claude/projec…
claude Oct 28, 2026
872a7c1
Merge remote-tracking branch 'origin/main' into fix/fix-1613
claude Oct 28, 2026
bf6daac
test(orchestration): a steer turn's stop reason says user, as FIX-215…
claude Oct 28, 2026
4af4dd3
Merge remote-tracking branch 'origin/fix/fix-1613' into claude/projec…
claude Oct 28, 2026
8fbfca6
Store a received worker message as a user line in the recipient's his…
jhoffner Oct 28, 2026
8daa709
FIX-1613: resolve a history mark that names the resuming request
claude Oct 28, 2026
1fde086
FIX-1613: a fold keeps the request running it pending when it moves p…
claude Oct 28, 2026
39a8c5c
Merge remote-tracking branch 'origin/fix/fix-1613' into claude/projec…
claude Oct 28, 2026
224f1ae
Merge main (with #4079) into claude/project-thread-6ydn0c
claude Oct 28, 2026
dd547f7
FIX-1613: list a turn that settled after the window loaded as open
claude Oct 28, 2026
bee72e8
Merge remote-tracking branch 'origin/fix/fix-1613' into claude/projec…
claude Oct 28, 2026
b734df3
FIX-1613: drop a pending turn that retention deleted before it settled
claude Oct 28, 2026
1840bd2
FIX-2154: place the divider by the order turns started
claude Oct 28, 2026
f04b409
Merge remote-tracking branch 'origin/fix/fix-1613' into claude/projec…
claude Oct 28, 2026
c9d25cc
Merge remote-tracking branch 'origin/main' into claude/project-thread…
claude Oct 28, 2026
129959f
FIX-2154: regenerate the Teammates lab inventory after merging main
claude Oct 28, 2026
741c030
FIX-2154: keep the summary's mark when it has a hole; the hole only d…
claude Oct 28, 2026
1202202
Merge remote-tracking branch 'origin/main' into claude/project-thread…
claude Oct 28, 2026
0ff68c4
Merge remote-tracking branch 'origin/main' into claude/project-thread…
claude Oct 29, 2026
5d93f27
FIX-2154: regenerate the Teammates lab inventory after merging main
claude Oct 29, 2026
0066eb7
Merge remote-tracking branch 'origin/main' into claude/project-thread…
claude Oct 29, 2026
5e1a3f9
FIX-2154: regenerate the Teammates lab inventory after merging main
claude Oct 29, 2026
792d751
FIX-2154: goal verdicts on the merged real-tools lab
claude Oct 29, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 26 additions & 4 deletions packages/engine/src/context/createExecutionContext.ts
Original file line number Diff line number Diff line change
Expand Up @@ -775,6 +775,9 @@ export async function createExecutionContext<

// Parallelize the remaining independent store lookups — user, org, and the
// history window don't depend on each other for the initial load.
// When the window was read: a turn that settles after it is in neither the
// window nor the open turns `turns()` lists later (FIX-1613).
const windowLoadedAtMs = Date.now();
const [loadedUser, loadedOrg, listedPriorRequests] = await Promise.all([
userKey !== undefined ? stores.user.get(userKey) : undefined,
optionsOrgKey !== undefined ? stores.org.get(optionsOrgKey) : undefined,
Expand Down Expand Up @@ -858,6 +861,20 @@ export async function createExecutionContext<
// can re-enter the rest under the same id and add their final output.
const isRetried = (record: RequestRecord): boolean => record.status === "interrupted" && retried.has(record.id);
const emptyTurn = (record: RequestRecord): HistoryTurn => ({ ...historyTurn(record, true), messages: [] });
// Past turns updated since the window loaded, newest update first, paged
// until the first older one: bounded by what settled during this request.
const settledSinceWindowLoad = async (): Promise<RequestRecord[]> => {
const page = 50;
const settled: RequestRecord[] = [];
for (let offset = 0; ; offset += page) {
const records = await stores.request.list({ ...turnScope, status: PAST_TURN_STATUSES, orderBy: "updatedAt", limit: page, offset });
for (const record of records) {
if (record.updatedAt < windowLoadedAtMs) return settled;
settled.push(record);
}
if (records.length < page) return settled;
}
};
const readTurns = async (query?: HistoryTurnQuery): Promise<HistoryTurn[]> => {
if (query?.requestIds !== undefined) {
const turns: HistoryTurn[] = [];
Expand All @@ -881,13 +898,18 @@ export async function createExecutionContext<
.filter((r) => r.id !== requestId)
.map((r) => (isRetried(r) ? emptyTurn(r) : historyTurn(r, r.status !== "interrupted")));
const listed = new Set(windowTurns.map((t) => t.requestId));
const openTurns = (
await stores.request.list({ ...turnScope, status: ["in_progress", "suspended"], orderBy: "startedAtMs" })
)
const openTurns = [
...(await stores.request.list({ ...turnScope, status: ["in_progress", "suspended"], orderBy: "startedAtMs" })),
...(await settledSinceWindowLoad())
]
// The running request too: a fold must see where it stands among the
// conversation's other open turns, or it could move its mark past it.
// One that settled after the window loaded is listed open as well, so a
// fold keeps it pending and reads it by id rather than passing it unseen.
.filter((r) => !listed.has(r.id))
.map((r) => historyTurn(r, false));
.map((r) => historyTurn(r, false))
// One that settled between the two reads is in both: list it once.
.filter((turn, at, turns) => turns.findIndex((t) => t.requestId === turn.requestId) === at);
return [...windowTurns, ...openTurns].sort((a, b) => compareTurnsOldestFirst(a.startedAtMs, a.requestId, b.startedAtMs, b.requestId));
};

Expand Down
39 changes: 39 additions & 0 deletions packages/engine/test/history-summary.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -383,6 +383,45 @@ describe("historySummary on the engine", () => {
expect(folded.pending).not.toContain("req_001");
});

it("keeps a request that settled after this turn loaded its window pending when the fold moves past it", async () => {
const stores = createInMemoryStores();
const calls: ModelCall[] = [];
const template = { flowKind: "summary-chat", flowId: "summary-chat", orgId: DEFAULT_ORG_ID, actionName: "run", source: "http", userId: "u", sessionId: "s", status: "in_progress", version: 1, state: {}, items: [] };
const later = Date.now() + 60_000;
for (let n = 1; n <= 5; n++) {
const id = `req_run_${n}`;
await stores.request.set(id, { ...template, id, startedAtMs: later + n, createdAt: later + n, updatedAt: later + n } as never, "any");
}
const earlier = utility.historySummary({ summarize: foldingSummarize() });
// The oldest running request finishes after this turn loaded its window and
// before its fold reads the turns: neither read sees it as it is.
const settles = handler({
name: "settles",
execute: async () => {
const record = (await stores.request.get("req_run_1"))!;
await stores.request.set("req_run_1", { ...record, status: "completed", completedAtMs: Date.now(), updatedAt: Date.now() }, "any");
}
});
const answer = generator({ name: "answer", model: "mock", prompt: "You answer.", history: true, uses: [earlier.capability] });
const flow = defineFlow({
kind: "summary-chat",
session: { historyWindow: { turns: 4 } },
actions: {
run: {
inputSchema: z.string(),
block: sequencer({ name: "chat", inputSchema: z.string() }).tap(settles).tap(earlier.fold).step(answer),
userMessage: (input: string) => input
}
}
})();

await talk(stores, flow, calls, 1);

const state = (await stores.resourceState.get("session", "s", "historySummary"))?.state as { throughRequestId: string; pending: string[] };
expect(state.throughRequestId).toBe("req_run_5");
expect(state.pending).toContain("req_run_1");
});

it("keeps this turn pending when it is itself a pending turn the fold cannot read yet", async () => {
const stores = createInMemoryStores();
const calls: ModelCall[] = [];
Expand Down
Loading