Skip to content

A team of long-lived bots for DeepSeek Harness, with main bots, bot-to-bot messages and group chats.

Look for a secret in the whole set-aside change before clipping it for the log

Fei2411a710a7d41552
diff --git a/ds-bot/src/host/memory.js b/ds-bot/src/host/memory.js
index 1617b4fc..2abb3465 100644
--- a/ds-bot/src/host/memory.js
+++ b/ds-bot/src/host/memory.js
@@ -1688,8 +1688,8 @@ export function install(rt) {
} else {
const { changes, leftOut } = parsed
for (const change of leftOut) {
- const shown = clip(JSON.stringify(change), 160)
- rt.warn('ds-bot: memory review of %s left out a change: %s', name, secretEntry(shown) ? 'it looks like a key, token, password, or ID number, which memory never keeps' : `it is not a well-formed change: ${shown}`)
+ const whole = JSON.stringify(change)
+ rt.warn('ds-bot: memory review of %s left out a change: %s', name, secretEntry(whole) ? 'it looks like a key, token, password, or ID number, which memory never keeps' : `it is not a well-formed change: ${clip(whole, 160)}`)
}
// The limit is what one answer may hold, not a cut of the one the model
// gave: every change in it is kept or set aside, none is dropped.
diff --git a/ds-bot/test/memory.test.js b/ds-bot/test/memory.test.js
index f0058150..8eed91eb 100644
--- a/ds-bot/test/memory.test.js
+++ b/ds-bot/test/memory.test.js
@@ -775,6 +775,19 @@ test('a review keeps what it can, sets aside what memory cannot keep, and says e
assert.equal(requests.length, 1)
})
+test('a malformed change whose secret sits before the words that give it away is not written to the log', async (t) => {
+ const text = 'This is a note about the staging system. '.repeat(3) + 'I use hunter2 as my password'
+ const replies = [JSON.stringify({ changes: [{ op: 'edit', text }] })]
+ const { ctx, call, requests, warnings, stop } = start({ replies, config: { memoryReviewDelayMs: 0 } })
+ t.after(() => stop())
+ await call('state', {})
+ ctx.emit('agent/status', { agent: { id: 'b2' }, status: 'idle' })
+ await reviewed(call)
+ assert.equal(requests.length, 1)
+ assert.ok(warnings.some(line => line.includes('left out a change') && line.includes('looks like a key, token, password, or ID number')), warnings.join('\n'))
+ assert.ok(!warnings.some(line => line.includes('hunter2')), warnings.join('\n'))
+})
+
test('a review saves the well-formed changes of a partly-malformed answer, and says the rest', async (t) => {
const replies = [JSON.stringify({ changes: [{ op: 'add', text: 'The user likes tea' }, { op: 'add' }] })]
const { ctx, call, read, requests, warnings, stop } = start({ replies, config: { memoryReviewDelayMs: 0 } })