Skip to content

fix(registry): drop legacy credential hash rows - #6611

Merged
cv merged 7 commits into
NVIDIA:mainfrom
HOYALIM:codex/issue-3631-telegram-token-hash-upsert
Jul 11, 2026
Merged

fix(registry): drop legacy credential hash rows#6611
cv merged 7 commits into
NVIDIA:mainfrom
HOYALIM:codex/issue-3631-telegram-token-hash-upsert

Conversation

@HOYALIM

@HOYALIM HOYALIM commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Drop legacy providerCredentialHashes buckets when sandbox registry rows are rewritten.
  • Preserve the current messaging plan credential binding as the durable source of truth.
  • Add a regression test that starts from a legacy Telegram hash row and proves the next registry update removes the stale bucket without losing the current binding.

Rationale

Current main stores messaging credential fingerprints on messaging.plan.credentialBindings, but older registry rows can still contain a legacy providerCredentialHashes field. If that legacy field survives later registry writes, token rotation can appear to retain duplicate credential-hash state. This keeps the canonical binding and removes the legacy bucket during normal registry serialization.

Refs #3631

Validation

  • npm ci
  • npx vitest run --project integration test/registry.test.ts
  • git diff --check origin/main...HEAD
  • npx prek run --files src/lib/state/registry.ts test/registry.test.ts --stage pre-commit
  • npx prek run --from-ref origin/main --to-ref HEAD --stage pre-commit
  • npx commitlint --from origin/main --to HEAD

Signed-off-by: Ho Lim subhoya@gmail.com

Summary by CodeRabbit

  • Bug Fixes
    • When updating sandbox settings, legacy/transient credential metadata is no longer persisted, preventing stale credential hashes from remaining in saved entries.
    • Messaging sandbox updates now rewrite credential bindings to retain only the current, expected credential hash.
  • Tests
    • Added coverage to verify legacy credential metadata is dropped and messaging rows are rewritten correctly during sandbox updates.

Signed-off-by: Ho Lim <subhoya@gmail.com>
Copilot AI review requested due to automatic review settings July 9, 2026 22:45
@copy-pr-bot

copy-pr-bot Bot commented Jul 9, 2026

Copy link
Copy Markdown

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@coderabbitai

coderabbitai Bot commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: e4f804ae-5742-4a06-aabe-a888b7e29d53

📥 Commits

Reviewing files that changed from the base of the PR and between ac989b6 and 3a09e94.

📒 Files selected for processing (1)
  • src/lib/state/registry.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/lib/state/registry.ts

📝 Walkthrough

Walkthrough

Sandbox persistence now removes legacy providerCredentialHashes during serialization. A registry test verifies messaging sandbox rewrites discard the legacy field and retain the updated credential binding.

Changes

Sandbox persistence

Layer / File(s) Summary
Remove legacy credential hashes
src/lib/state/registry.ts, test/registry.test.ts
Serialization omits providerCredentialHashes, while the messaging rewrite test verifies removal of the old field and retention of the new credential hash.

Estimated code review effort: 2 (Simple) | ~10 minutes

Possibly related PRs

  • NVIDIA/NemoClaw#5410: Both changes remove or preserve providerCredentialHashes across sandbox registry persistence and rewrites.

Suggested labels: area: messaging, area: sandbox

Suggested reviewers: cv

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 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 reflects the main change: dropping legacy credential hash rows in registry serialization.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
src/lib/state/registry.ts (1)

438-452: 🗄️ Data Integrity & Integration | 🔵 Trivial | 💤 Low value

Call out providerCredentialHashes in the persistence note. The inline comment only mentions the transient recovery markers, but this strip also removes legacy persisted providerCredentialHashes; a short wording tweak would make the intent clearer.

🤖 Prompt for 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.

In `@src/lib/state/registry.ts` around lines 438 - 452, Update the inline comment
above serializeSandboxEntryForDisk to explicitly mention that legacy persisted
providerCredentialHashes is also removed, alongside the transient recovery
markers. Keep the note concise and clarify that all listed fields are excluded
from durable sandboxes.json output.
🤖 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.

Nitpick comments:
In `@src/lib/state/registry.ts`:
- Around line 438-452: Update the inline comment above
serializeSandboxEntryForDisk to explicitly mention that legacy persisted
providerCredentialHashes is also removed, alongside the transient recovery
markers. Keep the note concise and clarify that all listed fields are excluded
from durable sandboxes.json output.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: d28a08bf-482a-4792-aede-f4fe80185a10

📥 Commits

Reviewing files that changed from the base of the PR and between ad518b3 and ac989b6.

📒 Files selected for processing (2)
  • src/lib/state/registry.ts
  • test/registry.test.ts

Signed-off-by: Ho Lim <subhoya@gmail.com>
@github-actions

github-actions Bot commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

E2E Advisor Recommendation

Required E2E: onboard-repair, onboard-resume
Optional E2E: messaging-providers, credential-migration

Dispatch hint: onboard-repair,onboard-resume

Workflow run

Full advisor summary

E2E Recommendation Advisor

Base: target/main
Head: HEAD
Confidence: high

Required E2E

  • onboard-repair (high): Required by the deterministic lifecycle-state risk plan for registry persistence changes: verifies repair convergence across persisted metadata, gateway/sandbox state, cleanup ownership, and session repair behavior.
  • onboard-resume (medium): Required by the deterministic lifecycle-state risk plan for registry persistence changes: verifies interrupted onboarding can resume using cached state without stale registry/session metadata breaking the live sandbox flow.

Optional E2E

  • messaging-providers (high): Useful adjacent confidence because the changed serializer specifically removes legacy providerCredentialHashes while preserving messaging credentialBindings; this job exercises real messaging provider credential registration, registry state, policy, and runtime proofs.
  • credential-migration (medium): Optional credential-boundary smoke for registry/credential persistence interactions. It does not directly cover legacy providerCredentialHashes, but validates live credential migration through the OpenShell gateway and removal of unsafe plaintext state.

New E2E recommendations

  • credentials-messaging-registry (medium): No existing E2E appears to directly seed a legacy sandbox row with providerCredentialHashes, perform a live rewrite/update, and assert the legacy hashes are removed while messaging.plan.credentialBindings remain intact.
    • Suggested test: Add a focused live or credential-free E2E regression for legacy messaging providerCredentialHashes registry rewrite during sandbox update/rebuild.

Dispatch hint

  • Workflow: .github/workflows/e2e.yaml
  • jobs input: onboard-repair,onboard-resume

@github-actions

github-actions Bot commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

E2E Target Recommendation

Required E2E targets: onboard-repair, onboard-resume
Optional E2E targets: None

Dispatch required E2E targets:

  • gh workflow run e2e.yaml --ref <pr-head-ref> --field jobs=onboard-repair
  • gh workflow run e2e.yaml --ref <pr-head-ref> --field jobs=onboard-resume

Workflow run

Full E2E target advisor summary

E2E Target Advisor

Base: target/main
Head: HEAD
Confidence: high

Required E2E targets

  • onboard-repair: Onboarding and sandbox state must converge across persisted metadata, reported status, and the live runtime.
    • Dispatch: gh workflow run e2e.yaml --ref <pr-head-ref> --field jobs=onboard-repair
  • onboard-resume: Onboarding and sandbox state must converge across persisted metadata, reported status, and the live runtime.
    • Dispatch: gh workflow run e2e.yaml --ref <pr-head-ref> --field jobs=onboard-resume

Optional E2E targets

  • None.

Relevant changed files

  • src/lib/state/registry.ts

@prekshivyas prekshivyas self-assigned this Jul 11, 2026
@cv cv added the v0.0.81 label Jul 11, 2026
@prekshivyas

prekshivyas commented Jul 11, 2026

Copy link
Copy Markdown
Collaborator

PR Review Advisor — No blocking findings

Merge posture: No blocking advisor findings
Primary next action: Add or justify PRA-T1 and any related test follow-ups.
Open items: 0 required · 0 warnings · 0 suggestions · 8 test follow-ups

Action checklist

  • PRA-T1 Add or justify test follow-up: Runtime validation
  • PRA-T2 Add or justify test follow-up: Runtime validation
  • PRA-T3 Add or justify test follow-up: Runtime validation
  • PRA-T4 Add or justify test follow-up: Runtime validation
  • PRA-T5 Add or justify test follow-up: Acceptance clause
  • PRA-T6 Add or justify test follow-up: Acceptance clause
  • PRA-T7 Add or justify test follow-up: Acceptance clause
  • PRA-T8 Add or justify test follow-up: Acceptance clause
Test follow-ups to resolve or justify

If these cover changed behavior, prefer adding them in this PR; otherwise state why existing coverage is enough or link the follow-up.

  • PRA-T1 Runtime validation — Run the `onboard-repair` E2E job for Onboarding and sandbox state must converge across persisted metadata, reported status, and the live runtime. Matched files: `src/lib/state/registry.ts`.. Deterministic regression risks require live validation: lifecycle-state. Checked-in unit coverage is sufficient for the changed serialization behavior, but the risk plan classifies the touched registry file under lifecycle-state, where onboard-resume and onboard-repair remain appropriate runtime validation floors.
  • PRA-T2 Runtime validation — Run the onboard-repair E2E job for lifecycle-state convergence around persisted registry rewrites involving legacy credential metadata.. Deterministic regression risks require live validation: lifecycle-state. Checked-in unit coverage is sufficient for the changed serialization behavior, but the risk plan classifies the touched registry file under lifecycle-state, where onboard-resume and onboard-repair remain appropriate runtime validation floors.
  • PRA-T3 Runtime validation — Run the `onboard-resume` E2E job for Onboarding and sandbox state must converge across persisted metadata, reported status, and the live runtime. Matched files: `src/lib/state/registry.ts`.. Deterministic regression risks require live validation: lifecycle-state. Checked-in unit coverage is sufficient for the changed serialization behavior, but the risk plan classifies the touched registry file under lifecycle-state, where onboard-resume and onboard-repair remain appropriate runtime validation floors.
  • PRA-T4 Runtime validation — Run the onboard-resume E2E job for lifecycle-state convergence around persisted registry rewrites involving legacy credential metadata.. Deterministic regression risks require live validation: lifecycle-state. Checked-in unit coverage is sufficient for the changed serialization behavior, but the risk plan classifies the touched registry file under lifecycle-state, where onboard-resume and onboard-repair remain appropriate runtime validation floors.
  • PRA-T5 Acceptance clause — Terminal output includes a message such as: Messaging credential(s) rotated: TELEGRAM_BOT_TOKEN — add test evidence or identify existing coverage. This PR does not change terminal-output code. The changed files are limited to registry serialization and registry tests; runtime onboard validation remains recommended.
  • PRA-T6 Acceptance clause — And: Rebuilding sandbox to propagate new credentials to the L7 proxy... — add test evidence or identify existing coverage. This PR does not change rebuild-output or L7 proxy propagation code. Runtime lifecycle validation via the required jobs remains recommended.
  • PRA-T7 Acceptance clause — Onboard exits with status 0 and no error. — add test evidence or identify existing coverage. No live onboard execution was observed or claimed. The checked-in evidence covers the registry rewrite sub-behavior.
  • PRA-T8 Acceptance clause — nemoclaw status shows the sandbox as healthy and ready after the rebuild. — add test evidence or identify existing coverage. No status/probe code is changed in this PR, and no live status validation was observed or claimed.

Workflow run details

This is an automated, non-binding review; it still expects maintainers and agents to respond to each required or warning item. Treat suggestions as current-PR improvements when they touch changed code; defer only with maintainer rationale or a linked follow-up. A human maintainer must make the final merge decision.

@prekshivyas

prekshivyas commented Jul 11, 2026

Copy link
Copy Markdown
Collaborator

PR Review Advisor (Nemotron Ultra) — No blocking findings

Merge posture: No blocking advisor findings
Primary next action: Add or justify PRA-T1 and any related test follow-ups.
Open items: 0 required · 0 warnings · 0 suggestions · 4 test follow-ups
Since last review: 0 prior items resolved · 0 still apply · 0 new items found

Action checklist

  • PRA-T1 Add or justify test follow-up: Runtime validation
  • PRA-T2 Add or justify test follow-up: Runtime validation
  • PRA-T3 Add or justify test follow-up: Acceptance clause
  • PRA-T4 Add or justify test follow-up: Acceptance clause
Test follow-ups to resolve or justify

If these cover changed behavior, prefer adding them in this PR; otherwise state why existing coverage is enough or link the follow-up.

  • PRA-T1 Runtime validation — Run the `onboard-repair` E2E job for Onboarding and sandbox state must converge across persisted metadata, reported status, and the live runtime. Matched files: `src/lib/state/registry.ts`.. Deterministic regression risks require live validation: lifecycle-state. Deterministic regression risks in lifecycle-state invariant require live validation via onboard-repair/onboard-resume E2E jobs. Unit test covers changed serialization behavior; existing messaging tests implicitly cover absent-legacy-field path.
  • PRA-T2 Runtime validation — Run the `onboard-resume` E2E job for Onboarding and sandbox state must converge across persisted metadata, reported status, and the live runtime. Matched files: `src/lib/state/registry.ts`.. Deterministic regression risks require live validation: lifecycle-state. Deterministic regression risks in lifecycle-state invariant require live validation via onboard-repair/onboard-resume E2E jobs. Unit test covers changed serialization behavior; existing messaging tests implicitly cover absent-legacy-field path.
  • PRA-T3 Acceptance clause — New hash matches rotated token ([Nemoclaw][All Platforms]Telegram token rotation leaves duplicate providerCredentialHashes entries instead of updating a single hash (sandbox registry drift) #3631) — add test evidence or identify existing coverage. Orthogonal to this PR — rotation writer logic not modified; serializer only preserves canonical credentialBindings hash.
  • PRA-T4 Acceptance clause — Sandbox healthy after rotation ([Nemoclaw][All Platforms]Telegram token rotation leaves duplicate providerCredentialHashes entries instead of updating a single hash (sandbox registry drift) #3631) — add test evidence or identify existing coverage. Orthogonal to this PR — onboard/rotation flow not modified.

Workflow run details

This is an automated, non-binding review; it still expects maintainers and agents to respond to each required or warning item. Treat suggestions as current-PR improvements when they touch changed code; defer only with maintainer rationale or a linked follow-up. A human maintainer must make the final merge decision.

@github-actions

Copy link
Copy Markdown
Contributor

E2E Target Results — ✅ All requested jobs passed

Run: 29144624012
Workflow ref: tmp/e2e/pr-6611-registry-3a09e94f
Requested targets: (default — all supported)
Requested jobs: onboard-repair,onboard-resume,token-rotation
Summary: 3 passed, 0 failed, 0 cancelled, 0 skipped

Job Result
onboard-repair ✅ success
onboard-resume ✅ success
token-rotation ✅ success

@cv cv left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Approved on exact head 3a09e94. All five required checks pass; DCO/signatures are verified; CodeRabbit has no unresolved threads; trusted advisor run 29144488094 has both exact-head models at merge_as_is with zero findings. Exact trusted E2E run 29144624012 passed onboard-repair, onboard-resume, and token-rotation. Canceled commit-lint/DCO contexts are superseded duplicates, and advisor comment-provenance formatting does not invalidate the exact artifacts.

@cv
cv merged commit 6eeaa69 into NVIDIA:main Jul 11, 2026
38 checks passed
Hadar301 pushed a commit to Hadar301/NemoClaw-OpenShift that referenced this pull request Jul 12, 2026
## Summary
- Drop legacy `providerCredentialHashes` buckets when sandbox registry
rows are rewritten.
- Preserve the current messaging plan credential binding as the durable
source of truth.
- Add a regression test that starts from a legacy Telegram hash row and
proves the next registry update removes the stale bucket without losing
the current binding.

## Rationale
Current main stores messaging credential fingerprints on
`messaging.plan.credentialBindings`, but older registry rows can still
contain a legacy `providerCredentialHashes` field. If that legacy field
survives later registry writes, token rotation can appear to retain
duplicate credential-hash state. This keeps the canonical binding and
removes the legacy bucket during normal registry serialization.

Refs NVIDIA#3631

## Validation
- `npm ci`
- `npx vitest run --project integration test/registry.test.ts`
- `git diff --check origin/main...HEAD`
- `npx prek run --files src/lib/state/registry.ts test/registry.test.ts
--stage pre-commit`
- `npx prek run --from-ref origin/main --to-ref HEAD --stage pre-commit`
- `npx commitlint --from origin/main --to HEAD`

Signed-off-by: Ho Lim <subhoya@gmail.com>


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

* **Bug Fixes**
* When updating sandbox settings, legacy/transient credential metadata
is no longer persisted, preventing stale credential hashes from
remaining in saved entries.
* Messaging sandbox updates now rewrite credential bindings to retain
only the current, expected credential hash.
* **Tests**
* Added coverage to verify legacy credential metadata is dropped and
messaging rows are rewritten correctly during sandbox updates.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Signed-off-by: Ho Lim <subhoya@gmail.com>
Co-authored-by: Carlos Villela <cvillela@nvidia.com>
@wscurran wscurran added area: sandbox OpenShell sandbox lifecycle, runtime, config, or recovery bug-fix PR fixes a bug or regression labels Jul 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: sandbox OpenShell sandbox lifecycle, runtime, config, or recovery bug-fix PR fixes a bug or regression

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants