Skip to content

feat(trajectory): profile-scoped state embeddings (#179) - #182

Merged
100yenadmin merged 6 commits into
mainfrom
feat/profile-scoped-embeddings
Jul 29, 2026
Merged

100yenadmin merged 6 commits into
mainfrom
feat/profile-scoped-embeddings

Conversation

@100yenadmin

@100yenadmin 100yenadmin commented Jul 29, 2026 •

Copy link
Copy Markdown
Owner

Closes #179. Schema migration to (profile_digest, state_id) identity with fail-closed handling of ambiguous legacy state, restoring rebuild availability (old profile serves, intact, until atomic cutover — the sound version of what round 4 attempted and round 5 had to revert).

Kill bars pre-registered in the spec and asserted as regressions: post-migration ranking byte-identity; interruption-at-any-boundary leaves the prior profile serving identical results. Default-off feature; full-suite exact-name parity in the CI-replica env.

Review per program protocol — bots, findings get fixed/refuted/deferred with verdicts.

Summary by CodeRabbit

  • New Features

    • Added safer state-semantic profile rebuilds with staged activation after successful completion.
    • Added support for profile-scoped state embeddings and safe migration of legacy embedding data.
    • Added progress reporting for staged rebuilds.
  • Bug Fixes

    • Preserved the active profile and search rankings when rebuilds are interrupted or overlap.
    • Prevented unsafe in-place rebuilds and ambiguous legacy-data migrations.
    • Improved embedding cache consistency and chunked-document handling.

…state_id) identity (#179)

Schema migration (transactional, idempotent by PK detection): legacy rows
adopt the active profile's digest; sole stored digest adopted when
unambiguous; mixed digests with no active profile FAIL CLOSED (overwritten
vectors cannot be reconstructed — never assign mixed vectors).

Restores keep-old-active-during-staging: the prior profile stays active
AND intact until atomic cutover (the r5 revert existed because the old
schema forbade exactly this). Pre-registered kill-bar regressions:
post-migration prior-profile rankings byte-identical; interruption at any
batch boundary leaves the prior profile serving identical results.

Default-off feature (state_semantic_quota=0). Author: codex sol-high;
review: orchestrator.
@coderabbitai

coderabbitai Bot commented Jul 29, 2026 •

Copy link
Copy Markdown

Review Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 918056bf-5960-42b7-a1a5-a7a248f316ec

📥 Commits

Reviewing files that changed from the base of the PR and between 7af390c and ff52c48.

📒 Files selected for processing (1)
  • FINDINGS-VERDICTS-PR182.md

Cache: Disabled due to Reviews > Disable Cache setting

Disabled knowledge base sources:

  • Linear integration is disabled

You can enable these sources in your CodeRabbit configuration.


📝 Walkthrough

Walkthrough

State semantic embeddings are migrated to profile-scoped composite identity. Rebuilds stage vectors without deactivating the serving profile, reject unsafe same-profile rewrites, cut over only after completion, and add migration, interruption, and concurrency regression coverage.

Changes

State semantic rebuild availability

Layer / File(s) Summary
Profile-scoped schema and legacy migration
trajectory_store.py, tests/test_trajectory_state_semantic_expansion.py
State embedding rows use (profile_digest, state_id) identity; legacy tables are migrated transactionally with guarded digest adoption and cache reset.
Staged profile rebuild and cutover
trajectory_store.py
Rebuilds preserve the serving profile during staging, reject same-profile targets, upsert profile-scoped vectors, and activate the completed target profile.
Migration and rebuild regression coverage
tests/test_trajectory_state_semantic_expansion.py
Tests cover legacy migration, interrupted backfills, ranking preservation, forced rebuild controls, concurrent cutover, and chunk routing.
Recorded validation results
FINDINGS-VERDICTS-PR182.md
Review findings, fixes, validation commands, tooling results, and proof boundaries are documented across four review rounds.

Estimated code review effort: 4 (Complex) | ~60 minutes

Sequence Diagram(s)

sequenceDiagram
  participant RebuildCaller
  participant TrajectoryStore
  participant EmbeddingProvider
  participant StateEmbeddings
  participant SemanticProfiles
  RebuildCaller->>TrajectoryStore: request staged rebuild
  TrajectoryStore->>EmbeddingProvider: embed state documents
  EmbeddingProvider-->>TrajectoryStore: return vectors
  TrajectoryStore->>StateEmbeddings: upsert profile-scoped rows
  TrajectoryStore->>SemanticProfiles: activate completed target
  SemanticProfiles-->>RebuildCaller: expose new serving profile
Loading

Possibly related issues

Possibly related PRs

  • 100yenadmin/hermes-lcm#175 — Implements the related profile-scoped embedding model, migration, and rebuild regression coverage.
🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Out of Scope Changes check ⚠️ Warning The added PR-verdict markdown report and the token-budget tweak are not required by #179 and look unrelated. Split unrelated documentation and test-only tweaks into separate PRs unless they are necessary for #179.
Docstring Coverage ⚠️ Warning Docstring coverage is 23.53% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title is concise and accurately highlights the main change: profile-scoped state embeddings.
Linked Issues check ✅ Passed The migration, composite PK, staged rebuild cutover, and interruption regressions all match #179's requirements.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/profile-scoped-embeddings

Comment @coderabbitai help to get the list of available commands.

@evaos-code-review-bot

evaos-code-review-bot Bot commented Jul 29, 2026 •

Copy link
Copy Markdown

evaOS review status: completed

PR: #182 - feat(trajectory): profile-scoped state embeddings (#179)
Head: 95d20d0384db203a3a673b6890bce6939b4f829c
Updated: 2026-07-29T10:28:51.249Z

evaOS review completed for this PR head.

Automation note: agents should wait for this comment to reach completed, stale_head, closed_or_merged_before_review, skipped, or failed before treating evaOS review as settled for this head. provider_deferred means evaOS still intends to retry.

PR URL: #182

Review URL: #182 (review)

@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: 95d20d0384

ℹ️ 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 thread trajectory_store.py Outdated

@coderabbitai coderabbitai 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.

Actionable comments posted: 3

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@tests/test_trajectory_state_semantic_expansion.py`:
- Around line 209-259: The helper
_downgrade_state_embeddings_to_legacy_primary_key uses the production migration
staging table name, creating coupling after partial failures. Rename its
temporary table and all corresponding ALTER, INSERT, and DROP references to a
test-local legacy-stage name, while leaving
_migrate_state_semantic_embeddings_to_profile_scope’s staging table unchanged.

In `@trajectory_store.py`:
- Around line 1574-1627: Validate legacy stored_digests against adopted_digest
before migrating in the profile-scoped table. In the migration logic around
adopted_digest and the INSERT into
lcm_trajectory_state_embeddings_profile_scoped, raise TrajectoryStoreError when
any stored digest differs from the adopted digest; otherwise preserve the
existing migration only for rows belonging to the adopted profile.
- Around line 1816-1834: Move the in-place rebuild guard based on
active_state_semantic_profile() and profile_digest inside the self._lock
transaction, after BEGIN IMMEDIATE, so it re-reads the active profile while
staging is protected. Preserve the existing TrajectoryStoreError condition and
message, and ensure the transaction is rolled back or otherwise safely exited
when the guard rejects the rebuild.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 885f1b09-6f44-4ed8-85f5-688bfbd5bf85

📥 Commits

Reviewing files that changed from the base of the PR and between cb92bf4 and 95d20d0.

📒 Files selected for processing (2)
  • tests/test_trajectory_state_semantic_expansion.py
  • trajectory_store.py
📜 Review details
⏰ Context from checks skipped due to timeout. (4)
  • GitHub Check: test (3.11)
  • GitHub Check: test (3.12)
  • GitHub Check: test (3.14)
  • GitHub Check: test (3.13)
🧰 Additional context used
🪛 ast-grep (0.45.0)
tests/test_trajectory_state_semantic_expansion.py

[info] 181-185: use jsonify instead of json.dumps for JSON output
Context: json.dumps(
[hit.to_dict() for hit in hits],
sort_keys=True,
separators=(",", ":"),
)
Note: [CWE-116] Improper Encoding or Escaping of Output.

(use-jsonify)

🔇 Additional comments (7)
tests/test_trajectory_state_semantic_expansion.py (4)

180-186: The use-jsonify hint is a false positive — this is a deterministic in-test digest, not an HTTP response body.

Source: Linters/SAST tools


18-18: LGTM!

Also applies to: 31-31, 189-206


572-606: LGTM!

Also applies to: 609-625, 628-677


680-758: LGTM!

Also applies to: 761-801

trajectory_store.py (3)

1480-1535: LGTM!


1733-1743: LGTM!


1923-1923: LGTM!

Comment thread tests/test_trajectory_state_semantic_expansion.py
Comment thread trajectory_store.py
Comment thread trajectory_store.py Outdated

@evaos-code-review-bot evaos-code-review-bot 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.

Walkthrough

PR: #182 - feat(trajectory): profile-scoped state embeddings (#179)
Head: 95d20d0384db203a3a673b6890bce6939b4f829c into main. Review event: COMMENT.
Provider: GLM/Z.ai through ZCode (zcode-glm, zcode, model GLM-5.2).

Estimated review effort: 2/5 (~24 min)

Changed Files

File Status Churn Purpose Risk
tests/test_trajectory_state_semantic_expansion.py modified +219/-28 Test coverage Elevated: large change
trajectory_store.py modified +170/-43 Changed file Elevated: large change

Review Signal

No validated inline findings.
Dropped findings before posting: 1. High-severity findings: 0.

Risk Taxonomy

No finding categories.

Validation and Proof

No required validation recommendation selected; rely on existing GitHub checks and human review.
Proof status: not_applicable - No required behavior proof selected for this changed surface.
Profile validation hints: Prefer correctness, security, data-loss, release, and regression findings over style-only feedback.
Profile proof expectations: Look for focused validation, rollback notes, and evidence appropriate to the changed surface.

Related Context

Related issues/PRs: #179.
Suggested labels: tests.
Suggested reviewers: none from current metadata.

Review Settings Preview

  • Profile: assertive
  • Enabled sections: Review summary (inline_review); Walkthrough (inline_review); Changed-files table (walkthrough); Effort estimate (walkthrough); Related issues/PRs (walkthrough); Review status comment (sticky_status)
  • Path instructions: none
  • Label suggestions: none
  • Reviewer suggestions: none
  • Suggestion behavior: suggestions only; labels and reviewers are not auto-applied.
  • Roadmap-only settings: auto-apply labels; auto-request reviewers; required status checks

Pre-merge checklist

  • Inline comments target current RIGHT-side diff lines.
  • No secret-like content survived into posted inline comments.
  • REQUEST_CHANGES is only used when eligible P0/P1 findings survive validation.
  • Required behavior proof is present or not applicable.
  • Labels and reviewers are suggestions only; the bot did not auto-apply them.

…h the active profile (refuses otherwise); TOCTOU lock ordering; recovery path documented; test staging-table isolation
@100yenadmin

Copy link
Copy Markdown
Owner Author

Bot findings dispositioned (verdicts in FINDINGS-VERDICTS-BOTS.md): the High is fixed — legacy migration now adopts the active profile's digest ONLY when every stored legacy row is consistent with it; any mixed state refuses with the documented recovery (a fresh backfill IS the recovery, and the error now says so). TOCTOU guard now reads under the lock; test staging-table name isolated. Fail-closed posture preserved throughout.

@evaos-code-review-bot

evaos-code-review-bot Bot commented Jul 29, 2026 •

Copy link
Copy Markdown

evaOS review status: completed

PR: #182 - feat(trajectory): profile-scoped state embeddings (#179)
Head: 5a9259b5f53f04bd91b747c8be9bf420aec30b7c
Updated: 2026-07-29T13:44:49.269Z

evaOS review completed for this PR head.

Automation note: agents should wait for this comment to reach completed, stale_head, closed_or_merged_before_review, skipped, or failed before treating evaOS review as settled for this head. provider_deferred means evaOS still intends to retry.

PR URL: #182

Review URL: #182 (review)

@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: 5a9259b5f5

ℹ️ 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 thread trajectory_store.py
Comment thread trajectory_store.py

@evaos-code-review-bot evaos-code-review-bot 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.

Walkthrough

PR: #182 - feat(trajectory): profile-scoped state embeddings (#179)
Head: 5a9259b5f53f04bd91b747c8be9bf420aec30b7c into main. Review event: COMMENT.
Provider: GLM/Z.ai through ZCode (zcode-glm, zcode, model GLM-5.2).

Estimated review effort: 3/5 (~36 min)

Changed Files

File Status Churn Purpose Risk
FINDINGS-VERDICTS-BOTS.md added +86/-0 Documentation Low
tests/test_trajectory_state_semantic_expansion.py modified +284/-27 Test coverage Moderate: validated P3 finding
trajectory_store.py modified +180/-43 Changed file Elevated: large change

Review Signal

Validated inline findings: 1 (P0: 0, P1: 0, P2: 0, P3: 1).
Dropped findings before posting: 0. High-severity findings: 0.

Risk Taxonomy

  • Proof gap: 1

Validation and Proof

No required validation recommendation selected; rely on existing GitHub checks and human review.
Proof status: not_applicable - No required behavior proof selected for this changed surface.
Profile validation hints: Prefer correctness, security, data-loss, release, and regression findings over style-only feedback.
Profile proof expectations: Look for focused validation, rollback notes, and evidence appropriate to the changed surface.

Related Context

Related issues/PRs: #179.
Suggested labels: docs, tests.
Suggested reviewers: none from current metadata.

Review Settings Preview

  • Profile: assertive
  • Enabled sections: Review summary (inline_review); Walkthrough (inline_review); Changed-files table (walkthrough); Effort estimate (walkthrough); Related issues/PRs (walkthrough); Review status comment (sticky_status)
  • Path instructions: none
  • Label suggestions: none
  • Reviewer suggestions: none
  • Suggestion behavior: suggestions only; labels and reviewers are not auto-applied.
  • Roadmap-only settings: auto-apply labels; auto-request reviewers; required status checks

Pre-merge checklist

  • Inline comments target current RIGHT-side diff lines.
  • No secret-like content survived into posted inline comments.
  • REQUEST_CHANGES is only used when eligible P0/P1 findings survive validation.
  • Required behavior proof is present or not applicable.
  • Labels and reviewers are suggestions only; the bot did not auto-apply them.

Comment thread tests/test_trajectory_state_semantic_expansion.py

@coderabbitai coderabbitai 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.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@FINDINGS-VERDICTS-BOTS.md`:
- Around line 80-81: Replace the inaccessible absolute Evidence directory path
in FINDINGS-VERDICTS-BOTS.md with artifacts stored in an accessible CI location,
or document reproducible commands that regenerate them. Ensure reviewers and CI
can access or reproduce the validation evidence without relying on the local
/Volumes path.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 26fc7d14-fed4-4635-9ff0-7ab611b2675b

📥 Commits

Reviewing files that changed from the base of the PR and between 95d20d0 and 5a9259b.

📒 Files selected for processing (3)
  • FINDINGS-VERDICTS-BOTS.md
  • tests/test_trajectory_state_semantic_expansion.py
  • trajectory_store.py
📜 Review details
⏰ Context from checks skipped due to timeout. (4)
  • GitHub Check: test (3.11)
  • GitHub Check: test (3.12)
  • GitHub Check: test (3.13)
  • GitHub Check: test (3.14)
🧰 Additional context used
🪛 LanguageTool
FINDINGS-VERDICTS-BOTS.md

[grammar] ~42-~42: Ensure spelling is correct
Context: ...primary-key table. ## 3. Rebuild-guard TOCTOU - Source: CodeRabbit discussion `367328318...

(QB_NEW_EN_ORTHOGRAPHY_ERROR_IDS_1)

🔇 Additional comments (2)
trajectory_store.py (1)

1480-1535: LGTM!

Also applies to: 1540-1544, 1597-1606, 1829-1839, 1933-1936

tests/test_trajectory_state_semantic_expansion.py (1)

209-259: LGTM!

Also applies to: 664-724, 808-867

Comment thread FINDINGS-VERDICTS-BOTS.md Outdated
@100yenadmin

Copy link
Copy Markdown
Owner Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jul 29, 2026 •

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

…e; single-statement atomic cutover; positive distinct-profile resume=False coverage; round-2 verdicts
@100yenadmin

Copy link
Copy Markdown
Owner Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jul 29, 2026 •

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@evaos-code-review-bot

evaos-code-review-bot Bot commented Jul 29, 2026 •

Copy link
Copy Markdown

evaOS review status: completed

PR: #182 - feat(trajectory): profile-scoped state embeddings (#179)
Head: 367e9b49735f3442d6bb009c94e386ea3ede5b16
Updated: 2026-07-29T18:03:23.670Z

evaOS review completed for this PR head.

Automation note: agents should wait for this comment to reach completed, stale_head, closed_or_merged_before_review, skipped, or failed before treating evaOS review as settled for this head. provider_deferred means evaOS still intends to retry.

PR URL: #182

Review URL: #182 (review)

@evaos-code-review-bot evaos-code-review-bot 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.

Walkthrough

PR: #182 - feat(trajectory): profile-scoped state embeddings (#179)
Head: 367e9b49735f3442d6bb009c94e386ea3ede5b16 into main. Review event: COMMENT.
Provider: Unregistered provider id (builtin:zai-coding-plan, zcode (registry miss), model unknown).

Estimated review effort: 4/5 (~46 min)

Changed Files

File Status Churn Purpose Risk
FINDINGS-VERDICTS-BOTS.md added +127/-0 Documentation Low
tests/test_trajectory_state_semantic_expansion.py modified +388/-28 Test coverage Elevated: large change
trajectory_store.py modified +229/-50 Changed file Elevated: large change

Review Signal

No validated inline findings.
Dropped findings before posting: 0. High-severity findings: 0.

Risk Taxonomy

No finding categories.

Validation and Proof

No required validation recommendation selected; rely on existing GitHub checks and human review.
Proof status: not_applicable - No required behavior proof selected for this changed surface.
Profile validation hints: Prefer correctness, security, data-loss, release, and regression findings over style-only feedback.
Profile proof expectations: Look for focused validation, rollback notes, and evidence appropriate to the changed surface.

Related Context

Related issues/PRs: #179.
Suggested labels: docs, tests.
Suggested reviewers: none from current metadata.

Review Settings Preview

  • Profile: assertive
  • Enabled sections: Review summary (inline_review); Walkthrough (inline_review); Changed-files table (walkthrough); Effort estimate (walkthrough); Related issues/PRs (walkthrough); Review status comment (sticky_status)
  • Path instructions: none
  • Label suggestions: none
  • Reviewer suggestions: none
  • Suggestion behavior: suggestions only; labels and reviewers are not auto-applied.
  • Roadmap-only settings: auto-apply labels; auto-request reviewers; required status checks

Pre-merge checklist

  • Inline comments target current RIGHT-side diff lines.
  • No secret-like content survived into posted inline comments.
  • REQUEST_CHANGES is only used when eligible P0/P1 findings survive validation.
  • Required behavior proof is present or not applicable.
  • Labels and reviewers are suggestions only; the bot did not auto-apply them.

@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: 367e9b4973

ℹ️ 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 thread trajectory_store.py
Comment thread trajectory_store.py

@coderabbitai coderabbitai 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.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@FINDINGS-VERDICTS-BOTS.md`:
- Around line 120-124: Update the validation environment to generate or provide
the missing agent.context_engine stub so the local full-suite CI-replica command
can complete test collection. Re-run the full 2711-test replica against the
current Round 2 head and update the report with its results, replacing reliance
on the narrower fallback as final sign-off.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 63527104-38b9-460d-950d-8f5bded9f52c

📥 Commits

Reviewing files that changed from the base of the PR and between 5a9259b and 367e9b4.

📒 Files selected for processing (3)
  • FINDINGS-VERDICTS-BOTS.md
  • tests/test_trajectory_state_semantic_expansion.py
  • trajectory_store.py
📜 Review details
⏰ Context from checks skipped due to timeout. (4)
  • GitHub Check: test (3.14)
  • GitHub Check: test (3.11)
  • GitHub Check: test (3.12)
  • GitHub Check: test (3.13)
🔇 Additional comments (6)
trajectory_store.py (1)

1480-1535: LGTM!

Also applies to: 1537-1644, 1806-1835, 1859-1900, 1960-1966, 2069-2087

tests/test_trajectory_state_semantic_expansion.py (3)

837-837: LGTM!

Also applies to: 863-863


1036-1038: LGTM!


907-928: 🎯 Functional Correctness

No issue: observed_staged_counts[0] == 0 is a valid assertion. _emit_progress() runs before _persist(), and the stale rows are deleted and committed before the batch loop starts.

			> Likely an incorrect or invalid review comment.
FINDINGS-VERDICTS-BOTS.md (2)

80-95: LGTM!


96-119: LGTM!

Comment thread FINDINGS-VERDICTS-BOTS.md Outdated
…le is active; matrix readers synchronize across legacy-table replacement; deterministic interleaving regressions
@100yenadmin

Copy link
Copy Markdown
Owner Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jul 29, 2026 •

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@evaos-code-review-bot

evaos-code-review-bot Bot commented Jul 29, 2026 •

Copy link
Copy Markdown

evaOS review status: completed

PR: #182 - feat(trajectory): profile-scoped state embeddings (#179)
Head: 97507904cc9b14e7816b9ddba00d4ed63728fab5
Updated: 2026-07-29T18:25:55.174Z

evaOS review completed for this PR head.

Automation note: agents should wait for this comment to reach completed, stale_head, closed_or_merged_before_review, skipped, or failed before treating evaOS review as settled for this head. provider_deferred means evaOS still intends to retry.

PR URL: #182

Review URL: #182 (review)

@evaos-code-review-bot evaos-code-review-bot 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.

Walkthrough

PR: #182 - feat(trajectory): profile-scoped state embeddings (#179)
Head: 97507904cc9b14e7816b9ddba00d4ed63728fab5 into main. Review event: COMMENT.
Provider: Unregistered provider id (builtin:zai-coding-plan, zcode (registry miss), model unknown).

Estimated review effort: 5/5 (~56 min)

Changed Files

File Status Churn Purpose Risk
FINDINGS-VERDICTS-BOTS.md added +155/-0 Documentation Low
tests/test_trajectory_state_semantic_expansion.py modified +563/-28 Test coverage Elevated: large change
trajectory_store.py modified +267/-74 Changed file Elevated: large change

Review Signal

No validated inline findings.
Dropped findings before posting: 0. High-severity findings: 0.

Risk Taxonomy

No finding categories.

Validation and Proof

No required validation recommendation selected; rely on existing GitHub checks and human review.
Proof status: not_applicable - No required behavior proof selected for this changed surface.
Profile validation hints: Prefer correctness, security, data-loss, release, and regression findings over style-only feedback.
Profile proof expectations: Look for focused validation, rollback notes, and evidence appropriate to the changed surface.

Related Context

Related issues/PRs: #179.
Suggested labels: docs, tests.
Suggested reviewers: none from current metadata.

Review Settings Preview

  • Profile: assertive
  • Enabled sections: Review summary (inline_review); Walkthrough (inline_review); Changed-files table (walkthrough); Effort estimate (walkthrough); Related issues/PRs (walkthrough); Review status comment (sticky_status)
  • Path instructions: none
  • Label suggestions: none
  • Reviewer suggestions: none
  • Suggestion behavior: suggestions only; labels and reviewers are not auto-applied.
  • Roadmap-only settings: auto-apply labels; auto-request reviewers; required status checks

Pre-merge checklist

  • Inline comments target current RIGHT-side diff lines.
  • No secret-like content survived into posted inline comments.
  • REQUEST_CHANGES is only used when eligible P0/P1 findings survive validation.
  • Required behavior proof is present or not applicable.
  • Labels and reviewers are suggestions only; the bot did not auto-apply them.

@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: 97507904cc

ℹ️ 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 thread trajectory_store.py
Comment thread trajectory_store.py
… available; leasing hardening deferred to issue
@evaos-code-review-bot

evaos-code-review-bot Bot commented Jul 29, 2026 •

Copy link
Copy Markdown

evaOS review status: completed

PR: #182 - feat(trajectory): profile-scoped state embeddings (#179)
Head: 7af390c25279c10231e3686c18d402c65fb1a8df
Updated: 2026-07-29T18:36:19.801Z

evaOS review completed for this PR head.

Automation note: agents should wait for this comment to reach completed, stale_head, closed_or_merged_before_review, skipped, or failed before treating evaOS review as settled for this head. provider_deferred means evaOS still intends to retry.

PR URL: #182

Review URL: #182 (review)

@evaos-code-review-bot evaos-code-review-bot 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.

Walkthrough

PR: #182 - feat(trajectory): profile-scoped state embeddings (#179)
Head: 7af390c25279c10231e3686c18d402c65fb1a8df into main. Review event: COMMENT.
Provider: Unregistered provider id (builtin:zai-coding-plan, zcode (registry miss), model unknown).

Estimated review effort: 5/5 (~56 min)

Changed Files

File Status Churn Purpose Risk
FINDINGS-VERDICTS-BOTS.md added +162/-0 Documentation Low
tests/test_trajectory_state_semantic_expansion.py modified +563/-28 Test coverage Elevated: large change
trajectory_store.py modified +269/-74 Changed file Elevated: large change

Review Signal

No validated inline findings.
Dropped findings before posting: 0. High-severity findings: 0.

Risk Taxonomy

No finding categories.

Validation and Proof

No required validation recommendation selected; rely on existing GitHub checks and human review.
Proof status: not_applicable - No required behavior proof selected for this changed surface.
Profile validation hints: Prefer correctness, security, data-loss, release, and regression findings over style-only feedback.
Profile proof expectations: Look for focused validation, rollback notes, and evidence appropriate to the changed surface.

Related Context

Related issues/PRs: #179.
Suggested labels: docs, tests.
Suggested reviewers: none from current metadata.

Review Settings Preview

  • Profile: assertive
  • Enabled sections: Review summary (inline_review); Walkthrough (inline_review); Changed-files table (walkthrough); Effort estimate (walkthrough); Related issues/PRs (walkthrough); Review status comment (sticky_status)
  • Path instructions: none
  • Label suggestions: none
  • Reviewer suggestions: none
  • Suggestion behavior: suggestions only; labels and reviewers are not auto-applied.
  • Roadmap-only settings: auto-apply labels; auto-request reviewers; required status checks

Pre-merge checklist

  • Inline comments target current RIGHT-side diff lines.
  • No secret-like content survived into posted inline comments.
  • REQUEST_CHANGES is only used when eligible P0/P1 findings survive validation.
  • Required behavior proof is present or not applicable.
  • Labels and reviewers are suggestions only; the bot did not auto-apply them.

@100yenadmin

Copy link
Copy Markdown
Owner Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jul 29, 2026 •

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@100yenadmin

Copy link
Copy Markdown
Owner Author

Review-round stopping rule for this train (declared per program rule — red-team amendment 9 pattern): round 5 on the new head is the FINAL full round. From round 5 onward, findings are dispositioned as: real delivery-affecting or P1-severity defects → fixed in-PR; latent hardening, future-proofing, and documentation-class items → fork issues for the next train (as #186 was). This PR is default-off infrastructure; its gate-run obligations (none — no measured surface) are unchanged. All prior rounds: every finding fixed, refuted in writing, or issue-filed, with threads resolved.

@100yenadmin
100yenadmin merged commit fb44759 into main Jul 29, 2026
6 of 7 checks passed

@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: ff52c487b8

ℹ️ 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 thread trajectory_store.py
Comment on lines 2083 to +2085
self._conn.execute(
"UPDATE lcm_trajectory_state_embedding_profiles "
"SET active = 0 WHERE active = 1"
)
self._conn.execute(
"UPDATE lcm_trajectory_state_embedding_profiles "
"SET active = 1 WHERE profile_digest = ?",
(profile_digest,),
"""
INSERT INTO lcm_trajectory_state_embedding_profiles(

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 Recheck completeness inside the cutover transaction

When a concurrent resume=False build deletes this inactive target's staged rows after embedded_count is read but before this transaction begins, this statement still activates the now-empty or partial profile because the cutover never rechecks completeness under BEGIN IMMEDIATE. The other builder is then rejected by _persist because the target is active, leaving an incomplete serving profile that cannot be resumed through this API; repeat the row-count validation inside the cutover transaction before setting active = 1.

Useful? React with 👍 / 👎.

100yenadmin pushed a commit that referenced this pull request Aug 6, 2026
The branch had merged the MAINTAINER's upstream (v0.21.0-rc2) and that was
mistaken for being current. It was not current with OUR main, which carried 56
commits this branch had never seen: V1-M instrument (#199, #198), fts_prose_mode
(#183), profile-scoped trajectory embeddings (#182), query views.

Bidirectional, not a catch-up -- both lines developed the same files in parallel
(tools.py ours=11/theirs=9, vector_store.py 6/8, store.py 5/5), and reasoning.py
and requirements_compiler.py do not exist at the merge base at all. 15 files,
52 hunks. Default resolution was BOTH SIDES: ours' security parameter and
theirs' feature parameter, additively.

## The leak that was in no conflict hunk

Main added a resident-int8 full-corpus fast path (`resident_eligible` ->
`_resident_int8_matrix` -> `_rank_resident_int8`) that sits immediately BEFORE
the sign-bit prescreen block ours guards with `access_scope is None`, and mirrors
that block's eligibility conditions -- without the owner guard. Git auto-merged
it CLEANLY. Our guard survived while a bypass around it landed one branch
earlier, with no conflict marker anywhere and nothing for a diff review to catch.

The resident matrix is a whole-identity snapshot pooled and cached on
(identity, data_version) only, so it cannot express a per-row owner predicate.
Filtering inside it is not an option; routing around it is, exactly as ours
already does for the binary prescreen. Both arms now carry `access_scope is None`.

## The trap that WAS in a conflict hunk

Main refactored the message-search call to `**message_search_kwargs`, and that
dict carried every field ours listed EXCEPT `access_scope`. Taking main's side
verbatim silently unscopes message search -- every principal reads every other
principal's memory, with all tests green. Carried into the new form.

## Reconciling two independent models of reasoning.py

`resolve_occurrence_time_with_trust(session_date=...)` served two roles at once:
theirs' caller-DECLARED anchor (the term the sidecar is compared against to
detect disagreement) and the term the occurrence is RESOLVED against. Ours needs
the resolution anchor to be host-derived and a caller's declaration to be
evidence-free. No single ordering satisfies both: map-first defeats the override
check entirely, because tools.py sources that map from
`engine._session_occurrence_dates` -- the sidecar's own attribute -- so anchor
and sidecar were always equal; declared-first lets a caller relabel a stored
observation. Split into two parameters, precedence sidecar > trusted > declared.

Main's `"auto"` interval-unit sentinel is replaced by `interval_unit_fixed`, so
"the plan's unit" and "the reported unit" decouple and both sides' tests hold.

## Verified, not asserted

  real-data battery      16/16, identical to the pre-merge baseline
  default-off A/B        22/22 byte-identical to stock origin/main
  compile                224 files, 0 syntax errors
  suite                  21 failed / 3234 passed (from 35/3008 pre-merge)

The 4b gate also did its job on this merge: it failed closed on six new
resident-invalidation triggers and on a `benchmarking/` harness the exclusion
list had missed (the -ing spelling was never added alongside bench/benchmarks).
Both classified rather than waived.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

profile-scoped state embeddings: (profile_digest, state_id) identity — prerequisite for rebuild availability

1 participant