Description
Running opencode 1.17.6, I am observing that the "timing" block reports and "start" and "end" times that have times that are way too close together. I used Codex + GPT-5.5 High to triage the problem and it suggests that there is a defect in how the "start" time is reset.
Plugins
None
OpenCode version
1.17.6
Steps to reproduce
Here is the opencode installed in the container:
[rabartl@8e6b72694d96 opencode (23574-fix-time-start)]$ which opencode
/usr/local/bin/opencode
[rabartl@8e6b72694d96 opencode (23574-fix-time-start)]$ opencode --version
1.17.6
I was able to reproduce this bug with:
time opencode run --format=json "Run the comamnd 'time sleep 10s' and report what it shows" | jq
with the reported time:
real 0m13.970s
user 0m3.516s
sys 0m0.675s
and the JSONL output:
{
"type": "step_start",
"timestamp": 1781623575133,
"sessionID": "ses_12ef5b29dffeNWj9H9elnMCmbv",
"part": {
"id": "prt_ed10a525b001rYLL0xCQ2JDp2a",
"messageID": "msg_ed10a4eba001iJ8Ni2A0t3xjkT",
"sessionID": "ses_12ef5b29dffeNWj9H9elnMCmbv",
"snapshot": "584a362a91a87499572288c55f3a1ca359f4e922",
"type": "step-start"
}
}
{
"type": "tool_use",
"timestamp": 1781623586512,
"sessionID": "ses_12ef5b29dffeNWj9H9elnMCmbv",
"part": {
"type": "tool",
"tool": "bash",
"callID": "XzxJgEoNyfQKisx1KqUQOrRdUsgmSFpC",
"state": {
"status": "completed",
"input": {
"command": "time sleep 10s",
"description": "Run time sleep 10s",
"timeout": 120000
},
"output": "\nreal\t0m10.001s\nuser\t0m0.000s\nsys\t0m0.001s\n",
"metadata": {
"output": "\nreal\t0m10.001s\nuser\t0m0.000s\nsys\t0m0.001s\n",
"exit": 0,
"description": "Run time sleep 10s",
"truncated": false
},
"title": "Run time sleep 10s",
"time": {
"start": 1781623586506,
"end": 1781623586510
}
},
"id": "prt_ed10a5685001iR7Rz4rg9eRO2s",
"sessionID": "ses_12ef5b29dffeNWj9H9elnMCmbv",
"messageID": "msg_ed10a4eba001iJ8Ni2A0t3xjkT"
}
}
{
"type": "step_finish",
"timestamp": 1781623586532,
"sessionID": "ses_12ef5b29dffeNWj9H9elnMCmbv",
"part": {
"id": "prt_ed10a7ee1001xiTLlLhDpnKaVj",
"reason": "tool-calls",
"snapshot": "584a362a91a87499572288c55f3a1ca359f4e922",
"messageID": "msg_ed10a4eba001iJ8Ni2A0t3xjkT",
"sessionID": "ses_12ef5b29dffeNWj9H9elnMCmbv",
"type": "step-finish",
"tokens": {
"total": 8296,
"input": 26,
"output": 112,
"reasoning": 0,
"cache": {
"write": 0,
"read": 8158
}
},
"cost": 0
}
}
{
"type": "step_start",
"timestamp": 1781623586726,
"sessionID": "ses_12ef5b29dffeNWj9H9elnMCmbv",
"part": {
"id": "prt_ed10a7fa4001Q3IinvSH5FxjYT",
"messageID": "msg_ed10a7ef7001MqJ2vUha3IZkzN",
"sessionID": "ses_12ef5b29dffeNWj9H9elnMCmbv",
"snapshot": "584a362a91a87499572288c55f3a1ca359f4e922",
"type": "step-start"
}
}
{
"type": "text",
"timestamp": 1781623587086,
"sessionID": "ses_12ef5b29dffeNWj9H9elnMCmbv",
"part": {
"id": "prt_ed10a7fc1001cnEl1E5FBGo5IC",
"messageID": "msg_ed10a7ef7001MqJ2vUha3IZkzN",
"sessionID": "ses_12ef5b29dffeNWj9H9elnMCmbv",
"type": "text",
"text": "The command produced the following output:\n\n```\nreal\t0m10.001s\nuser\t0m0.000s\nsys\t0m0.001s\n```",
"time": {
"start": 1781623586753,
"end": 1781623587085
}
}
}
{
"type": "step_finish",
"timestamp": 1781623587106,
"sessionID": "ses_12ef5b29dffeNWj9H9elnMCmbv",
"part": {
"id": "prt_ed10a811e001iXFMsTp92A878j",
"reason": "stop",
"snapshot": "584a362a91a87499572288c55f3a1ca359f4e922",
"messageID": "msg_ed10a7ef7001MqJ2vUha3IZkzN",
"sessionID": "ses_12ef5b29dffeNWj9H9elnMCmbv",
"type": "step-finish",
"tokens": {
"total": 8384,
"input": 83,
"output": 41,
"reasoning": 0,
"cache": {
"write": 0,
"read": 8260
}
},
"cost": 0
}
}
That shows:
{
"type": "text",
"timestamp": 1781623587086,
"sessionID": "ses_12ef5b29dffeNWj9H9elnMCmbv",
"part": {
"id": "prt_ed10a7fc1001cnEl1E5FBGo5IC",
"messageID": "msg_ed10a7ef7001MqJ2vUha3IZkzN",
"sessionID": "ses_12ef5b29dffeNWj9H9elnMCmbv",
"type": "text",
"text": "The command produced the following output:\n\n```\nreal\t0m10.001s\nuser\t0m0.000s\nsys\t0m0.001s\n```",
"time": {
"start": 1781623586753,
"end": 1781623587085
}
}
}
Okay, so the comamnd itself showed that it took over 10s but if you subtract the "start" and "end" you get
1781623587085 - 1781623586753 = 332 ms, or 0.332 seconds!
Screenshot and/or share link
Don't need a screenshot.
Operating System
This is in a RHEL9-based container:
& uname -r && cat /etc/os-release
6.14.0-37-generic
NAME="Red Hat Enterprise Linux"
VERSION="9.7 (Plow)"
ID="rhel"
ID_LIKE="fedora"
VERSION_ID="9.7"
PLATFORM_ID="platform:el9"
PRETTY_NAME="Red Hat Enterprise Linux 9.7 (Plow)"
ANSI_COLOR="0;31"
LOGO="fedora-logo-icon"
CPE_NAME="cpe:/o:redhat:enterprise_linux:9::baseos"
HOME_URL="https://www.redhat.com/"
DOCUMENTATION_URL="https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/9"
BUG_REPORT_URL="https://issues.redhat.com/"
REDHAT_BUGZILLA_PRODUCT="Red Hat Enterprise Linux 9"
REDHAT_BUGZILLA_PRODUCT_VERSION=9.7
REDHAT_SUPPORT_PRODUCT="Red Hat Enterprise Linux"
REDHAT_SUPPORT_PRODUCT_VERSION="9.7"
Terminal
VS Code Terminal. (Otherwise, I would have to check.)
Description
Running opencode 1.17.6, I am observing that the "timing" block reports and "start" and "end" times that have times that are way too close together. I used Codex + GPT-5.5 High to triage the problem and it suggests that there is a defect in how the "start" time is reset.
Plugins
None
OpenCode version
1.17.6
Steps to reproduce
Here is the opencode installed in the container:
I was able to reproduce this bug with:
with the reported time:
and the JSONL output:
{ "type": "step_start", "timestamp": 1781623575133, "sessionID": "ses_12ef5b29dffeNWj9H9elnMCmbv", "part": { "id": "prt_ed10a525b001rYLL0xCQ2JDp2a", "messageID": "msg_ed10a4eba001iJ8Ni2A0t3xjkT", "sessionID": "ses_12ef5b29dffeNWj9H9elnMCmbv", "snapshot": "584a362a91a87499572288c55f3a1ca359f4e922", "type": "step-start" } } { "type": "tool_use", "timestamp": 1781623586512, "sessionID": "ses_12ef5b29dffeNWj9H9elnMCmbv", "part": { "type": "tool", "tool": "bash", "callID": "XzxJgEoNyfQKisx1KqUQOrRdUsgmSFpC", "state": { "status": "completed", "input": { "command": "time sleep 10s", "description": "Run time sleep 10s", "timeout": 120000 }, "output": "\nreal\t0m10.001s\nuser\t0m0.000s\nsys\t0m0.001s\n", "metadata": { "output": "\nreal\t0m10.001s\nuser\t0m0.000s\nsys\t0m0.001s\n", "exit": 0, "description": "Run time sleep 10s", "truncated": false }, "title": "Run time sleep 10s", "time": { "start": 1781623586506, "end": 1781623586510 } }, "id": "prt_ed10a5685001iR7Rz4rg9eRO2s", "sessionID": "ses_12ef5b29dffeNWj9H9elnMCmbv", "messageID": "msg_ed10a4eba001iJ8Ni2A0t3xjkT" } } { "type": "step_finish", "timestamp": 1781623586532, "sessionID": "ses_12ef5b29dffeNWj9H9elnMCmbv", "part": { "id": "prt_ed10a7ee1001xiTLlLhDpnKaVj", "reason": "tool-calls", "snapshot": "584a362a91a87499572288c55f3a1ca359f4e922", "messageID": "msg_ed10a4eba001iJ8Ni2A0t3xjkT", "sessionID": "ses_12ef5b29dffeNWj9H9elnMCmbv", "type": "step-finish", "tokens": { "total": 8296, "input": 26, "output": 112, "reasoning": 0, "cache": { "write": 0, "read": 8158 } }, "cost": 0 } } { "type": "step_start", "timestamp": 1781623586726, "sessionID": "ses_12ef5b29dffeNWj9H9elnMCmbv", "part": { "id": "prt_ed10a7fa4001Q3IinvSH5FxjYT", "messageID": "msg_ed10a7ef7001MqJ2vUha3IZkzN", "sessionID": "ses_12ef5b29dffeNWj9H9elnMCmbv", "snapshot": "584a362a91a87499572288c55f3a1ca359f4e922", "type": "step-start" } } { "type": "text", "timestamp": 1781623587086, "sessionID": "ses_12ef5b29dffeNWj9H9elnMCmbv", "part": { "id": "prt_ed10a7fc1001cnEl1E5FBGo5IC", "messageID": "msg_ed10a7ef7001MqJ2vUha3IZkzN", "sessionID": "ses_12ef5b29dffeNWj9H9elnMCmbv", "type": "text", "text": "The command produced the following output:\n\n```\nreal\t0m10.001s\nuser\t0m0.000s\nsys\t0m0.001s\n```", "time": { "start": 1781623586753, "end": 1781623587085 } } } { "type": "step_finish", "timestamp": 1781623587106, "sessionID": "ses_12ef5b29dffeNWj9H9elnMCmbv", "part": { "id": "prt_ed10a811e001iXFMsTp92A878j", "reason": "stop", "snapshot": "584a362a91a87499572288c55f3a1ca359f4e922", "messageID": "msg_ed10a7ef7001MqJ2vUha3IZkzN", "sessionID": "ses_12ef5b29dffeNWj9H9elnMCmbv", "type": "step-finish", "tokens": { "total": 8384, "input": 83, "output": 41, "reasoning": 0, "cache": { "write": 0, "read": 8260 } }, "cost": 0 } }That shows:
{ "type": "text", "timestamp": 1781623587086, "sessionID": "ses_12ef5b29dffeNWj9H9elnMCmbv", "part": { "id": "prt_ed10a7fc1001cnEl1E5FBGo5IC", "messageID": "msg_ed10a7ef7001MqJ2vUha3IZkzN", "sessionID": "ses_12ef5b29dffeNWj9H9elnMCmbv", "type": "text", "text": "The command produced the following output:\n\n```\nreal\t0m10.001s\nuser\t0m0.000s\nsys\t0m0.001s\n```", "time": { "start": 1781623586753, "end": 1781623587085 } } }Okay, so the comamnd itself showed that it took over 10s but if you subtract the "start" and "end" you get
1781623587085 - 1781623586753 = 332 ms, or 0.332 seconds!
Screenshot and/or share link
Don't need a screenshot.
Operating System
This is in a RHEL9-based container:
Terminal
VS Code Terminal. (Otherwise, I would have to check.)