Repository navigation
Windows shell: read daemon createdAt as reference-date seconds - #641
Merged
Merged
Conversation
The daemon encodes Date with JSONEncoder's default strategy, seconds since 2001-01-01, but the Windows shell treated a loop's createdAt as Unix seconds. A loop created moments earlier therefore showed "idle 11323d" in the sidebar and "elapsed >1h" in the loop bar: 11323 days is the 978,307,200-second gap between the two epochs. Convert at the GraphModel parse boundary so every consumer sees Unix seconds. Fractional values are floored; the reference date itself (the starter-template placeholder), earlier values, out-of-range values and non-numbers stay unknown. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Signed-off-by: Colin Neilens <coneilen@microsoft.com>
coneilen
force-pushed
the
coneilen-fix-windows-loop-age-epoch
branch
from
October 6, 2026 23:31
d509f1f to
a0cacc0
Compare
3 of 5 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
In the Windows shell, a loop created seconds earlier showed
idle 11323din the sidebar andelapsed >1hin the loop bar. That was seen on the beta10 Dev Box qualification. The daemon encodesDatewithJSONEncoder's default strategy, which writes seconds since 2001-01-01, and the shell readcreatedAtas Unix seconds. 11323 days is the 978,307,200-second gap between the two epochs. This PR converts the value to Unix seconds whereGraphModelparses it, so the sidebar, loop cards, attention rail, loop detail start time, and workspace loop bar all show the correct age.Changes
GraphModel.zig:createdAtnow goes throughunixSecondsFromReferenceDate, which parses the number as a float, floors fractional seconds, and adds 978,307,200. These values decode as unknown (null): 0, which is the reference date itself and the placeholder thatStarterTemplates.swiftstamps; negative values; non-numeric values; and values whose Unix result would reach 1e12. Before this change,-1and non-numbers were already unknown.GraphCanvas.elapsedLabel/startTimeLabel,TerminalSurface.elapsedLabel). They multiply values below 1e12 by 1000. Converted values are always Unix seconds below 1e12, so the heuristic stays correct and I left it unchanged.TerminalSurface.zigis not modified. It reads the same convertedNode.created_at.Datefields. Quick chats'createdAtis not parsed.lastOpenedAtis only validated inWorkspaceManager/Formsand never displayed. Activity timestamps come from the localstd.time.timestamp().WorkspaceLifecyclecreation times come from Windows APIs. None of these changed.createdAt12.5 and 123 now expect 978307212 and 978307323. Shared Swift (GraphcodeKit/) is unchanged, and macOS is unaffected.Test plan
All commands ran from
graphcode-windowswith Zig 0.15.2 ($env:GRAPHCODE_ZIG0152), using the flags thatTools/windows/Tests/WindowsShell.Tests.ps1uses for each root. The include dir is C:\gc-providers\winghostty\include.RED: zig test src\Sidebar.zig -target x86_64-windows-msvc -lc -luser32 -lgdi32 -I...\winghostty\include --test-filter "loop row age reads" -> 1/1 FAIL, expected "5s", instead found "11323d"
GREEN: same Sidebar command, plus zig test src\GraphModel.zig --test-filter "reference-date" and zig test src\GraphCanvas.zig -target x86_64-windows-msvc -lc -I...\winghostty\include --test-filter "just-created daemon" -> each 1/1 passed
REGRESSION: full unfiltered roots zig test src\GraphModel.zig, src\Sidebar.zig, src\GraphCanvas.zig with the same flags -> 154/154, 185/185, 206/206 passed
The other two RED runs failed the same way before the fix:
--test-filter "reference-date": expected 1791219880, found 812912680.--test-filter "just-created daemon": expected0m, found>1d.Limits:
TerminalSurface.zigandApp.zigtest roots locally because they need a builtghostty-vt-static.lib. CI covers them.zig buildof the shell orvalidate.ps1 -Task windows-shell.make testormake checkbecause this change is Windows-only Zig.Checklist
git commit -s) per the DCOmake test): not run, because this is a Windows-only Zig change. The focused Zig roots above pass.make check): not run, becausemake checklints Swift only. The change follows the surrounding Zig style.