mirror of
https://github.com/openai/codex.git
synced 2026-11-18 15:01:48 +00:00
Add timestamped SQLite /feedback logs without schema changes (#13645)
## Summary
- keep the SQLite schema unchanged (no migrations)
- add timestamps to SQLite-backed `/feedback` log exports
- keep the existing SQL-side byte cap behavior and newline handling
- document the remaining fidelity gap (span prefixes + structured
fields) with TODOs
## Details
- update `query_feedback_logs` to format each exported line as:
- `YYYY-MM-DDTHH:MM:SS.ffffffZ {level} {message}`
- continue scoping rows to requested-thread + same-process threadless
logs
- continue capping in SQL before returning rows
- keep the existing fallback behavior unchanged when SQLite returns no
rows
- update parity tests to normalize away the new timestamp prefix while
we still only store `message`
## Follow-up
- TODO already in code: persist enough span/event metadata in SQLite to
reproduce span prefixes and structured fields in `/feedback` exports
## Testing
- `cargo test -p codex-state`
- `just fmt`
---------
Co-authored-by: Codex <noreply@openai.com>
This commit is contained in:
1 parent
e15e191ff7
commit
9f91c7f90f
2 files changed
+34
-8
No files matched your search
@@ -420,11 +420,23 @@ mod tests {
|
||||
|
||||
drop(guard);
|
||||
|
||||
// TODO(ccunningham): Store enough span metadata in SQLite to reproduce span
|
||||
// prefixes like `feedback-thread{thread_id="thread-1"}:` in feedback exports.
|
||||
// SQLite exports now include timestamps, while this test writer has
|
||||
// `.without_time()`. Compare bodies after stripping the SQLite prefix.
|
||||
let feedback_logs = writer
|
||||
.snapshot()
|
||||
.replace("feedback-thread{thread_id=\"thread-1\"}: ", "");
|
||||
let strip_sqlite_timestamp = |logs: &str| {
|
||||
logs.lines()
|
||||
.map(|line| {
|
||||
line.split_once(' ')
|
||||
.map_or_else(|| line.to_string(), |(_, rest)| rest.to_string())
|
||||
})
|
||||
.collect::<Vec<_>>()
|
||||
};
|
||||
let feedback_lines = feedback_logs
|
||||
.lines()
|
||||
.map(ToString::to_string)
|
||||
.collect::<Vec<_>>();
|
||||
let deadline = Instant::now() + Duration::from_secs(2);
|
||||
loop {
|
||||
let sqlite_logs = String::from_utf8(
|
||||
@@ -434,7 +446,7 @@ mod tests {
|
||||
.expect("query feedback logs"),
|
||||
)
|
||||
.expect("valid utf-8");
|
||||
if sqlite_logs == feedback_logs {
|
||||
if strip_sqlite_timestamp(&sqlite_logs) == feedback_lines {
|
||||
break;
|
||||
}
|
||||
assert!(
|
||||
|
||||
Reference in new issue
Block a user