fix: address codex review round 1

Two functional gaps in the search tools change:

- Enforce rawOutputMaxBytes on UNTRUNCATED inline stdout too. The cap was
  only checked on the truncated->raw-spill path, so an executor retaining
  more inline than the search cap (or a deployment lowering the cap below
  the bash retention) could smuggle an over-cap parse through, contradicting
  the documented SEARCH_RAW_OUTPUT_OVERFLOW contract. Covered by a new
  over-cap-inline test.

- Load @deepseek-ai/dsh-timeout-policy in the coding-agent tree. The search
  tools declare timeoutMs but nothing in the demo enforced it, so the
  advertised 30s budget silently degraded to the bash executor's 60s
  backstop. The keyless smoke boots the amended tree.
This commit is contained in:
Dudu-0223
2026-07-09 21:12:41 +08:00
parent e0f20088d8
commit e94305d99e
4 changed files with 39 additions and 6 deletions
@@ -392,6 +392,18 @@ describe('raw output acquisition', () => {
expect(text(result)).toContain('narrow pattern, path, or include')
})
it('fails with SEARCH_RAW_OUTPUT_OVERFLOW when UNTRUNCATED inline stdout exceeds the cap', async () => {
// An executor retaining more inline than this package's cap (or a
// deployment lowering rawOutputMaxBytes below the bash retention) must not
// smuggle an over-cap parse through the untruncated path.
dir = await mkdtemp(join(tmpdir(), 'dsh-search-raw-'))
const { ctx, bash } = await setup({ config: { rawOutputMaxBytes: 16 } })
bash.handler = () => runResult(`${'x'.repeat(64)}\n`)
const result = await call(ctx, 'grep', { pattern: 'x' })
expect(result.error).toMatchObject({ name: 'SearchError', code: 'SEARCH_RAW_OUTPUT_OVERFLOW' })
expect(text(result)).toContain('narrow pattern, path, or include')
})
it('fails with SEARCH_RAW_OUTPUT_OVERFLOW when truncated stdout has no spill path', async () => {
dir = await mkdtemp(join(tmpdir(), 'dsh-search-raw-'))
const { ctx, bash } = await setup()