opencode icon indicating copy to clipboard operation
opencode copied to clipboard

Stuck After Compaction With long calls to models.dev

Open wojons opened this issue 1 year ago • 10 comments

I been facing an issue i had it with many models like glm-4.5, glm-4.6, grok-code and a few others the typically after a compact event the logs will show a very long call to models.dev and it will never recover on its own when it gets here and i have to manually start again. I will leave this ticket open to bring more data as i find it.

INFO  2025-10-09T05:29:40 +89ms service=session.compaction pruned=0 total=0 found
INFO  2025-10-09T06:01:32 +1912090ms service=models.dev file={} refreshing
INFO  2025-10-05T09:02:52 +104ms service=session.compaction pruned=0 total=0 found
INFO  2025-10-05T09:31:21 +1709605ms service=models.dev file={} refreshing
INFO  2025-10-04T10:21:06 +2042611ms service=models.dev file={} refreshing
INFO  2025-10-04T11:21:06 +3600031ms service=models.dev file={} refreshing
INFO  2025-10-04T12:21:06 +3600008ms service=models.dev file={} refreshing
INFO  2025-10-04T13:21:06 +3600031ms service=models.dev file={} refreshing
INFO  2025-10-04T14:21:06 +3600030ms service=models.dev file={} refreshing
INFO  2025-10-04T15:21:06 +3600032ms service=models.dev file={} refreshing
INFO  2025-10-04T16:21:06 +3600031ms service=models.dev file={} refreshing

wojons avatar Oct 09 '25 06:10 wojons

This issue might be a duplicate of existing issues. Please check:

  • #2940: Very similar symptoms - OpenCode hangs randomly after receiving instructions, logs show session.compaction followed by models.dev refreshing patterns, requiring manual restart

Feel free to ignore if none of these address your specific case.

github-actions[bot] avatar Oct 09 '25 06:10 github-actions[bot]

hmm

rekram1-node avatar Oct 09 '25 06:10 rekram1-node

This one is with opencode/grok-code

INFO  2025-10-09T05:32:55 +77ms service=session.compaction pruned=0 total=0 found
INFO  2025-10-09T06:24:15 +3080464ms service=models.dev file={} refreshing
INFO  2025-10-09T06:44:05 +99ms service=session.compaction pruned=0 total=0 found
INFO  2025-10-09T07:26:00 +2515337ms service=models.dev file={} refreshing

wojons avatar Oct 09 '25 07:10 wojons

@wojons I don't think the compact that causes the issue, this fetch comes every hour, I would suggest trying to call https://models.dev/api.json in your browser to see if its a network issue. Maybe best fix would be to have a timeout on this fetch to abort it if its more than 10 seconds, to prevent the indefinite hanging.

OpeOginni avatar Oct 09 '25 13:10 OpeOginni

definitely, pr welcome btw

if not ill take care of it

rekram1-node avatar Oct 09 '25 13:10 rekram1-node

@rekram1-node read my mind lol

OpeOginni avatar Oct 09 '25 13:10 OpeOginni

@OpeOginni I will trust your judgment on the call what i noticed was that they seemed to happen one after the other anytime i check when stuck in the logs that became the pattern. I have had it on multiple computers multiple networks including data centers etc.

wojons avatar Oct 09 '25 19:10 wojons

Maybe best fix would be to have a timeout on this fetch to abort it if its more than 10 seconds, to prevent the indefinite hanging.

Now I don't think it caused issue in this case, it is still prolly good to timeout so Im approving

rekram1-node avatar Oct 12 '25 05:10 rekram1-node

You might consider trying the OpenCode Sentinel project—it cuts all network access except to your LLM, so it works flawlessly in network-restricted environments👍👍.

Repo: https://github.com/oneoflzx/opencode-sentinel

OneOfLzx avatar Jan 22 '26 07:01 OneOfLzx

To stay organized issues are automatically closed after 90 days of no activity. If the issue is still relevant please open a new one.

github-actions[bot] avatar Mar 28 '26 03:03 github-actions[bot]