Skip to content

feat: include OMP session costs#2269

Merged
steipete merged 3 commits into
steipete:mainfrom
kevcube:feature/omp-session-costs
Jul 18, 2026
Merged

feat: include OMP session costs#2269
steipete merged 3 commits into
steipete:mainfrom
kevcube:feature/omp-session-costs

Conversation

@kevcube

@kevcube kevcube commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

Summary

  • scan ~/.omp/agent/sessions/**/*.jsonl alongside compatible pi session logs
  • reuse the existing pi-compatible parser and cache for Codex and Claude attribution
  • document OMP support in provider docs, CLI help, and the changelog

Related to #384.

Redacted runtime proof

I ran the branch against an actual OMP session. The first command reads only metadata and redacts the session filename and token counts:

$ jq '<select first OMP openai-codex assistant message and redact usage>' ~/.omp/agent/sessions/<redacted>.jsonl
{"source":"~/.omp/agent/sessions/<redacted>.jsonl","provider":"openai-codex","api":"openai-codex-responses","model":"gpt-5.6-sol","usage":{"input":"<redacted>","cacheRead":"<redacted>","output":"<redacted>","totalTokens":"<redacted>"}}

A fresh local Codex cost scan on the same branch reports that OMP model. Token and cost values are redacted:

$ CodexBarCLI cost --provider codex --format json --refresh --days 1 | jq '<retain source/model and redact usage>'
[
  {
    "provider": "codex",
    "source": "local",
    "daily": [
      {
        "date": "2026-07-17",
        "modelsUsed": ["gpt-5.6-sol"],
        "inputTokens": "<redacted>",
        "cacheReadTokens": "<redacted>",
        "outputTokens": "<redacted>",
        "totalTokens": "<redacted>",
        "totalCost": "<redacted>"
      }
    ]
  }
]

Verification

  • swift test --build-system native --filter 'scanner merges omp sessions with pi sessions'
  • full sharded Swift suite: 696 selections across 58 groups passed (one group passed on the configured retry)
  • make check
  • rebuilt CodexBarCLI and ran the redacted runtime proof above against local OMP sessions

The native SwiftPM builder and DEVELOPER_DIR=/Applications/Xcode-beta.app/Contents/Developer were used locally because the current macOS 27 command-line toolchain's default builder could not initialize its property-list parser.

@clawsweeper clawsweeper Bot added rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. P3 Low-risk cleanup, docs, polish, ergonomics, or speculative feature. labels Jul 17, 2026
@clawsweeper

clawsweeper Bot commented Jul 17, 2026

Copy link
Copy Markdown

Codex review: needs maintainer review before merge. Reviewed July 18, 2026, 12:26 AM ET / 04:26 UTC.

Summary
The PR scans ~/.omp/agent/sessions/**/*.jsonl through the pi-compatible cost path, updates the cache schema and deduplication behavior, and documents and tests the new OMP source.

Reproducibility: not applicable. this is an additive feature rather than a report of broken behavior. The contributor nevertheless supplied redacted terminal proof from a real OMP session and a post-change Codex cost scan.

Review metrics: 2 noteworthy metrics.

  • Patch surface: 7 files affected; 354 added, 41 removed. The implementation spans scanner and cache behavior, targeted tests, CLI help, and both provider-facing documents.
  • Focused test coverage: 1 merged-source scanner test added. The new test exercises simultaneous pi and nested OMP session discovery, which is the central changed behavior.

Merge readiness
Overall: 🐚 platinum hermit
Proof: 🦞 diamond lobster
Patch quality: 🐚 platinum hermit
Result: ready for maintainer review.

Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch.

Rank-up moves:

  • Obtain an explicit maintainer decision on whether OMP becomes a supported pi-compatible local-cost source.

Risk before merge

  • [P1] Merging documents and supports a new ~/.omp session-log root, creating an ongoing compatibility expectation for an external JSONL format whose evolution is outside this repository.

Maintainer options:

  1. Confirm the OMP support contract (recommended)
    Merge after a maintainer explicitly accepts OMP JSONL as a supported pi-compatible local-cost input and its corresponding maintenance obligation.
  2. Keep pi-only session discovery
    Pause or close this PR if external OMP log compatibility should not become a documented CodexBar behavior.

Next step before merge

  • [P2] No narrow repair is identified; the remaining action is an explicit maintainer choice about supporting OMP as a documented external session source.

Maintainer decision needed

  • Question: Should CodexBar officially support OMP session logs as a pi-compatible local-cost source?
  • Rationale: The implementation is narrow and proof-backed, but accepting a new documented third-party session root is a product and maintenance-contract choice that source review cannot resolve.
  • Likely owner: steipete — The available PR history ties steipete directly to the most recent scanner correctness work and provides the strongest routing signal.
  • Options:
    • Support OMP sessions (recommended): Merge the scanner and documentation change, with OMP JSONL compatibility becoming part of the local-cost support contract.
    • Keep the current source boundary: Decline the OMP root and retain the existing pi-session scope until there is an explicit support plan.

Security
Cleared: The supplied patch changes local session discovery, parsing, cache state, tests, CLI text, and documentation without adding dependencies, privileged execution, secret handling, or CI/release changes.

Review details

Best possible solution:

If maintainers want OMP to be a supported local-cost source, retain the shared pi-compatible parser, entry-ID deduplication, cache invalidation, focused scanner coverage, and explicit provider documentation; otherwise keep the existing pi-only source boundary.

Do we have a high-confidence way to reproduce the issue?

Not applicable: this is an additive feature rather than a report of broken behavior. The contributor nevertheless supplied redacted terminal proof from a real OMP session and a post-change Codex cost scan.

Is this the best way to solve the issue?

Unclear: reusing the existing pi-compatible scanner is the narrowest implementation path, but only after maintainers decide that OMP is an intended supported source rather than an unsupported compatible format.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 5d1d22630513.

Label changes

Label changes:

  • add merge-risk: 🚨 compatibility: The diff adds a documented ~/.omp scan root and therefore an external session-format compatibility commitment.

Label justifications:

  • P3: This is an optional local-cost-source enhancement with no evidence of an urgent regression in existing provider behavior.
  • merge-risk: 🚨 compatibility: The diff adds a documented ~/.omp scan root and therefore an external session-format compatibility commitment.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🦞 diamond lobster and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (terminal): The PR body contains redacted after-fix terminal evidence from a real OMP session and a fresh local Codex cost scan that shows the discovered OMP model; no further contributor proof is needed.
  • proof: sufficient: Contributor real behavior proof is sufficient. The PR body contains redacted after-fix terminal evidence from a real OMP session and a fresh local Codex cost scan that shows the discovered OMP model; no further contributor proof is needed.
Evidence reviewed

What I checked:

  • Real behavior proof: The PR body includes redacted terminal output from a real OMP JSONL session and a fresh CodexBarCLI cost --provider codex --format json --refresh --days 1 scan that reports the OMP model. (ab1f76269601)
  • Focused implementation and coverage: The supplied diff adds an OMP-root option and merged-source coverage in the pi-compatible scanner, plus cache-version invalidation for the expanded per-entry deduplication state. (Sources/CodexBarCore/PiSessionCostScanner.swift:18, ab1f76269601)
  • Compatibility boundary: Both provider documents explicitly add ~/.omp/agent/sessions/**/*.jsonl to supported pi-compatible sessions, making the new third-party log-format support user-visible rather than an internal parser-only change. (docs/codex.md:154, ab1f76269601)
  • Review continuity: The previous completed ClawSweeper review at the earlier head reported no actionable findings after the contributor added proof; the current head adds a deduplication follow-up commit authored by steipete. (Sources/CodexBarCore/PiSessionCostScanner.swift:124, ab1f76269601)

Likely related people:

  • steipete: The supplied PR history shows steipete authored the current deduplication follow-up in the affected pi-compatible scanner path and merged current main into the branch. (role: recent area contributor; confidence: medium; commits: c188dc9f359c, ab1f76269601; files: Sources/CodexBarCore/PiSessionCostScanner.swift, Sources/CodexBarCore/PiSessionCostCache.swift)
What the crustacean ranks mean
  • 🦀 challenger crab: rare, exceptional readiness with strong proof, clean implementation, and convincing validation.
  • 🦞 diamond lobster: very strong readiness with only minor maintainer review expected.
  • 🐚 platinum hermit: good normal PR, likely mergeable with ordinary maintainer review.
  • 🦐 gold shrimp: useful signal, but proof or patch confidence is still limited.
  • 🦪 silver shellfish: thin signal; proof, validation, or implementation needs work.
  • 🧂 unranked krab: not merge-ready because proof is missing/unusable or there are serious correctness or safety concerns.
  • 🌊 off-meta tidepool: rating does not apply to this item.

Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

How this review workflow works
  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.
Review history (3 earlier review cycles)
  • reviewed 2026-07-17T19:43:20.284Z sha dd290c2 :: needs real behavior proof before merge. :: none
  • reviewed 2026-07-17T20:23:35.926Z sha dd290c2 :: needs maintainer review before merge. :: none
  • reviewed 2026-07-17T21:05:39.756Z sha dd290c2 :: needs maintainer review before merge. :: none

@kevcube

kevcube commented Jul 17, 2026

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Jul 17, 2026

Copy link
Copy Markdown

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event repository_dispatch).
Result: the existing ClawSweeper review comment will be edited in place when the review finishes.

Re-review progress:

@clawsweeper clawsweeper Bot added proof: sufficient Contributor real behavior proof is sufficient. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Jul 17, 2026
@clawsweeper clawsweeper Bot added the merge-risk: 🚨 compatibility 🚨 Merging this PR could break existing users, config, migrations, defaults, or upgrades. label Jul 18, 2026

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: ab1f762696

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +575 to +578
self.applyContributions(
daysByProvider: &cache.daysByProvider,
contributions: usage.unkeyedContributions,
sign: 1)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Deduplicate unkeyed mirrored session entries

When the same session is present under both scanned roots but an assistant row has no top-level id (a shape this parser accepts elsewhere and stores in unkeyedContributions), this branch applies those unkeyed totals once per file before the per-session seenEntries filter runs. That means mirrored pi/OMP copies with matching sessionID but id-less assistant usage are still double-counted in the daily totals instead of being counted once.

Useful? React with 👍 / 👎.

@steipete
steipete merged commit 9e9f739 into steipete:main Jul 18, 2026
8 checks passed
@steipete

Copy link
Copy Markdown
Owner

Merged as 9e9f739b6a96e2a786467adb59f1ce6b35f1d6ac after maintainer review and hardening.

Verification:

  • Audited the full diff and contributor context. The original implementation commit is dd290c27f41318957be052bc1a2a5cef2c69ab66; c188dc9f359c036435e3c9d025ba2542538457b9 merged current origin/main; maintainer fix ab1f76269601f2aa15adbf9a5985c6fda98bc5bf added entry-level cross-root deduplication and cache migration.
  • Confirmed OMP discovery feeds the existing pi-compatible parser and cache. Incremental offsets remain intact; JSONL reads remain bounded by the existing 16 MiB cap.
  • Confirmed matching assistant entry IDs in the same session are counted once across .pi and .omp, while divergent unique turns in copied sessions are retained.
  • swift test --filter PiSessionCostScannerTests: 18 passed.
  • swift test --filter CostUsageCacheTests: 9 passed.
  • make check: passed; SwiftLint reported 0 violations.
  • make test: 713/713 test selections passed across 60/60 groups, with zero retries.
  • Final autoreview: clean, no actionable findings, correctness confidence 0.90.
  • Exact-head CI run 29630500869 for ab1f76269601f2aa15adbf9a5985c6fda98bc5bf: 8 checks passed, 0 failed, 0 pending. Both macOS shards, both Linux builds, lint, aggregate, changes, and GitGuardian were green. Merge state was CLEAN and MERGEABLE.

Thanks @kevcube for bringing OMP session-cost coverage to CodexBar, and for the useful redacted live proof.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

merge-risk: 🚨 compatibility 🚨 Merging this PR could break existing users, config, migrations, defaults, or upgrades. P3 Low-risk cleanup, docs, polish, ergonomics, or speculative feature. proof: sufficient Contributor real behavior proof is sufficient. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants