feat(owner): resume the same tick session within a calendar day - #97
Open
anshulsao wants to merge 1 commit into
Open
feat(owner): resume the same tick session within a calendar day#97anshulsao wants to merge 1 commit into
anshulsao wants to merge 1 commit into
Conversation
Owner ticks were sessionless — a fresh harness session every tick, cold-reading
the charter + journal each time. This resumes the SAME session within a local
calendar day (fresh each new day), so within-day ticks keep warm context while
the journal stays the cross-day / cross-crash memory.
- flowdb: owners.tick_session_id + tick_session_date (CREATE-TABLE DDL and an
idempotent ALTER migration); targeted SetOwnerTickSession write that can't
clobber the concurrent tick_pid / last_tick bookkeeping.
- harness: SkipPermissionsRunSession (claude --session-id <id>, pins a resumable
session) and SkipPermissionsResume (claude --resume <id>); codex mirrors both
via `codex exec resume <id>`. argv builder is injectable for tests.
- owner_tick: cmdOwnerTick resumes when tick_session_date == today, else mints a
fresh pinned session id and records {id, today}. Overlap guard, scheduler,
self-pacing, and journal discipline unchanged; crash-safe (dead tick exits,
next tick resumes same-day or cold-starts).
Verified end-to-end with a throwaway echo owner (marker word + in-session counter):
tick 1 (fresh): session A, marker=vellichor, in-session N=0
tick 2 (same day): session A UNCHANGED, marker=vellichor recalled, N=1
tick 3 (backdated day): session B (new), marker=sassafras, N=0
Tests: go build/vet/test ./... green; added flowdb column/migration tests,
owner_tick resume-vs-fresh tests, and claude argv (--session-id/--resume) tests.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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.
What
Owner ticks are sessionless today —
cmdOwnerTickstarts a fresh harnesssession on every tick, cold-reading the charter + journal each time. This makes
the tick resume the same session within a local calendar day (fresh each new
day), so within-day ticks keep warm in-context continuity while the journal
remains the cross-day / cross-crash memory.
How
owners.tick_session_id,owners.tick_session_dateadded to theCREATE-TABLE DDL and as an idempotent
ALTER TABLEmigration; threaded throughOwnerCols/ scan / insert / update; new targetedSetOwnerTickSession()write(only its two columns +
updated_at, so it can't clobber the concurrenttick_pid/last_tick_*bookkeeping).SkipPermissionsRunSession(sid, prompt)(
claude --session-id <id>, pins a resumable session at the deterministic(cwd, sid) transcript path) and
SkipPermissionsResume(sid, prompt)(
claude --resume <id>). Codex mirrors both viacodex exec resume <id>(idempotent on the thread id). The argv exec is behind an injectable var for
tests.
cmdOwnerTickresumes whentick_session_date == today,otherwise mints a fresh pinned session id and records
{id, today}. Overlapguard, scheduler (
tick-due), self-pacing (owner next), and journaldiscipline are unchanged. Crash-safe: a dead tick exits; the next tick resumes
same-day or cold-starts.
Why
Within-day continuity without a long-running process: warmer context and better
cache economics than cold-starting every tick, while a daily reset bounds
transcript growth and the durable journal keeps memory across resets/crashes.
Testing
go build ./...,go vet ./...,go test ./...all green. Added: flowdbcolumn + migration tests,
owner_tickresume-vs-fresh tests (override the runnerto capture mode + session id), and claude argv tests (
--session-id/--resume).Verified end-to-end against the built binary with a throwaway
echoowner whosecharter writes a per-session marker word + an in-session tick counter:
78646180…78646180…(unchanged)048eefdd…(new)Tick 2 recalling "vellichor" and incrementing N is only possible from the
resumed in-context transcript; tick 3's new id + new marker confirms the
new-day-fresh branch.
Migration note
Purely additive (two nullable columns). Backward-compatible — an older binary
ignores the new columns.
🤖 Generated with Claude Code