Track collaboration mode instructions in world state (#33876)

## What changed

- Model collaboration mode as a world-state section whose persisted snapshot is
  the active mode.
- Emit collaboration instructions when the mode changes, while ignoring
  instruction text changes within the same mode.
- Restore persisted collaboration instructions when they are missing from
  retained history, including after a fork.

## Testing

- Add snapshot coverage for initial, unchanged, changed, and unknown mode state.
- Cover retained-history restoration and same-mode instruction changes.

GitOrigin-RevId: ffd1683499f09acef6516b0bfcb5bcb4d3f28df4
This commit is contained in:
pakrym-oai authored and copyberry committed 2026-07-17 17:22:39 +00:00
1 parent 1fc15cc9a9
commit cf4c8cab7c
11 files changed
+192 -79

No files matched your search

@@ -8,7 +8,6 @@ Scenario: First request after fork when startup preserves the parent baseline, t
00:message/developer:<PERMISSIONS_INSTRUCTIONS>
01:message/user:<ENVIRONMENT_CONTEXT:cwd=<CWD>>
02:message/user:fork seed
03:message/developer[2]:
[01] <PERMISSIONS_INSTRUCTIONS>
[02] <collaboration_mode>Fork turn collaboration instructions.</collaboration_mode>
04:message/user:after fork
03:message/developer:<PERMISSIONS_INSTRUCTIONS>
04:message/developer:<collaboration_mode>Fork turn collaboration instructions.</collaboration_mode>
05:message/user:after fork