Skip to content

Commit 9c0a153

Browse files
macOS26claude
andcommitted
Single truncation point: only ActivityLogView yellow banner
Removed text-based 'Log truncated' banners from ScriptTab and ViewModel. Only ActivityLogView's yellow '··· earlier output trimmed ···' remains. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 33e01e8 commit 9c0a153

2 files changed

Lines changed: 7 additions & 14 deletions

File tree

AgentXcode/Agent/AgentScriptTabs/ScriptTab.swift

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -113,15 +113,15 @@ final class ScriptTab: Identifiable {
113113
init(record: ScriptTabRecord) {
114114
self.id = record.tabId
115115
self.scriptName = record.scriptName
116-
// Truncate restored log to last 15K chars so app restart stays snappy
116+
// Cap restored log at 50K chars (matches ActivityLogView render cap)
117117
let restored = record.activityLog
118-
if restored.count > 15_000 {
119-
let drop = restored.count - 15_000
118+
if restored.count > 50_000 {
119+
let drop = restored.count - 50_000
120120
var trimmed = String(restored.dropFirst(drop))
121121
if let nl = trimmed.firstIndex(of: "\n") {
122122
trimmed = String(trimmed[trimmed.index(after: nl)...])
123123
}
124-
self.activityLog = "--- Log truncated (showing last 15K characters) ---\n" + trimmed
124+
self.activityLog = trimmed
125125
} else {
126126
self.activityLog = restored
127127
}
@@ -197,14 +197,7 @@ final class ScriptTab: Identifiable {
197197
if !logBuffer.isEmpty {
198198
activityLog += logBuffer
199199
logBuffer = ""
200-
// Trim from front if too large
201-
if activityLog.count > Self.maxLogChars {
202-
let drop = activityLog.count - Self.maxLogChars
203-
activityLog = String(activityLog.dropFirst(drop))
204-
if let nl = activityLog.firstIndex(of: "\n") {
205-
activityLog = "--- Log truncated (showing last \(Self.maxLogChars / 1000)K characters) ---\n" + String(activityLog[activityLog.index(after: nl)...])
206-
}
207-
}
200+
// Trimming handled by ActivityLogView at render time (50K cap with yellow banner)
208201
NotificationCenter.default.post(name: .activityLogDidChange, object: id)
209202
}
210203
}

AgentXcode/Agent/AgentViewModel/AgentViewModel+Logging.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -480,13 +480,13 @@ extension AgentViewModel {
480480
activityLog += combined
481481
NotificationCenter.default.post(name: .activityLogDidChange, object: nil)
482482
}
483-
// Trim from front if too large — keeps main thread fast
483+
// Trim from front if too large — ActivityLogView shows yellow banner
484484
let maxChars = 50_000
485485
if activityLog.count > maxChars {
486486
let drop = activityLog.count - maxChars
487487
activityLog = String(activityLog.dropFirst(drop))
488488
if let nl = activityLog.firstIndex(of: "\n") {
489-
activityLog = "··· earlier output trimmed ···\n" + String(activityLog[activityLog.index(after: nl)...])
489+
activityLog = String(activityLog[activityLog.index(after: nl)...])
490490
}
491491
}
492492
}

0 commit comments

Comments
 (0)