You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/api.md
+4Lines changed: 4 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -341,6 +341,7 @@ Used by API/agent services to trigger project-scoped WebSocket broadcasts withou
341
341
## Runtime Profiles
342
342
343
343
Runtime profiles carry non-secret transport/model config plus the latest persisted runtime-limit snapshot used by API, agent, and UI surfaces.
344
+
For local Codex runtimes (`runtimeId=codex` with `sdk`/`cli` transport), `/runtime-profiles` and `/runtime-profiles/effective/*` now read limit overlays from the SQLite Codex index (`codex_limit_heads`) maintained by the background API indexer. Request handlers do not perform direct `~/.codex/sessions` scans.
344
345
345
346
### List Runtime Profiles
346
347
@@ -367,6 +368,7 @@ GET /runtime-profiles/effective/chat/:projectId
367
368
```
368
369
369
370
Both responses include the resolved `profile` object (or `null`) plus source metadata. When a profile is present, its payload includes `runtimeLimitSnapshot` and `runtimeLimitUpdatedAt`.
371
+
If no indexed Codex head is available for the resolved account/project scope, the response falls back to the persisted profile snapshot.
For local Codex profiles, this endpoint overlays the response from indexed Codex limit heads in SQLite instead of scanning `~/.codex/sessions` during request handling.
675
678
676
679
### Effective Runtime Resolution
677
680
@@ -874,6 +877,7 @@ DELETE /chat/sessions/:id
874
877
```
875
878
876
879
Chat sessions persist the runtime profile chosen when the session starts. This keeps older conversations tied to the runtime they were created with even if the project's current default changes later.
880
+
For local Codex runtimes, session discovery uses the indexed `codex_sessions` read-model. Session detail/message reads resolve `sessionId -> filePath` from the same index before compatibility fallback to runtime-adapter lookups.
877
881
878
882
`POST` and `PUT` accept `runtimeProfileId` as an optional field. The value must be either a global profile or one owned by the same project.
Copy file name to clipboardExpand all lines: docs/architecture.md
+7Lines changed: 7 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -88,6 +88,7 @@ Runtime-limit state is normalized once in `@aif/runtime` and then persisted in S
88
88
- adapters translate provider-specific quota signals into a shared `runtimeLimitSnapshot` contract;
89
89
-`runtime_profiles.runtime_limit_snapshot_json` stores the latest authoritative profile-level state;
90
90
-`tasks.runtime_limit_snapshot_json` stores a task-level copy when work is blocked by quota pressure or hard exhaustion.
91
+
- API runs a background Codex indexer that reconciles `~/.codex/sessions` into SQLite read-model tables (`codex_sessions`, `codex_limit_heads`, `codex_limit_history`, `codex_index_cursors`) so hot endpoints (`/chat/sessions`, `/runtime-profiles`) use DB reads instead of request-path filesystem scans.
91
92
92
93
The source is explicit in the snapshot (`provider_api`, `sdk_event`, `api_headers`, `turn_usage`) so upper layers do not need adapter-specific branching.
93
94
@@ -290,6 +291,9 @@ Key tables:
290
291
-**runtime_profiles** — project-scoped or global runtime/provider profiles with non-secret transport/model config plus authoritative runtime-limit state (`runtime_limit_snapshot_json`, `runtime_limit_updated_at`)
291
292
-**projects** — project metadata plus default runtime profile ids for tasks and chat
292
293
-**chat_sessions / chat_messages** — persisted chat state with runtime profile/session linkage
294
+
-**codex_sessions** — indexed Codex session metadata keyed by runtime session id and source file state
295
+
-**codex_limit_heads / codex_limit_history** — latest and recent normalized Codex limit snapshots keyed by account fingerprint/project scope/limit id
296
+
-**codex_index_cursors** — per-indexer progress/watermark state for incremental reconcile
293
297
-**task_comments** — human/agent comments with optional attachments
294
298
295
299
### Indexes
@@ -303,6 +307,9 @@ Runtime index bootstrap creates the following indexes via `CREATE INDEX IF NOT E
303
307
-`idx_tasks_project_status` — composite for ordered task-list queries
304
308
-`idx_task_comments_task_id` — comment lookups by task
305
309
-`idx_tasks_locked` — parallel execution: find unlocked or stale-locked tasks
310
+
-`idx_codex_sessions_project_root_updated` / `idx_codex_sessions_file_path` — local Codex session listing and session-id/file-path lookup
311
+
-`idx_codex_limit_heads_lookup` — account/project/limit scoped head overlay queries
312
+
-`idx_codex_limit_history_head` / `idx_codex_limit_history_account` — bounded recent limit history by head and account scope
0 commit comments