(
&self,
path: &Path,
prev: StoredCursor,
project_root: &Path,
max_new_bytes: Option<u64>,
)
| 114 | } |
| 115 | |
| 116 | fn parse_new( |
| 117 | &self, |
| 118 | path: &Path, |
| 119 | prev: StoredCursor, |
| 120 | project_root: &Path, |
| 121 | max_new_bytes: Option<u64>, |
| 122 | ) -> Option<ParsedTranscript> { |
| 123 | // `session_meta` (line 1) is authoritative for cwd + session id; without |
| 124 | // it we cannot safely attribute the rollout to a project, so skip. |
| 125 | let meta = session_meta(path)?; |
| 126 | if !path_belongs_to_project(&meta.cwd, project_root) { |
| 127 | return None; |
| 128 | } |
| 129 | |
| 130 | let new = stream_new_jsonl(path, prev, max_new_bytes)?; |
| 131 | let mut messages = Vec::new(); |
| 132 | let mut turn_usage = CodexTurnUsage::default(); |
| 133 | let replayed_from_start = |
| 134 | prev.position > 0 && new.lines.first().is_some_and(|line| line.offset == 0); |
| 135 | let mut context_state = if prev.position > 0 && !replayed_from_start { |
| 136 | CodexContextState::scan_prior(path, prev.position, &meta) |
| 137 | } else { |
| 138 | CodexContextState::from_meta(&meta) |
| 139 | }; |
| 140 | for line in &new.lines { |
| 141 | if turn_usage.observe(&line.value) { |
| 142 | continue; |
| 143 | } |
| 144 | if context_state.observe_context_record(&line.value, path, &meta) { |
| 145 | continue; |
| 146 | } |
| 147 | if let Some(mut message) = response_item_goal_context_from_line( |
| 148 | &line.value, |
| 149 | &meta, |
| 150 | context_state.model.as_deref(), |
| 151 | path, |
| 152 | line.offset, |
| 153 | ) { |
| 154 | context::annotate_message( |
| 155 | &mut message, |
| 156 | context_state.cwd.as_deref(), |
| 157 | context_state.git.as_ref(), |
| 158 | ); |
| 159 | messages.push(message); |
| 160 | continue; |
| 161 | } |
| 162 | if let Some(mut message) = compacted_summary_from_line( |
| 163 | &line.value, |
| 164 | &meta, |
| 165 | context_state.model.as_deref(), |
| 166 | path, |
| 167 | line.offset, |
| 168 | context_state.compaction_depth + 1, |
| 169 | ) { |
| 170 | flush_turn_usage(&mut messages, &mut turn_usage); |
| 171 | context_state.compaction_depth += 1; |
| 172 | context::annotate_message( |
| 173 | &mut message, |
nothing calls this directly
no test coverage detected