feat(workspace): attribute Codex and OpenCode workspaces#486
Open
IvGolovach wants to merge 3 commits intojunhoyeo:mainfrom
Open
feat(workspace): attribute Codex and OpenCode workspaces#486IvGolovach wants to merge 3 commits intojunhoyeo:mainfrom
IvGolovach wants to merge 3 commits intojunhoyeo:mainfrom
Conversation
Validation - git fetch --no-tags origin main: PASS - bash scripts/check-version-coherence.sh: PASS - cargo test --workspace --all-features: PASS, 1131 passed, 2 ignored - cargo fmt --all -- --check: PASS - cargo clippy -p tokscale-core --all-features -- -D warnings: PASS - git diff --check: PASS Rollback - git revert HEAD
Contributor
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
Contributor
There was a problem hiding this comment.
1 issue found across 4 files
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="crates/tokscale-core/src/sessions/opencode.rs">
<violation number="1" location="crates/tokscale-core/src/sessions/opencode.rs:162">
P2: Deduplicated SQLite messages can get nondeterministic workspace attribution because duplicate selection is order-dependent and query order is undefined.</violation>
</file>
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
Validation - git fetch --no-tags origin main: PASS - bash scripts/check-version-coherence.sh: PASS, Version coherence OK: 2.0.27 - cargo fmt --all -- --check: PASS - cargo test -p tokscale-core sessions::opencode --all-features: PASS, 23 passed, 1 ignored - cargo test --workspace --all-features: PASS - cargo clippy -p tokscale-core --all-features -- -D warnings: PASS - git diff --check: PASS - git diff --cached --check: PASS Rollback - git revert HEAD
Validation - cargo fmt --all -- --check: PASS - cargo test -p tokscale-cli --bin tokscale --all-features tui::cache::tests::load_cache_falls_back_to_legacy_dot_cache_path -- --exact --nocapture: PASS, 1 passed - cargo test -p tokscale-cli --bin tokscale --all-features: PASS, 446 passed, 1 ignored - cargo test --workspace --all-features: PASS - git diff --check: PASS - git diff --cached --check: PASS Rollback - git revert HEAD
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
Adds workspace attribution for Codex and OpenCode usage so
--group-by workspace,modelcan show real workspace buckets for both clients when reliable source metadata is available.Why
Codex and OpenCode were falling into the
Unknown workspacebucket even when their session data already contained explicit workspace context. This change uses only reliable sources: Codexsession_meta.cwd, OpenCode SQLitesession.directory, and OpenCode JSONpath.root.Diff scope
Touched areas
crates/tokscale-core/src/sessions/codex.rs: readscwdfrom Codexsession_meta, persists it in incremental parse state, and applies it to structured and headless usage rows.crates/tokscale-core/src/sessions/opencode.rs: reads workspace metadata from OpenCode SQLite sessions and explicit JSONpath.root, with legacy SQLite fallback kept intact.crates/tokscale-core/src/message_cache.rs: bumps the source cache schema so stale cached rows without workspace metadata are not reused.crates/tokscale-cli/tests/cli_tests.rs: adds CLI coverage for Codex and OpenCode workspace/model grouping output.Branch integrity
mainedc8ed1fca49ec4a6936e4d4e15ca45dfd442b8e1ahead,0behindedc8ed1fca49ec4a6936e4d4e15ca45dfd442b8egit merge-base --is-ancestor origin/main HEADreturned exit code0;origin/mainis an ancestor of this branch.Commit integrity
8fc78149ccb9a4369bb4da76809eaee6cf116c09 feat(workspace): attribute Codex and OpenCode workspacesscripts/ledger/does not exist in this repository.scripts/ledger/does not exist in this repository.Ledger proof
Not applicable -
scripts/ledger/does not exist in this repository.Diff hygiene
git diff --name-status origin/main...HEADgit diff --check origin/main...HEADPASS, no output.
Forbidden-file confirmation
No
.envfiles, local environment files, secrets, tokens, credentials,ops/reports/**,__pycache__/,*.pyc,.DS_Store,.coverage,htmlcov/,coverage.xml, build artifacts, cache files, unrelated generated files, or unrelated source changes are included.Test proof
bash scripts/check-version-coherence.sh: PASS,Version coherence OK: 2.0.27cargo test --workspace --all-features: PASS,1131 passed,2 ignoredcargo fmt --all -- --check: PASS, no outputcargo clippy -p tokscale-core --all-features -- -D warnings: PASSVerification-pack proof
Not applicable - no infra, governance, replay, invariant, runbook, release, or verification-pack files changed.
Migration notes
Not applicable - no DB migration changed.
CI context confirmation
backend,frontend, andsimulated-correctness-core: Not applicable - this Rust CLI repository does not define those contexts for this PR.Runtime safety
Reviewed runtime modules:
crates/tokscale-core/src/sessions/codex.rs,crates/tokscale-core/src/sessions/opencode.rs, andcrates/tokscale-core/src/message_cache.rs.Documentation integrity
Not applicable - no docs, runbooks, commands, or user-facing CLI syntax changed.
Rollback plan
git revert <post_merge_commit_sha><post_merge_commit_sha>with the final squash or merge commit SHA after merge.Known residual risks
cargo clippy --workspace --all-features -- -D warningsjob.