Repository navigation
Per-run trajectory: a kernel-written, hash-chained event timeline #573
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
c3576f8
Per-run trajectory: a kernel-written, hash-chained event timeline and…
renmengye abb88dd
Trajectory review fixes: best-effort on any error, launch metadata wi…
renmengye d8f8bbc
Trajectory: no measure event for a refusal before measuring; an unrea…
renmengye ce15ec4
Trajectory: skip the measure event only for a scope refusal; a failed…
renmengye 11a543d
Trajectory: record wall-clock time, not the caller's tick time
renmengye d9efd5a
Steward writes its report before finish_run, so the ending event hash…
renmengye 70bdc82
Merge pull request #575 from outerloop-science/fix/trajectory-wallclock
renmengye 12713c6
Merge remote-tracking branch 'origin/main' into feat/trajectory
renmengye File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,41 @@ | ||
| # Run trajectory | ||
|
|
||
| The kernel alone writes `runs/<run-id>/trajectory.jsonl`, outside the session's | ||
| workspace and writable sandbox mounts. Operational state, launch ledgers, | ||
| inbox/outbox and session records continue unchanged. The trajectory is a | ||
| best-effort timeline, not a replacement for those recovery records. | ||
|
|
||
| Each line is a JSON object with sorted keys: `seq` (starting at zero), `ts` | ||
| (Unix seconds), `type`, `actor`, `data`, `refs`, and `prev`. `prev` is SHA-256 | ||
| of the previous event's exact bytes excluding its newline; the first event | ||
| uses SHA-256 of the UTF-8 run id. Actors use `kernel`, `author:<agent-id>`, | ||
| `judge:<name>`, or `human:<login>`; these kernel actions use `kernel`. | ||
| Refs contain run-relative `path` and `sha256` fields. Native session logs are | ||
| hashed once at session end, and the report is hashed at ending. | ||
|
|
||
| Events cover session start/end, syscall acceptance/refusal, launch submission | ||
| and results, gate results, acknowledged inbox delivery, wakes, PR opening | ||
| (including reconciliation of an already opened PR), and endings. Inbox events | ||
| contain sequence ranges, kinds and origins, never message bodies. Session start | ||
| may have an empty id until the backend returns one. Exceptions produce a session | ||
| end outcome when the host can catch them; process death can leave an unmatched | ||
| start. Measurement credit describes the gate decision, not publication or merge. | ||
|
|
||
| A sibling `trajectory.lock` serializes appenders with exclusive `flock`. A torn | ||
| last line is preserved and separated by a newline; the chain continues from | ||
| the last parseable event. Verification reports malformed lines even after | ||
| recovery. A complete JSON event missing only its newline is retained and its | ||
| newline repaired on the next append. No old bytes are rewritten. Writes stop | ||
| at 4 MB and warn once per file per kernel process; I/O failures warn without | ||
| failing a tick. Events are not transactional with the operational files, so a | ||
| crash or write failure can leave missing events or retries. | ||
|
|
||
| `outerloop trajectory <run-id> --verify` checks sequence gaps and byte hashes; | ||
| `--json` emits events (and verification problems when requested). Missing legacy | ||
| files read as an empty history and verification says "no trajectory". No history | ||
| is reconstructed from older operational files. Older kernels ignore this file. | ||
| The chain detects internal edits and missing lines, but without a trusted | ||
| external anchor cannot detect a rewritten chain or removal of its tail. | ||
| Verification checks the event chain, not the contents of referenced artifacts. | ||
|
|
||
| Tool calls, full measurement provenance and attestation are later steps. |
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
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
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
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
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
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.