diff --git a/notes/fresh-workspace-handoff.md b/notes/fresh-workspace-handoff.md index 5d6f2ea8..099f7773 100644 --- a/notes/fresh-workspace-handoff.md +++ b/notes/fresh-workspace-handoff.md @@ -29,6 +29,8 @@ Recent anchor commits: - `640e063` - documented the pre-compaction Epiphany workflow and synced the repo memory before compaction - `360dfea` - landed and pushed the Phase 4 hybrid retrieval slice - `80c29e0` - extracted Epiphany core organs into `epiphany-core`, landed explicit Qdrant indexing, and added licensing guardrails +- `bb557d1` - hardened verifier-backed promotion for map/churn replacement patches +- `fbd4dc2` - added repo-local app-server test stack configuration after tracing Windows stack pressure Do not trust this note for the exact current HEAD; use `git log --oneline -1` if you need the live commit. @@ -66,9 +68,9 @@ Current architectural/spec notes: ## Current Landed Baseline -Phase 4 repo-local hybrid retrieval is now landed on `main`. The first retrieval anchor is `360dfea`; the current pushed baseline is `80c29e0`, which also includes explicit Qdrant indexing, the `epiphany-core` extraction, and licensing guardrails. This is no longer a vague scaffold, a maybe, or a working-tree-only event. +Phase 4 repo-local hybrid retrieval is now landed on `main`. The first retrieval anchor is `360dfea`; `80c29e0` adds explicit Qdrant indexing, the `epiphany-core` extraction, and licensing guardrails. Later `main` also includes the typed update/distill/promote surfaces, promotion safety layer, and app-server stack-pressure fix. This is no longer a vague scaffold, a maybe, or a working-tree-only event. -Current verified pushed baseline after that first retrieval anchor: +Current verified baseline after that first retrieval anchor: - explicit `thread/epiphany/index` - manifest-backed Qdrant semantic persistence under `codex_home` @@ -77,7 +79,7 @@ Current verified pushed baseline after that first retrieval anchor: - read-only `thread/epiphany/retrieve` with BM25 fallback still intact - repo-owned `epiphany-core` extraction for the heavy prompt/replay/retrieval organ, leaving vendored Codex with thin adapters plus the typed host seam -Current verified working-tree follow-up: +Current verified typed state/promotion layer: - experimental loaded-thread-only `thread/epiphany/update` - experimental loaded-thread-only `thread/epiphany/distill` @@ -369,6 +371,7 @@ If a future session wakes up from compaction and starts bluffing, this is the pa - App-server stack-pressure footgun from the richer promotion slice: - without a larger test-thread stack, unrelated app-server tests can overflow after the expanded request/promotion machinery - `vendor/codex/codex-rs/.cargo/config.toml` now sets `RUST_MIN_STACK=67108864` + - boxed-future request-dispatch experiments were tested and removed; the Cargo stack config is the minimal verified fix - do not remove that and then act shocked when Windows eats the test harness again - Snapshot hygiene note: - the new Epiphany prompt snapshot normalizes temp skill-root paths in the test harness so it stays stable across runs @@ -421,7 +424,7 @@ Verified: - `cargo test -p codex-app-server-protocol --lib thread_epiphany_retrieve` - `cargo test -p codex-app-server --lib map_epiphany_retrieve_response_preserves_summary_and_results` - full `cargo test -p codex-app-server-protocol` passed after restoring stable schema fixtures -- after tracing the stack overflow from the richer promotion slice, full `cargo test -p codex-app-server --lib` now passes 232/232 with `CARGO_TARGET_DIR=C:\Users\Meta\.cargo-target-codex` and repo-local Cargo config supplying `RUST_MIN_STACK=67108864` +- after tracing the stack overflow from the richer promotion slice, full `cargo test -p codex-app-server --lib` now passes 232/232 with `CARGO_TARGET_DIR=C:\Users\Meta\.cargo-target-codex` and repo-local Cargo config supplying `RUST_MIN_STACK=67108864`; the temporary boxed-future request-dispatch experiments were removed after config-only verification passed Important Windows footgun: diff --git a/state/evidence.jsonl b/state/evidence.jsonl index 1895c2fa..1185482e 100644 --- a/state/evidence.jsonl +++ b/state/evidence.jsonl @@ -93,3 +93,4 @@ {"ts": "2026-04-24T18:06:30+00:00", "type": "verification", "status": "ok", "note": "Verified richer promotion safety layer with epiphany-core full tests, codex-core epiphany tests, and codex-app-server epiphany tests. Full codex-app-server --lib run compiled but hit an unrelated stack overflow in in_process_start_uses_requested_session_source_for_thread_start; Epiphany-scoped app-server tests passed."} {"ts": "2026-04-24T18:12:04+00:00", "type": "verification", "status": "warning", "note": "Rechecked codex-app-server stack overflow from full --lib verification: the exact test in_process::tests::in_process_start_uses_requested_session_source_for_thread_start reproduces when run alone. The failing test exercises in-process thread/start session-source mapping in app-server/src/in_process.rs, not the Epiphany promotion handler or epiphany-core policy path touched by bb557d1. Treat it as outside the touched Epiphany path, but not proven pre-existing without checking an older commit."} {"ts": "2026-04-24T19:00:15+00:00", "type": "verification", "status": "ok", "note": "Traced the codex-app-server stack overflow after bb557d1. The original failing in_process thread/start test overflowed after the processor completed thread/start and before response routing; RUST_MIN_STACK=64MB made exact failures pass. Additional exact failures in guardian and thread-start tracing tests confirmed app-server test-thread stack pressure on Windows rather than one semantic Epiphany path failure. Added Cargo config RUST_MIN_STACK=67108864 and boxed large JSON/in-process request futures plus thread-start/promote futures; full cargo test -p codex-app-server --lib now passes 232/232 without setting RUST_MIN_STACK in the shell."} +{"ts": "2026-04-24T19:23:29+00:00", "type": "verification", "status": "ok", "note": "Reduced the app-server stack fix to the minimal verified culprit. Removed the boxed-future request-dispatch experiments from codex_message_processor.rs, in_process.rs, and message_processor.rs while keeping repo-local Cargo RUST_MIN_STACK=67108864. Exact overflow repros and full cargo test -p codex-app-server --lib pass without shell RUST_MIN_STACK, so the boxes were cruft and should stay gone."} diff --git a/state/map.yaml b/state/map.yaml index cac07074..3b62615f 100644 --- a/state/map.yaml +++ b/state/map.yaml @@ -94,7 +94,7 @@ accepted_design: - land Epiphany's first typed distillation/proposal surface as `thread/epiphany/distill`: loaded-thread-only, read-only, deterministic observation/evidence patch generation with a concrete `expectedRevision`, and explicit promotion through `thread/epiphany/update` - land Epiphany's first explicit promotion gate as `thread/epiphany/promote`: loaded-thread-only, verifier-backed, rejects failed candidates without mutation, and applies accepted candidates through the existing durable update path - land the first richer map/churn promotion safety layer: state replacement promotions must include explicit observations and patch evidence, and subgoal/invariant/graph/frontier/checkpoint/churn replacements get structural validation in `epiphany-core` before reaching the durable update path - - keep Windows app-server verification explicit about stack pressure: Cargo config sets `RUST_MIN_STACK=67108864`, and large JSON/in-process request futures are boxed so the test binary does not depend on shell folklore or tiny default test-thread stacks + - keep Windows app-server verification explicit about stack pressure: Cargo config sets `RUST_MIN_STACK=67108864` so the test binary does not depend on shell folklore or tiny default test-thread stacks rejected_paths: - name: pinned_map_only @@ -111,5 +111,5 @@ rejected_paths: reason: audited candidates were either terminal-only, stale/aspirational, or incoherent wrappers; the comparison clones were removed from vendor to avoid building on untrusted drift current_status: - summary: Workspace initialized with protocol files, typed state, a tiny CLI, a git repo, fresh-workspace handoff notes, architecture rationale, a Codex algorithmic map note, an Epiphany core-harness surface spec, and a rolling implementation plan against vendored Codex. Phase 1 durable Epiphany state, Phase 2 prompt integration, a minimal Phase 3 typed client read surface, and the Phase 4 retrieval/indexing/core-extraction work are landed on `main` at `80c29e0`. The current working tree adds the first explicit typed state-update surface, first read-only typed distillation/proposal surface, first explicit verifier-backed promotion gate, and first richer map/churn promotion safety layer: experimental loaded-thread-only `thread/epiphany/update`, `thread/epiphany/distill`, and `thread/epiphany/promote`; typed patch application through `CodexThread.epiphany_update_state(...)`; deterministic observation/evidence proposal generation; promotion policy evaluation in `epiphany-core`; explicit observation/evidence requirements for state replacement promotions; structural validation for subgoal, invariant, graph, frontier, checkpoint, and churn replacements; immediate rollout persistence only on accepted promotion/update; and replay support for pre-turn out-of-band Epiphany snapshots. Live app-server stdio smokes verified update, distill-to-update, and promote policy end-to-end before the richer structural layer: failed verifier evidence is rejected without state mutation, accepted verifier evidence promotes through the durable update path, and thread/read returns revision 1 with the promoted observation/evidence. The current baseline includes explicit `thread/epiphany/index`, manifest-backed Qdrant semantic persistence under `codex_home`, local Ollama embeddings by default, stale/fresh retrieval metadata, and read-only retrieval that still preserves exact/path search plus BM25 fallback instead of turning the machine into vector-only soup. A live app-server smoke on 2026-04-24 verified the explicit indexing path against real local Qdrant/Ollama using an ephemeral loaded thread rooted at `epiphany-core`: 5 files indexed into 198 chunks, a Qdrant collection was created, and persistent semantic retrieval returned `src/prompt.rs` chunks from the fresh index. Env-scoped backend config is good enough for now. The heavy Epiphany-owned prompt renderer, rollout replay helper, retrieval/indexing engine, observation distiller, and promotion evaluator live in the repo-owned `epiphany-core` crate, while vendored Codex carries thin adapters and the typed host seam. The repo also now has an operative source-available/commercial licensing notice and a CLA gate for external contributions. + summary: Workspace initialized with protocol files, typed state, handoff notes, architecture maps, and a rolling implementation plan against vendored Codex. Phase 1 durable state, Phase 2 prompt integration, the minimal Phase 3 typed read surface, and Phase 4 retrieval/indexing/core-extraction are landed on `main`. The current baseline includes explicit Qdrant indexing with BM25 fallback, typed `thread/epiphany/update`, read-only `thread/epiphany/distill`, verifier-backed `thread/epiphany/promote`, structural map/churn promotion validation in `epiphany-core`, and thin vendored Codex host seams. The Windows app-server stack-pressure regression was narrowed to test-thread stack size; repo-local Cargo config sets `RUST_MIN_STACK=67108864`, and boxed-future request-dispatch experiments were removed after config-only verification passed. The repo also has source-available/commercial licensing plus a CLA gate for external contributions. next_action: Build the next bounded layer above `thread/epiphany/distill`, `thread/epiphany/promote`, and `thread/epiphany/update`: richer observation-to-map proposal machinery from verified observations, while keeping retrieval and distillation read-only and avoiding watcher, GUI, or specialist-agent machinery. diff --git a/state/scratch.md b/state/scratch.md index 3860de67..39359f12 100644 --- a/state/scratch.md +++ b/state/scratch.md @@ -8,7 +8,7 @@ This file is intentionally disposable. ## Working Notes -- The landed Phase 4 retrieval/indexing/core-extraction baseline is now `80c29e0` on `main`. The older `360dfea` commit is only the first hybrid retrieval anchor, not the current repo state. +- The Phase 4 retrieval/indexing/core-extraction anchor is `80c29e0` on `main`. The older `360dfea` commit is only the first hybrid retrieval anchor, and later `main` also includes the typed update/distill/promote surfaces, promotion safety layer, and app-server stack-pressure fix. - The extraction boundary is now the important truth: - `epiphany-core/src/retrieval.rs` owns the heavy hybrid retrieval/indexing engine - `epiphany-core/src/prompt.rs` owns the Epiphany prompt-state renderer @@ -141,8 +141,8 @@ This file is intentionally disposable. - breadcrumbs showed `thread/start` completed in the processor and the overflow happened before response routing, pointing at app-server request/future stack pressure rather than Epiphany promotion semantics - `RUST_MIN_STACK=67108864` made exact failures pass; later exact failures in guardian lifecycle and thread-start tracing tests confirmed the app-server test binary had crossed a Windows stack threshold - `vendor/codex/codex-rs/.cargo/config.toml` now sets `RUST_MIN_STACK=67108864` so Cargo-driven tests get the required stack without shell folklore - - large app-server JSON/in-process request futures, `thread_start_task`, and the expanded `thread/epiphany/promote` arm are boxed to reduce dispatcher stack pressure - - full `cargo test -p codex-app-server --lib` now passes 232/232 with no shell `RUST_MIN_STACK` set + - boxed-future experiments in app-server request dispatch were removed after exact repros and the full app-server suite passed with the Cargo stack config alone + - full `cargo test -p codex-app-server --lib` now passes 232/232 with no shell `RUST_MIN_STACK` set and no new boxed request-dispatch futures ## Open Questions diff --git a/vendor/codex/codex-rs/app-server/src/codex_message_processor.rs b/vendor/codex/codex-rs/app-server/src/codex_message_processor.rs index 1bda0389..4336238e 100644 --- a/vendor/codex/codex-rs/app-server/src/codex_message_processor.rs +++ b/vendor/codex/codex-rs/app-server/src/codex_message_processor.rs @@ -384,7 +384,6 @@ use codex_thread_store::ThreadStoreError; use codex_thread_store::UpdateThreadMetadataParams as StoreUpdateThreadMetadataParams; use codex_utils_absolute_path::AbsolutePathBuf; use codex_utils_pty::DEFAULT_OUTPUT_BYTES_CAP; -use futures::FutureExt; use std::collections::HashMap; use std::collections::HashSet; use std::io::Error as IoError; @@ -989,7 +988,6 @@ impl CodexMessageProcessor { } ClientRequest::ThreadEpiphanyPromote { request_id, params } => { self.thread_epiphany_promote(to_connection_request_id(request_id), params) - .boxed() .await; } ClientRequest::ThreadEpiphanyUpdate { request_id, params } => { @@ -2465,10 +2463,8 @@ impl CodexMessageProcessor { experimental_raw_events, request_trace, ) - .boxed() .await; }; - let thread_start_task = thread_start_task.boxed(); self.background_tasks .spawn(thread_start_task.instrument(request_context.span())); } diff --git a/vendor/codex/codex-rs/app-server/src/in_process.rs b/vendor/codex/codex-rs/app-server/src/in_process.rs index 68563997..729f6d04 100644 --- a/vendor/codex/codex-rs/app-server/src/in_process.rs +++ b/vendor/codex/codex-rs/app-server/src/in_process.rs @@ -86,7 +86,6 @@ use codex_feedback::CodexFeedback; use codex_login::AuthManager; use codex_protocol::protocol::SessionSource; pub use codex_state::log_db::LogDbLayer; -use futures::FutureExt; use tokio::sync::mpsc; use tokio::sync::oneshot; use tokio::time::timeout; @@ -434,7 +433,6 @@ fn start_uninitialized(args: InProcessStartArgs) -> InProcessClientHandle { Arc::clone(&session), &outbound_initialized, ) - .boxed() .await; let opted_out_notification_methods_snapshot = session.opted_out_notification_methods(); diff --git a/vendor/codex/codex-rs/app-server/src/message_processor.rs b/vendor/codex/codex-rs/app-server/src/message_processor.rs index 7c7bc870..57fa6e21 100644 --- a/vendor/codex/codex-rs/app-server/src/message_processor.rs +++ b/vendor/codex/codex-rs/app-server/src/message_processor.rs @@ -422,7 +422,6 @@ impl MessageProcessor { /*outbound_initialized*/ None, request_context.clone(), ) - .boxed() .await; }, ) @@ -467,7 +466,6 @@ impl MessageProcessor { Some(outbound_initialized), request_context.clone(), ) - .boxed() .await; }, )