Skip to content

Commit 295d9ab

Browse files
kevin-dpclaude
andcommitted
docs(agents): trim more excessive compaction comments
Tighten the over-long comments in the compaction indicator helper + component and the reconstruction watermark block, dropping a redundant inline restatement. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent 3d6fd61 commit 295d9ab

3 files changed

Lines changed: 13 additions & 32 deletions

File tree

packages/agents-runtime/src/timeline-context.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -497,10 +497,8 @@ export function timelineMessages(
497497
if (item.at < since) {
498498
continue
499499
}
500-
// The watermark is the order of the last summarized item (the snapshot
501-
// head), so everything at or below it is folded into the summary.
502500
if (item.at <= compactionWatermark) {
503-
continue
501+
continue // folded into the summary
504502
}
505503
// Place the summary at the watermark boundary, before the first kept item.
506504
emitSummary()

packages/agents-server-ui/src/components/CompactionIndicator.tsx

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -8,19 +8,11 @@ import {
88
import styles from './CompactionIndicator.module.css'
99

1010
/**
11-
* Live indicator shown while a context compaction is in flight.
12-
*
13-
* The runtime writes a compaction checkpoint row with `attrs.status: "running"`
14-
* before summarizing and supersedes it with a `complete` (or `failed`) row when
15-
* done. We read the latest such row reactively; while it's `running` we show
16-
* "Compacting context…" so the user understands the pause. It clears the moment
17-
* compaction completes.
18-
*
19-
* A summarize is bounded by a hard timeout (~120s) after which a terminal row is
20-
* always written, so a `running` row that lingers well past that is orphaned —
21-
* its process crashed before writing the terminal row. We stop showing the
22-
* spinner for such a row (and self-clear via a timer so it disappears even with
23-
* no further events). See `lib/compactionIndicator` for the staleness rule.
11+
* Spinner shown while a context compaction is in flight. The runtime writes a
12+
* `running` compaction checkpoint before summarizing and supersedes it with
13+
* `complete`/`failed` when done; we show the spinner while the latest is
14+
* `running`. Orphaned (crashed) running rows are cleared after a timeout — see
15+
* `lib/compactionIndicator`.
2416
*/
2517

2618
interface CheckpointRow {

packages/agents-server-ui/src/lib/compactionIndicator.ts

Lines changed: 7 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,14 @@
1-
/**
2-
* Staleness logic for the "Compacting…" indicator, extracted so it can be unit
3-
* tested without a DOM/render harness (this package has no React-render test
4-
* setup).
5-
*/
1+
// Staleness logic for the "Compacting…" indicator, split out so it's unit
2+
// testable without a render harness.
63

7-
/**
8-
* Beyond this age a still-`running` compaction checkpoint is treated as orphaned
9-
* (its process crashed before writing a terminal `complete`/`failed` row). A
10-
* summarize is bounded by a ~120s hard timeout after which a terminal row is
11-
* always written, so 150s comfortably clears only genuinely-crashed runs.
12-
*/
4+
/** A `running` checkpoint older than this is orphaned (its process crashed
5+
* before a terminal row); comfortably above the summarize timeout. */
136
export const STALE_RUNNING_MS = 150_000
147

158
/**
16-
* Whether a `running` checkpoint with the given `timestamp` (ISO string) should
17-
* be treated as orphaned at `now` (ms). A missing or unparseable timestamp is
18-
* treated as NOT orphaned — we can't prove staleness, and hiding a genuinely
19-
* in-flight compaction is worse than briefly over-showing one. (insertContext
20-
* always stamps a timestamp, so this only guards against a schema regression.)
9+
* Whether a `running` checkpoint with `timestamp` (ISO) is orphaned at `now`
10+
* (ms). A missing/unparseable timestamp counts as live — we can't prove
11+
* staleness, and hiding an in-flight compaction is worse than over-showing one.
2112
*/
2213
export function isRunningCheckpointOrphaned(
2314
timestamp: string | undefined,

0 commit comments

Comments
 (0)