SOW-0001 Chunk 1: spec deltas (pricing, OS-theme matching)#2
Merged
Conversation
Lands the three spec deltas that close the operator's recorded decisions on Phase 1 product scope. Per the discipline contract, specs change first; code follows in subsequent chunks. New: .agents/sow/specs/pricing.md (~280 lines) - Schema for internal/pricing/pricing.json embedded via go:embed. - Per-provider, per-model, per-unit price fields (input, output, cache read, cache write 5m/1h, reasoning). - Cost computation algorithm and source-recorded-cost-takes- precedence rule. - Refresh script contract: scripts/refresh-pricing.sh invokes an external CLI AI tool (claude/codex/gemini/opencode), validates schema, prints diff, prompts before write, never auto-commits. - Initial seed strategy via discovery query against the backfilled ops table. Updated: .agents/sow/specs/frontend-architecture.md - Theming section expanded with full resolution algorithm. - Precedence: manual override in localStorage > OS preference via prefers-color-scheme. - Three-state header control (Auto / Dark / Light) with explicit reset-to-auto. - matchMedia 'change' listener re-applies only when no manual override is set. - Inline pre-React script in index.html prevents flash-of-wrong- theme on first paint. - Tests enumerated: unit on resolution algorithm, Playwright E2E + axe on both themes, OS-change simulation. Updated: .agents/sow/specs/ui-pages.md - Corrected the bootstrap-era "Dark mode default" claim to "OS preference is the default". - Clarified the three-state control matches the resolution algo. - Keyboard shortcut `t` cycles Auto -> Dark -> Light -> Auto. Updated: .agents/sow/specs/index.md — pricing.md registered. Updated: .agents/sow/current/SOW-0001-phase-1-foundation.md - Implementation section records Chunk 1 evidence. - Notes that anticipated adapter spec refinements are already covered by SOW-0002's evidence-based rewrites. No code changes. Next chunk: CI scaffolding.
ktsaou
added a commit
that referenced
this pull request
May 30, 2026
…b_search Round-2 fixes after external review found real spec-conformance gaps that the per-chunk goldens (built from the same assumptions as the code) missed. Verified against the real ~/.codex corpus (2,660 files). - Turn lifecycle (the P1): old-format turn_context-only sessions (1,006 real files, 38%) ended cleanly but were mislabeled failed/incomplete. Track NEW- vs OLD-format per turn; a new turn now finalizes the prior one (NEW->failed/replaced per edge #2; OLD->completed per edge #3); finalizeStale becomes finalizeAtEOF(stale): OLD-format turns close completed at EOF regardless of staleness (no SessionFinalized), NEW-format only finalize failed/incomplete when >=1h stale. scanner calls it at every full-read EOF. - exec/patch enrichment now reaches op Extras order-independently: a finalizedOps lookup + an idempotent OpStarted re-emit carry exec_exit_code/ exec_cwd/exec_duration_ms/exec_source onto the op row (OpFinalizedEvent has no Extras field), instead of degrading to a DBG log. Real order is exec_command_end before function_call_output in the majority. - collab_agent_spawn_end now emits Op Kind=session Name=spawn ChildSessionNativeID=new_thread_id (was treated as unknown); collab_close_end/ collab_waiting_end recognized. Spec corrected: the link is sender_thread_id->new_thread_id, not agent_ref.thread_id. - Compaction dedup: one op from the data-bearing top-level compacted line; the adjacent event_msg.context_compacted (same compaction) is suppressed. Spec corrected: response_item.compaction/context_compaction do not occur in real data (forward-compat only). - web_search_call carries no correlation id; pair positionally with the following web_search_end. image_generation has no real data (forward-compat). - token_count with no open turn now emits a DBG log instead of silently dropping. Discovery enforces the YYYY/MM/DD shard depth. Softened a containment comment that overclaimed no-TOCTOU. Regenerated b_old_turncontext / e_compaction / f_exec_truncated goldens to the corrected behavior + real wire shapes; added i_collab_spawn / j_replaced_turn / k_web_search fixtures, each line-checked against the spec. Gates green: golangci(0)/gosec(0)/vet; go test -race ./... 13/13; codex coverage 92.4%; FuzzParseLine 0 crashes; secret + AI-attribution scans clean.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
First implementation chunk of SOW-0001 Phase 1 Foundation. Per the discipline contract, specs change first — this PR is pure specs, zero code.
Closes the three product-scope decisions the operator recorded on 2026-05-26:
pricing.mdcovering the embedded JSON schema, cost computation algorithm, and thescripts/refresh-pricing.shCLI-AI-tool flow with PR-visible diffs.prefers-color-scheme, with manualAuto/Dark/Lightoverride inlocalStorage. Full resolution algorithm + no-flash inline script + tests infrontend-architecture.md. Bootstrap-era "Dark mode default" claim inui-pages.mdcorrected to "OS preference is the default".Files
.agents/sow/specs/pricing.md.agents/sow/specs/frontend-architecture.md(Theming section).agents/sow/specs/ui-pages.md(Theme section +tshortcut).agents/sow/specs/index.md(registerpricing.md).agents/sow/current/SOW-0001-phase-1-foundation.md(Chunk 1 evidence)Discipline notes
project-workflowskill: this PR lands before any test or code touching pricing/theme.Next chunk: CI scaffolding.