github-actions[bot] commited on
Commit ·
f85e770
1
Parent(s): 6ec98e7
Auto-deploy from GitHub: 1631ea8758589fd959d508cf32f072353b2eeb76
Browse files- app/services/worker.py +12 -7
app/services/worker.py
CHANGED
|
@@ -205,14 +205,19 @@ async def _run_opencode(system_prompt: str, text: str) -> str:
|
|
| 205 |
|
| 206 |
full_prompt = f"{system_prompt}\n\n{text}" if system_prompt else text
|
| 207 |
|
| 208 |
-
# --
|
| 209 |
-
#
|
| 210 |
-
#
|
| 211 |
-
#
|
| 212 |
-
#
|
| 213 |
-
#
|
|
|
|
|
|
|
|
|
|
|
|
|
| 214 |
proc = await asyncio.create_subprocess_exec(
|
| 215 |
-
'opencode', 'run', '--print-logs', '--
|
|
|
|
| 216 |
stdout=asyncio.subprocess.PIPE,
|
| 217 |
stderr=asyncio.subprocess.PIPE,
|
| 218 |
limit=2 ** 24, # 16 MB
|
|
|
|
| 205 |
|
| 206 |
full_prompt = f"{system_prompt}\n\n{text}" if system_prompt else text
|
| 207 |
|
| 208 |
+
# --log-level WARN keeps the logs we care about (something went wrong) and
|
| 209 |
+
# drops the INFO firehose: one `message.part.delta publishing` line per
|
| 210 |
+
# streamed token, plus the whole-prompt echo on startup.
|
| 211 |
+
#
|
| 212 |
+
# That echo is why the streams get a raised limit. The readers below use
|
| 213 |
+
# StreamReader.readline(), whose buffer defaults to 64KB (2**16), and a
|
| 214 |
+
# prompt larger than that — a character-dense reconcile pass, say —
|
| 215 |
+
# overflowed on the very first line with "Separator is found, but chunk is
|
| 216 |
+
# longer than limit", failing the task before opencode did any work. WARN
|
| 217 |
+
# should suppress the echo, but the headroom stays as insurance.
|
| 218 |
proc = await asyncio.create_subprocess_exec(
|
| 219 |
+
'opencode', 'run', '--print-logs', '--log-level', 'WARN',
|
| 220 |
+
'--model', 'opencode/big-pickle', full_prompt,
|
| 221 |
stdout=asyncio.subprocess.PIPE,
|
| 222 |
stderr=asyncio.subprocess.PIPE,
|
| 223 |
limit=2 ** 24, # 16 MB
|