You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[FEATURE]:Option to disable environment block in system prompt #55308
I have verified this feature I'm about to request hasn't been suggested before.
Describe the enhancement you want to request
Regarding not suggested before: there have been a few in this area, nothing I can find that addresses this issue directly and simply.
AI says I need to submit this, or fork and make a change myself. If there is a way, it is not documented.
The problem I have is while running a long coding session locally, dense model, llama.cpp, CPU only with decent context (200K), first turn after midnight gets an updated system prompt with the new date, causing a full context reload, costing many hours (up to 6 - 25% of total throughput).
The date is not that important and the model does not seem to have that much a sense of time anyway. Best to leave that setup to the user.
Thanks for the detailed write-up. Losing hours of CPU prefill at midnight is a real cost.
You didn't give a version, but what you describe matches OpenCode v1 (0.x / 1.x, the opencode-ai package). There the date is part of the <env> block in the system prompt, so when it changes the whole prompt prefix changes and everything is reprocessed. v1 now only gets fixes for critical bugs (data loss, security, crashes with no workaround), so a change here is unlikely.
v2 (2.x, the @opencode/cli package, opencode command) handles this differently. The date and environment info are written once when the session starts. If the date changes later, a short note ("Today's date is now: …") is added at the end of the conversation, and the system prompt is not rewritten. Your cached prefix should then survive midnight, so upgrading to v2 should fix this without needing an option.
If you are already on v2 (opencode --version shows 2.x) and still see a full reprocess at midnight, or you think this is critical for v1, please reply here with your version and we'll take another look.
Yes using latest release version from install script: opencode.ai/install that shows v1.19.0. Claude did not find those issues you mentioned.
Guess I will have to build from repo. How long till the release install is updated?
Thanks for confirming. v1.19.0 is OpenCode v1, which explains what you're seeing.
You don't need to build from the repo or wait for that installer to update. opencode.ai/install installs v1, and v2 is already released (currently 2.0.28) with its own installer:
The v2 curl installer replaces the v1 opencode binary. If you installed v1 with a package manager, remove that first. v2 reads your existing opencode.json from the same locations, so your llama.cpp provider setup should carry over. The migration guide has the details.
In v2 the date and environment info are written once when the session starts, and the system prompt is not rewritten afterwards. After midnight, a short Today's date is now: … note is added at the end of the conversation, so llama.cpp should reuse its cached prefix and only process the new part.
You can check the version with opencode --version (it should show 2.x). If v2 still reprocesses the whole context after midnight, please comment here with the version and we'll look at it as a v2 bug.
Resuming: v2 imports your v1 sessions, so exiting at the end of a turn and resuming the same session in v2 should work. Make sure the old v1 process has fully exited first.
One full reprocess on the first turn: v2 builds its own system prompt and message format, so llama.cpp's cached prefix from v1 won't match. Your first v2 turn will most likely process the whole context once. It's a one-off cost of switching, so you may want to switch at a convenient time.
After that: v2 doesn't rewrite the system prompt. When the date changes, it adds a short Today's date is now: … note at the end of the conversation, so later midnights should only process the new tokens.
If you still see a full reprocess after midnight on v2 (from the second day on), please comment here with what you saw and we'll treat it as a v2 bug.
In the process of switching and reloading under v2 I have a problem - opencode is sending the whole session prompt every 15 mins, while in the middle of processing - 5 mins after each resend llama logs a stop processing that prompt, while the original task keeps running - twice now both the extra task and the main task get a stop and llama stops processing. opencode just sits there waiting for user input and will pick up with a "continue" this is a problem with v2! (asking here because public AI does not seem to know much about the open source alternative)
Thanks for the details. This looks like v2's default request timeouts, and you can turn them off for your provider.
By default, v2 waits 5 minutes for response headers (headerTimeout) and 15 minutes between streamed chunks (chunkTimeout). If a limit is hit, the request is retried up to three times. If those fail too, the session stops and waits for you. A 200K-token prefill on CPU can go more than 15 minutes without sending anything back. That would explain a resend every 15 minutes and the session stopping until you type "continue".
You can turn both off in your opencode.json / opencode.jsonc. Use the ID of your llama.cpp provider in place of llama.cpp and keep your existing settings:
Then restart the background service with opencode service restart so it reloads the config. The docs are in Providers → Timeouts. Note that if the provider is named ollama, the built-in Ollama discovery can take it over (see #54865), so use a different name for a llama.cpp server.
I'm not sure what causes the extra stop about 5 minutes after each resend. One possibility is llama-server's own read/write timeout (--timeout), so it may be worth raising that on the server too.
Related: #26602 is a separate 5-minute limit that affects the Node build. The binary from the install script shouldn't be affected.
If llama.cpp still sees duplicate requests or the session still stops with these settings, please open a new issue with your opencode --version, the provider section of your config (without API keys), and the lines around the retry from ~/.local/share/opencode/log/opencode.log. That way it gets tracked as its own v2 bug.
Added those settings, restarted server after next stop: now I see in the log that a session warming was scheduled for 10 min after start - so getting worse! Did resend full context after 10 mins, so "false"=60000 has to be a bug! Previously there were 4 retries re-sending before the session was stopped (not 3).
I was not aware of the log file - I see errors due to the fact that opencode is running in a VM without internet access for security reasons (update checks fail and models.dev - api.json) Thought I had snapped all the required schemas...
Thanks for testing that. The log line points at a different setting, not the timeouts.
The 10-minute resend is session warming, which is opt-in. "scheduled session warming" is only logged when warming is set in one of your OpenCode config files (the global ~/.config/opencode/opencode.json(c), or an opencode.json(c) / .opencode/opencode.json(c) in the project or any parent folder). It's off by default. Each warming request sends the whole session plus a short keep-alive prompt, which is the full-context resend you're seeing. The number in that log line is probably the warming interval, not your timeout. "chunkTimeout": false and "headerTimeout": false are valid and turn those limits off.
For a local CPU model, warming costs far more than it saves. Remove the warming entry or set it to false, then run opencode service restart:
There does seem to be a real v2 problem here. From reading the code, the warming timer starts when a request begins and doesn't check whether that request is still running. With a prefill longer than the interval, a warming request is sent alongside the one still in progress. That's a separate bug from this issue, which is about v1 and is being closed. If you can, please open a new issue for it with your opencode --version, your warming config, and the log lines around "scheduled session warming" / "warming session".
The "4 sends" you saw earlier is the first request plus the 3 retries.
For the offline VM: before starting OpenCode, set these in the environment, then run opencode service restart so the background service picks them up:
OPENCODE_DISABLE_MODELS_FETCH=1 stops fetching the models.dev catalog. You can also point OPENCODE_MODELS_PATH at a local copy of api.json if you've saved one.
Your llama.cpp provider is defined in your own config, so it doesn't need models.dev.
Closing this as not planned. The original request was about OpenCode v1 (1.19.0), which only gets critical fixes. v2 already avoids the midnight reload: the system prompt is kept for the whole session, and a date change only adds a short note at the end of the conversation.
Thanks for switching to v2.0.28 and reporting back. A quick recap of what came up there:
Set "headerTimeout": false and "chunkTimeout": false on your llama.cpp provider to stop the timeout retries.
Remove warming from your config or set it to false, then run opencode service restart, to stop the keep-alive requests that resend the full context.
For the offline VM, set OPENCODE_DISABLE_AUTOUPDATE=1 and OPENCODE_DISABLE_MODELS_FETCH=1.
Warming firing while a long request is still running looks like a real v2 bug. Please open a new issue for it with your version, your warming config, and the related log lines, so it gets tracked on its own.
I had the warming interval set to 10 min, (should have been disabled for a local model), without a prompt. So it was sending a copy at 10 min and then 3 retries at 15 min, (total 4 that I noted) then stopping the session. It is still doing that with timeouts turned off now.
I do consider the lack of documentation a bug - the fact that there is a v2 is not mentioned on the installation page at opencode.ai, the fact that v1 is broken the way I came across it needs to be documented in the main AI accessible documentation on opencode.ai so that other agents are likely to find it. I was trying to find that bug for days and being taken down many dead ends by public AI, not knowing what was triggering the context reloads.
Now the TUI seems to have generated an interrupt all by itself (showing onscreen next to model details, I did NOT touch ESC) at exactly the 1 hour into the first reasoning turn after context reload. Going back I notice the same interrupt message on the previous warming + 3 retries examples at 1 hour also - is there another timeout in v2 that I do not know about?
I now strongly suspect there is a 1hr request timeout in v2, as the first 3 times: 10min warmup send + 3 * 15 min warmup retries + 5 min for llama to drop the newest task (it has only 1 slot) = exactly 1hr and I conflated that with the interrupt coming from opencode. They arrived at the same time.
That 5 min above was opencode 5 min timeout warming: message="failed to warm session" I cannot see anything explicit in the log for the overall request timeout - the opencode-agent did not mention above a 3rd timeout setting, doco says it defaults to "false" but that is not true - it defaults to 1hr. Trying setting to false.
Hey obot, if you are still watching, this PR #57476 looks like it addresses my problem that you could not reproduce, as the message in the opencode log that coincides with my llama task getting stopped after 60 min is:
How long before that PR appears in the v2 download?
Given that I switched to v2 (which forked the current session internally) and had to switch back to v1, is there any way to tell v2 to re-fork the same session rather than continue from where it left off last time?
Activity
opencode-agent commentedon Oct 14, 2026
Thanks for the detailed write-up. Losing hours of CPU prefill at midnight is a real cost.
You didn't give a version, but what you describe matches OpenCode v1 (0.x / 1.x, the
opencode-aipackage). There the date is part of the<env>block in the system prompt, so when it changes the whole prompt prefix changes and everything is reprocessed. v1 now only gets fixes for critical bugs (data loss, security, crashes with no workaround), so a change here is unlikely.v2 (2.x, the
@opencode/clipackage,opencodecommand) handles this differently. The date and environment info are written once when the session starts. If the date changes later, a short note ("Today's date is now: …") is added at the end of the conversation, and the system prompt is not rewritten. Your cached prefix should then survive midnight, so upgrading to v2 should fix this without needing an option.Related issues:
If you are already on v2 (
opencode --versionshows 2.x) and still see a full reprocess at midnight, or you think this is critical for v1, please reply here with your version and we'll take another look.arren36 commentedon Oct 14, 2026
Yes using latest release version from install script: opencode.ai/install that shows v1.19.0. Claude did not find those issues you mentioned.
Guess I will have to build from repo. How long till the release install is updated?
opencode-agent commentedon Oct 14, 2026
Thanks for confirming.
v1.19.0is OpenCode v1, which explains what you're seeing.You don't need to build from the repo or wait for that installer to update.
opencode.ai/installinstalls v1, and v2 is already released (currently 2.0.28) with its own installer:The v2 curl installer replaces the v1
opencodebinary. If you installed v1 with a package manager, remove that first. v2 reads your existingopencode.jsonfrom the same locations, so your llama.cpp provider setup should carry over. The migration guide has the details.In v2 the date and environment info are written once when the session starts, and the system prompt is not rewritten afterwards. After midnight, a short
Today's date is now: …note is added at the end of the conversation, so llama.cpp should reuse its cached prefix and only process the new part.You can check the version with
opencode --version(it should show 2.x). If v2 still reprocesses the whole context after midnight, please comment here with the version and we'll look at it as a v2 bug.arren36 commentedon Oct 14, 2026
It is showing v2.0.28 now. I will wait for a turn end and switch over (exit and resume). Sounds like that should work?
opencode-agent commentedon Oct 14, 2026
Yes, that should work. A few things to expect:
Today's date is now: …note at the end of the conversation, so later midnights should only process the new tokens.If you still see a full reprocess after midnight on v2 (from the second day on), please comment here with what you saw and we'll treat it as a v2 bug.
arren36 commentedon Oct 15, 2026
In the process of switching and reloading under v2 I have a problem - opencode is sending the whole session prompt every 15 mins, while in the middle of processing - 5 mins after each resend llama logs a stop processing that prompt, while the original task keeps running - twice now both the extra task and the main task get a stop and llama stops processing. opencode just sits there waiting for user input and will pick up with a "continue" this is a problem with v2! (asking here because public AI does not seem to know much about the open source alternative)
opencode-agent commentedon Oct 15, 2026
Thanks for the details. This looks like v2's default request timeouts, and you can turn them off for your provider.
By default, v2 waits 5 minutes for response headers (
headerTimeout) and 15 minutes between streamed chunks (chunkTimeout). If a limit is hit, the request is retried up to three times. If those fail too, the session stops and waits for you. A 200K-token prefill on CPU can go more than 15 minutes without sending anything back. That would explain a resend every 15 minutes and the session stopping until you type "continue".You can turn both off in your
opencode.json/opencode.jsonc. Use the ID of your llama.cpp provider in place ofllama.cppand keep your existing settings:{ "$schema": "https://opencode.ai/config.json", "providers": { "llama.cpp": { "settings": { "headerTimeout": false, "chunkTimeout": false } } } }Then restart the background service with
opencode service restartso it reloads the config. The docs are in Providers → Timeouts. Note that if the provider is namedollama, the built-in Ollama discovery can take it over (see #54865), so use a different name for a llama.cpp server.I'm not sure what causes the extra stop about 5 minutes after each resend. One possibility is llama-server's own read/write timeout (
--timeout), so it may be worth raising that on the server too.Related: #26602 is a separate 5-minute limit that affects the Node build. The binary from the install script shouldn't be affected.
If llama.cpp still sees duplicate requests or the session still stops with these settings, please open a new issue with your
opencode --version, the provider section of your config (without API keys), and the lines around the retry from~/.local/share/opencode/log/opencode.log. That way it gets tracked as its own v2 bug.arren36 commentedon Oct 15, 2026
Added those settings, restarted server after next stop: now I see in the log that a session warming was scheduled for 10 min after start - so getting worse! Did resend full context after 10 mins, so "false"=60000 has to be a bug! Previously there were 4 retries re-sending before the session was stopped (not 3).
I was not aware of the log file - I see errors due to the fact that opencode is running in a VM without internet access for security reasons (update checks fail and models.dev - api.json) Thought I had snapped all the required schemas...
opencode-agent commentedon Oct 15, 2026
Thanks for testing that. The log line points at a different setting, not the timeouts.
The 10-minute resend is session warming, which is opt-in. "scheduled session warming" is only logged when
warmingis set in one of your OpenCode config files (the global~/.config/opencode/opencode.json(c), or anopencode.json(c)/.opencode/opencode.json(c)in the project or any parent folder). It's off by default. Each warming request sends the whole session plus a short keep-alive prompt, which is the full-context resend you're seeing. The number in that log line is probably the warming interval, not your timeout."chunkTimeout": falseand"headerTimeout": falseare valid and turn those limits off.For a local CPU model, warming costs far more than it saves. Remove the
warmingentry or set it tofalse, then runopencode service restart:{ "warming": false }Details are in the warming docs.
There does seem to be a real v2 problem here. From reading the code, the warming timer starts when a request begins and doesn't check whether that request is still running. With a prefill longer than the interval, a warming request is sent alongside the one still in progress. That's a separate bug from this issue, which is about v1 and is being closed. If you can, please open a new issue for it with your
opencode --version, yourwarmingconfig, and the log lines around "scheduled session warming" / "warming session".The "4 sends" you saw earlier is the first request plus the 3 retries.
For the offline VM: before starting OpenCode, set these in the environment, then run
opencode service restartso the background service picks them up:OPENCODE_DISABLE_AUTOUPDATE=1stops update checks.OPENCODE_DISABLE_MODELS_FETCH=1stops fetching the models.dev catalog. You can also pointOPENCODE_MODELS_PATHat a local copy ofapi.jsonif you've saved one.Your llama.cpp provider is defined in your own config, so it doesn't need models.dev.
opencode-agent commentedon Oct 15, 2026
Closing this as not planned. The original request was about OpenCode v1 (1.19.0), which only gets critical fixes. v2 already avoids the midnight reload: the system prompt is kept for the whole session, and a date change only adds a short note at the end of the conversation.
Thanks for switching to v2.0.28 and reporting back. A quick recap of what came up there:
"headerTimeout": falseand"chunkTimeout": falseon your llama.cpp provider to stop the timeout retries.warmingfrom your config or set it tofalse, then runopencode service restart, to stop the keep-alive requests that resend the full context.OPENCODE_DISABLE_AUTOUPDATE=1andOPENCODE_DISABLE_MODELS_FETCH=1.Warming firing while a long request is still running looks like a real v2 bug. Please open a new issue for it with your version, your
warmingconfig, and the related log lines, so it gets tracked on its own.arren36 commentedon Oct 15, 2026
I had the warming interval set to 10 min, (should have been disabled for a local model), without a prompt. So it was sending a copy at 10 min and then 3 retries at 15 min, (total 4 that I noted) then stopping the session. It is still doing that with timeouts turned off now.
arren36 commentedon Oct 15, 2026
I do consider the lack of documentation a bug - the fact that there is a v2 is not mentioned on the installation page at opencode.ai, the fact that v1 is broken the way I came across it needs to be documented in the main AI accessible documentation on opencode.ai so that other agents are likely to find it. I was trying to find that bug for days and being taken down many dead ends by public AI, not knowing what was triggering the context reloads.
arren36 commentedon Oct 15, 2026
Now the TUI seems to have generated an interrupt all by itself (showing onscreen next to model details, I did NOT touch ESC) at exactly the 1 hour into the first reasoning turn after context reload. Going back I notice the same interrupt message on the previous warming + 3 retries examples at 1 hour also - is there another timeout in v2 that I do not know about?
arren36 commentedon Oct 15, 2026
I now strongly suspect there is a 1hr request timeout in v2, as the first 3 times: 10min warmup send + 3 * 15 min warmup retries + 5 min for llama to drop the newest task (it has only 1 slot) = exactly 1hr and I conflated that with the interrupt coming from opencode. They arrived at the same time.
arren36 commentedon Oct 15, 2026
That 5 min above was opencode 5 min timeout warming: message="failed to warm session" I cannot see anything explicit in the log for the overall request timeout - the opencode-agent did not mention above a 3rd timeout setting, doco says it defaults to "false" but that is not true - it defaults to 1hr. Trying setting to false.
arren36 commentedon Oct 15, 2026
v2 ignores "timeout: false, still times out after an hour, useless - back to v1 and corrupting context once a day is not a bug? hmmm
arren36 commentedon Oct 22, 2026
Hey obot, if you are still watching, this PR #57476 looks like it addresses my problem that you could not reproduce, as the message in the opencode log that coincides with my llama task getting stopped after 60 min is:
How long before that PR appears in the v2 download?
Given that I switched to v2 (which forked the current session internally) and had to switch back to v1, is there any way to tell v2 to re-fork the same session rather than continue from where it left off last time?