Repository navigation
feat(profiles): persist Enter session profile selection and wire lifecycle #1992
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
Open
noxsystems
wants to merge
15
commits into
Gentleman-Programming:main
Choose a base branch
from
noxsystems:feat/1064-3b-i-8-enter-wiring
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
8203187
feat(profiles): add session profile v1 record decoder
AMG-Repo 67868a9
refactor(profiles): validate snapshot agent names with the shared pre…
AMG-Repo 732a11f
feat(profiles): add session profile encoder and active-branch replay
AMG-Repo 4d56f74
feat(profiles): add session profile disk corroboration reader
AMG-Repo f48770f
feat(profiles): add session profile append controller with failure qu…
noxsystems 359d48f
refactor(profiles): share session profile family and metadata predicates
noxsystems 0a681d9
fix(profiles): keep uncorroborated appends untrusted after disk recovery
noxsystems b6d3e8a
test(profiles): cover a throwing post-append stability recheck
noxsystems cf04576
feat(profiles): add session profile controller lifecycle seams
noxsystems 94f4a13
feat(profiles): add session profile lifecycle integration adapter
noxsystems 921ef2e
test(profiles): cover session profile selection serialization helpers
noxsystems ec0757b
feat(profiles): gate subagent launches on session profile authority
noxsystems 49862ae
fix(profiles): decide profile-less branches before reading the sessio…
noxsystems 5e1c79f
feat(profiles): persist Enter session profile selection and wire life…
noxsystems ec90de8
fix(profiles): skip the Enter notice when its ctx went stale while qu…
noxsystems 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,57 @@ | ||
| # Session profile record format | ||
|
|
||
| `lib/session-profile-persistence.ts` defines the optional session profile v1 | ||
| codec and pure replay contract. Adding this module does not change Enter, | ||
| startup, routing, shared defaults, or live orchestrator behavior. | ||
|
|
||
| ## Payloads | ||
|
|
||
| A custom entry uses `customType: "gentle-pi.session-profile/v1"` and one payload: | ||
|
|
||
| ```json | ||
| {"kind":"bind","origin":"user","name":"work","modelProfiles":{"worker":{"model":"provider/model"},"orchestrator":{"thinking":"high"}}} | ||
| {"kind":"clear"} | ||
| ``` | ||
|
|
||
| The encoder creates only explicit `user` selections. The decoder accepts the | ||
| closed origin set `user`, `local`, `repo`, and `global`; this does not implement | ||
| inherited startup persistence or follow mode. A bound empty snapshot is not a | ||
| clear. Snapshots are detached, known invalid fields reject the whole binding, | ||
| and unknown extra fields carry no routing meaning. Existing route normalization | ||
| supports legacy model strings and `effort`; valid `thinking` takes precedence. | ||
|
|
||
| ## Replay | ||
|
|
||
| `replaySessionProfileBranch` requires entries already corroborated on disk, | ||
| ordered oldest to newest on the active branch. Supplying `getBranch()` alone | ||
| does not establish persistence. The newest profile-family entry is terminal: | ||
|
|
||
| | Result | Meaning | | ||
| | --- | --- | | ||
| | `absent` | No profile-family entry on the supplied branch. | | ||
| | `bound` | A detached, validated binding, including an empty snapshot. | | ||
| | `cleared` | An explicit clear; fallback is a later consumer's decision. | | ||
| | `invalid` | Invalid v1 data; never resurrect an earlier binding. | | ||
| | `unsupported` | Unknown profile-family identifier, regardless of payload. | | ||
|
|
||
| Replay neither appends nor publishes bindings and never applies a model or | ||
| thinking level. A subsequent disk-reader slice supplies corroboration; this | ||
| codec alone cannot establish it. | ||
|
|
||
| ## Disk corroboration | ||
|
|
||
| `readSessionProfileDisk(source)` in `lib/session-profile-disk-reader.ts` is the | ||
| stateless synchronous check that supplies the corroboration replay requires. | ||
| It reads the session's public active branch and its JSONL file, selects the | ||
| newest profile-family entry on the branch (excluding caller-supplied known | ||
| failed append IDs), and admits it only when the record on disk is identical. | ||
| It performs no writes, fallback policy, caching, ancestry repair or fsync, and | ||
| a missing file is conservative: it never restores a profile found only in | ||
| memory. | ||
|
|
||
| The result is the decoder result plus `entryIndex` and `lineNumber`, or | ||
| `indeterminate` with one reason: `missing-source`, `invalid-candidate-metadata`, | ||
| `unreadable-file`, `source-changed`, `invalid-json`, `invalid-record`, | ||
| `session-header-mismatch`, `duplicate-id`, `missing-header`, | ||
| `selected-record-missing`, `selected-record-mismatch`, or | ||
| `unserializable-source`. Reasons never carry record contents. |
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.