mirror of
https://github.com/deepseek-ai/deepseek-harness.git
synced 2026-09-11 04:00:38 +00:00
fix(code-runtime-python): meter the exception diagnostic by serialized cost
Raising maxValueBytes' load bound to ceiling-envelope assumed both budgets are metered in serialized (JSON-escaped) bytes, which held for completion values and logs but not the diagnostic: _cap_message capped by raw UTF-8, so a control-heavy message near maxValueBytes could serialize sixfold and breach the fd-3 frame ceiling — the silent worker-exit inversion the load check prevents. _cap_message now accumulates per-byte serialized cost (new _JSON_BYTE_COST table) and cuts the prefix that fits. Also reword the host SIGXCPU timeout message to name cpuSeconds as the configured ceiling rather than a budget a stricter inherited RLIMIT_CPU soft may undercut. Adds a control-heavy-diagnostic regression test.
This commit is contained in:
@@ -2900,6 +2900,29 @@ describe('PythonCodeRuntime — hostile peer', () => {
|
||||
expect(Buffer.byteLength(result.error?.message ?? '', 'utf8')).toBeLessThan(2048)
|
||||
})
|
||||
|
||||
it('caps a control-heavy exception diagnostic by its serialized cost, not raw bytes', async () => {
|
||||
// The diagnostic crosses fd 3 inside a JSON frame where a control character
|
||||
// escapes sixfold (a NUL is one raw byte, six as ` | ||||