Spec 3.9.0, interactive.md §1 and §3: when a subagent's model is interactive-only, the summary of its conversation is asked of that model's twin, else of a default that is not interactive-only, else it is skipped — said once, to the session the subagent works for — and the subagent goes on. Before, only the session's own compaction went elsewhere. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This commit is contained in:
4 files changed
+41
-3
No files matched your search
+2
-1
@@ -33,7 +33,8 @@ Harness spec 3.9.0: the model last used in a directory, the two types of schedul
|
|||||||
and its **compaction** (asked for or automatic) are asked of the same model under another
|
and its **compaction** (asked for or automatic) are asked of the same model under another
|
||||||
provider when the server lists one, else of your global `model` or the server's default when
|
provider when the server lists one, else of your global `model` or the server's default when
|
||||||
that is not interactive-only; with none, the title stays the one made from your first prompt,
|
that is not interactive-only; with none, the title stays the one made from your first prompt,
|
||||||
automatic compaction is skipped and said once, and `/compact` is refused with the reason.
|
automatic compaction is skipped and said once, and `/compact` is refused with the reason. A
|
||||||
|
subagent's own automatic compaction goes the same way.
|
||||||
**Scheduled work never runs on one**: a scheduled session opened on such a model, or a
|
**Scheduled work never runs on one**: a scheduled session opened on such a model, or a
|
||||||
scheduled turn of a session that has come to be on one, is refused before anything is sent
|
scheduled turn of a session that has come to be on one, is refused before anything is sent
|
||||||
(`data.reason: "interactive_only"`), a scheduled run's subagent on one is not started, and a
|
(`data.reason: "interactive_only"`), a scheduled run's subagent on one is not started, and a
|
||||||
|
|||||||
@@ -28,7 +28,9 @@ once (the CLI's commit-message draft).
|
|||||||
is a terminal (a cron job, a pipeline), which is the batch script the terms name.
|
is a terminal (a cron job, a pipeline), which is the batch script the terms name.
|
||||||
- **Background calls**: what a client asks a model on a session's behalf that is not the answer
|
- **Background calls**: what a client asks a model on a session's behalf that is not the answer
|
||||||
to the person's turn — **naming the session** (its title) and **compacting it** (the summary,
|
to the person's turn — **naming the session** (its title) and **compacting it** (the summary,
|
||||||
asked for by the person or by the harness when the window fills).
|
asked for by the person or by the harness when the window fills). A **subagent's own
|
||||||
|
automatic compaction** is one too: the subagent is the person's, the summary of its
|
||||||
|
conversation is not their turn.
|
||||||
|
|
||||||
## 2. Scheduled work never runs on one
|
## 2. Scheduled work never runs on one
|
||||||
|
|
||||||
@@ -74,7 +76,9 @@ A call that goes elsewhere is otherwise the same call: the summary is asked for
|
|||||||
conversation and comes back into the same session, whose model does not change. A model that is
|
conversation and comes back into the same session, whose model does not change. A model that is
|
||||||
not interactive-only is asked itself, as before 3.9.0. The model a title is asked of is the
|
not interactive-only is asked itself, as before 3.9.0. The model a title is asked of is the
|
||||||
client's small model where it has one (the CLI's `small_model`), else the session's; the rule is
|
client's small model where it has one (the CLI's `small_model`), else the session's; the rule is
|
||||||
applied to whichever it is.
|
applied to whichever it is. For a subagent's automatic compaction it is the subagent's model
|
||||||
|
that is looked at — its twin, the same defaults, or skipped and said once to the session it
|
||||||
|
works for.
|
||||||
|
|
||||||
## 4. What is outside this
|
## 4. What is outside this
|
||||||
|
|
||||||
|
|||||||
+11
@@ -595,6 +595,7 @@ export function createApp(o: AppOptions): App {
|
|||||||
return o.asker.plan
|
return o.asker.plan
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
let compactionSkipSaid = false
|
||||||
const child = new Engine({
|
const child = new Engine({
|
||||||
bus: childBus,
|
bus: childBus,
|
||||||
asker: askerFor(),
|
asker: askerFor(),
|
||||||
@@ -609,6 +610,16 @@ export function createApp(o: AppOptions): App {
|
|||||||
effort: m.ref === engine.model.ref ? engine.effort : startEffort(m),
|
effort: m.ref === engine.model.ref ? engine.effort : startEffort(m),
|
||||||
maxSteps: loaded.config.limits?.subagent_steps ?? LOOP.jobs.subagent_steps.default,
|
maxSteps: loaded.config.limits?.subagent_steps ?? LOOP.jobs.subagent_steps.default,
|
||||||
compaction,
|
compaction,
|
||||||
|
// A subagent's own automatic compaction is background work like the session's
|
||||||
|
// (interactive.md §3): its twin, a default, or skipped — said once, to the session.
|
||||||
|
background: (call) => {
|
||||||
|
const where = backgroundFor(child.model, call)
|
||||||
|
if (where && !("client" in where) && !compactionSkipSaid) {
|
||||||
|
compactionSkipSaid = true
|
||||||
|
bus.emit({ type: "notice", message: `the subagent ${spec.name} is not compacting its conversation: its model is for interactive use only and there is no other model to ask for the summary` })
|
||||||
|
}
|
||||||
|
return where
|
||||||
|
},
|
||||||
perm: childPerm,
|
perm: childPerm,
|
||||||
toolCtx: {
|
toolCtx: {
|
||||||
...baseToolCtx(),
|
...baseToolCtx(),
|
||||||
|
|||||||
@@ -132,6 +132,28 @@ test("automatic compaction with a twin is the twin's work", async () => {
|
|||||||
expect(a.engine.model.ref).toBe("plan/coder")
|
expect(a.engine.model.ref).toBe("plan/coder")
|
||||||
})
|
})
|
||||||
|
|
||||||
|
test("a subagent's own automatic compaction goes the same way: the twin's work; with nowhere to go, skipped and said once to the session", async () => {
|
||||||
|
const task = { chunks: [toolCall(0, "t1", "task", JSON.stringify({ agent: "general", description: "look", prompt: "look around" }))] }
|
||||||
|
const step = { chunks: [toolCall(0, "g1", "glob", JSON.stringify({ pattern: "*" }))] }
|
||||||
|
fake = fakeProvider([task, step, reply("The subagent's summary."), reply("Found nothing."), reply("The session's summary."), reply("Done.")])
|
||||||
|
config(fake.url, { window: 2000 })
|
||||||
|
const a = app(project(), { modelTitles: false, mode: "auto" })
|
||||||
|
await a.turns.prompt("have a subagent look")
|
||||||
|
// The session's step, the subagent's first, its summary on the twin, its second, then the
|
||||||
|
// session's own summary on the twin and its reply.
|
||||||
|
expect(asked()).toEqual(["plan/coder", "plan/coder", "payg/coder", "plan/coder", "payg/coder", "plan/coder"])
|
||||||
|
fake.stop()
|
||||||
|
|
||||||
|
fake = fakeProvider([task, step, reply("Found nothing."), reply("Done.")])
|
||||||
|
config(fake.url, { twin: false, other: false, window: 2000 })
|
||||||
|
const b = app(project(), { modelTitles: false, mode: "auto" })
|
||||||
|
const notices: string[] = []
|
||||||
|
b.bus.on((e) => e.type === "notice" && notices.push(e.message))
|
||||||
|
await b.turns.prompt("have a subagent look")
|
||||||
|
expect(asked()).toEqual(["plan/coder", "plan/coder", "plan/coder", "plan/coder"])
|
||||||
|
expect(notices.filter((n) => n.includes("the subagent general is not compacting"))).toHaveLength(1)
|
||||||
|
})
|
||||||
|
|
||||||
// ── scheduled work ──────────────────────────────────────────────────────────────────────────
|
// ── scheduled work ──────────────────────────────────────────────────────────────────────────
|
||||||
|
|
||||||
test("scheduled work never starts on one: asked for, it is refused; remembered for the directory, it is skipped", () => {
|
test("scheduled work never starts on one: asked for, it is refused; remembered for the directory, it is skipped", () => {
|
||||||
|
|||||||
Reference in new issue
Block a user