Skip to content

fix(state): make lifecycle lock timeouts side-effect free - #7859

Merged
jyaunches merged 59 commits into
NVIDIA:mainfrom
HOYALIM:codex/mcp-lock-deadline
Aug 6, 2026
Merged

fix(state): make lifecycle lock timeouts side-effect free#7859
jyaunches merged 59 commits into
NVIDIA:mainfrom
HOYALIM:codex/mcp-lock-deadline

Conversation

@HOYALIM

@HOYALIM HOYALIM commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

Summary

Make the Model Context Protocol (MCP) lifecycle-lock timeout a fail-closed mutation boundary. After the monotonic acquisition deadline passes, NemoClaw preserves existing lock generations and does not enter the critical section.

Related Issue

Fixes #7858

Changes

  • Recheck the monotonic deadline before stale-lock reaping and lock publication.
  • Apply the deadline to synchronous publication, critical-section entry, containment, and reclamation.
  • Release only the newly published lock generation when publication crosses the deadline.
  • Restore a claimed stale generation without overwriting a replacement when reclamation crosses the deadline.
  • Keep corrupt lock directories non-reclaimable because the hard-link restoration protocol cannot restore them without overwriting state.
  • Use a deterministic monotonic clock in regression tests.

Type of Change

  • Code change (feature, bug fix, or refactor)
  • Code change with doc updates
  • Doc only (prose changes, no code sample modifications)
  • Doc only (includes code sample changes)

Quality Gates

  • Tests added or updated for changed behavior
  • Existing tests cover changed behavior — justification:
  • Tests not applicable — justification:
  • Docs updated for user-facing behavior changes
  • Docs not applicable — justification: The change preserves the timeout contract and does not change a command, option, output, configuration, or operator workflow.
  • Sensitive paths changed (security, policy, credentials, preflight, onboarding, inference, runner, sandbox, or messaging)
  • Sensitive-path review completed or maintainer-approved waiver recorded — reviewer/approval link/justification: An independent nine-category security review passed with no findings for current PR commit 4f8e3b8c6287491471e6bc50a6d43f9e1dea76ef against base SHA db31c286129e878c3356eed49f76ab259561e47e. The detailed receipt appears below.
  • Non-success, skipped, or missing CI check accepted by maintainer — check name, approval link, and follow-up issue:

Documentation Writer Review

  • Documentation writer subagent reviewed the completed changes
  • Result: no-docs-needed
  • Evidence: Reviewed all nine changed files at PR commit 4f8e3b8c6 against base SHA db31c2861. The change enforces the documented MCP lifecycle-lock timeout contract, and the named test helper preserves the deadline-handoff behavior without changing a user-facing API, command, configuration, or recovery procedure.
  • Agent: Codex Desktop

DGX Station Hardware Evidence

  • Tested on DGX Station
  • Tested commit: Not applicable
  • Station profile/scenario: Not applicable
  • Result: Not applicable
  • Supporting evidence: scripts/prepare-dgx-station-host.sh does not change.

Verification

  • PR description includes a Signed-off-by: line and every commit appears as Verified in GitHub — all 59 commits appear as Verified.
  • Normal pre-commit, commit-msg, and pre-push hooks passed, or npm run validate:pr passed after refreshing origin/main when hooks were skipped or unavailable — normal hooks passed, including repository checks, source-shape and test-size budgets, gitleaks, commit lint, and the CLI pre-push type check.
  • Targeted behavior tests pass for the current change set, or tests are marked not applicable above — local test suites were not repeated; GitHub Actions is authoritative for the current PR commit.
  • Applicable broad gate passed — required GitHub Actions checks are in progress.
  • Quality Gates section completed with required justifications or waivers
  • No secrets, API keys, or credentials committed — the independent security review passed all nine categories.
  • npm run docs builds without warnings (doc changes only)
  • Doc pages follow the style guide (doc changes only)
  • New doc pages include SPDX header and frontmatter (new pages only)

Sensitive-Path Security Review

Verdict: PASS. The review found no security findings for current PR commit 4f8e3b8c6287491471e6bc50a6d43f9e1dea76ef against base SHA db31c286129e878c3356eed49f76ab259561e47e.

  • Secrets and Credentials — PASS: No secret, credential, or connection-string material changes.
  • Input Validation and Data Sanitization — PASS: The change does not add an untrusted-input parser or weaken path validation.
  • Authentication and Authorization — PASS: The change does not add or alter an authentication or authorization surface.
  • Dependencies and Third-Party Libraries — PASS: The change adds no dependency.
  • Error Handling and Logging — PASS: Deadline failures remain fail-closed, and cleanup does not expose sensitive state.
  • Cryptography and Data Protection — PASS: The change does not add or alter cryptography or sensitive-data storage.
  • Configuration and Security Headers — PASS: The change does not alter runtime exposure, permissions, container settings, or HTTP headers.
  • Security Testing — PASS: Deterministic tests cover publication, reclamation, containment, callback handoff, and critical-section deadline boundaries.
  • System Security — PASS: The mutation deadline is enforced at each state transition, and rollback avoids overwriting a replacement lock generation.

Files reviewed: src/lib/state/mcp-lifecycle-lock-acquisition.test.ts, src/lib/state/mcp-lifecycle-lock-acquisition.ts, src/lib/state/mcp-lifecycle-lock-identity.test.ts, src/lib/state/mcp-lifecycle-lock-identity.ts, src/lib/state/mcp-lifecycle-lock-storage.ts, test/e2e/support/messaging-compatible-endpoint-helpers.test.ts, test/helpers/mcp-lifecycle-lock-deadline-clock.ts, test/helpers/mcp-lifecycle-lock-properties.ts, and test/mcp-lifecycle-lock.test.ts.

GitHub Actions

GitHub Actions is authoritative for current PR commit 4f8e3b8c6287491471e6bc50a6d43f9e1dea76ef against base SHA db31c286129e878c3356eed49f76ab259561e47e. Required checks are running, GitHub reports merge state BLOCKED, and no check waiver is recorded.


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

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

copy-pr-bot Bot commented Jul 30, 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 30, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

MCP lifecycle lock acquisition now uses an injectable monotonic clock and fixed deadline guards across observation, stale-lock reclamation, publication, reaper admission, and critical-section entry. Reclaimed generations are restored when a post-claim deadline check fails. Tests cover these boundaries.

Changes

MCP lock timeout enforcement

Layer / File(s) Summary
Lock observation and restoration contract
src/lib/state/mcp-lifecycle-lock-identity.ts, src/lib/state/mcp-lifecycle-lock-storage.ts, src/lib/state/mcp-lifecycle-lock-identity.test.ts, test/helpers/mcp-lifecycle-lock-properties.ts
Lock observations now identify reclaimable paths. Non-reclaimable paths remain in the wait state. Stale-generation reclamation restores claimed generations when post-claim checks fail.
Deadline-aware lock admission
src/lib/state/mcp-lifecycle-lock-acquisition.ts
Acquisition uses a fixed monotonic deadline. Deadline assertions guard stale reaping, reaper admission, publication, and critical-section entry. The acquired lock is released when final admission fails.
Deadline regression coverage
test/mcp-lifecycle-lock.test.ts
Adds deterministic tests for corrupt-lock preservation, publication timeout cleanup, stale main-lock restoration, stale reaper restoration, directory preservation, and critical-section suppression.

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

Sequence Diagram(s)

sequenceDiagram
  participant Caller
  participant acquireMcpLifecycleLock
  participant LockStorage
  participant CriticalSection
  Caller->>acquireMcpLifecycleLock: Request lock with timeout
  acquireMcpLifecycleLock->>LockStorage: Observe or reclaim lock generation
  LockStorage-->>acquireMcpLifecycleLock: Return state or restore generation
  acquireMcpLifecycleLock->>acquireMcpLifecycleLock: Assert monotonic deadline
  acquireMcpLifecycleLock->>CriticalSection: Enter protected operation before deadline
Loading
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed The changes implement fail-closed timeout handling, preserve existing lock generations, prevent late critical-section entry, and add deterministic regression tests for issue #7858.
Out of Scope Changes check ✅ Passed All code and test changes directly support the lifecycle-lock timeout requirements in issue #7858.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the primary change: preventing lifecycle-lock timeout handling from causing side effects.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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

@github-actions

github-actions Bot commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

PR Review Advisor — No blocking findings reported

Advisor assessment: No blocking advisor findings reported
Next action: No advisor follow-up needed.
Findings: 0 blockers · 0 warnings · 0 suggestions

Model lanes

  • GPT-5.6 Terra (primary): Completed · medium confidence · 0 blockers · 0 warnings · 0 suggestions
  • Nemotron 3 Ultra (second opinion): Failed after a partial review · low confidence · 0 blockers · 0 warnings · 0 suggestions

Second-opinion terminology and E2E selections are advisory. They do not change the primary assessment or E2E / PR Gate.

2 semantic terminology decisions

Terminology decisions are advisory. They affect the assessment only when a separate finding identifies concrete semantic impact.

  • established — monotonic clock at src/lib/state/mcp-lifecycle-lock-acquisition.ts:82: Keep the established term.
  • justified — reclaimable at src/lib/state/mcp-lifecycle-lock-identity.ts:36: Keep this lock-specific field name and its directory contrast.

E2E guidance

Advisory only. E2E / PR Gate selects and runs jobs independently.

Recommended E2E: onboard-repair, onboard-resume

Workflow run details

This automated review informs maintainers. Warnings and suggestions do not require a response. A maintainer decides whether to merge.

Signed-off-by: Ho Lim <subhoya@gmail.com>
@wscurran wscurran added area: architecture Architecture, design debt, major refactors, or maintainability bug-fix PR fixes a bug or regression labels Aug 3, 2026
@wscurran

wscurran commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

✨ Thanks for the PR. This fixes the lifecycle lock timeout regression by making it a fail-closed mutation boundary with deterministic tests. Maintainers will review the lock generation preservation and critical-section entry logic.


Related open issues:

@github-actions github-actions Bot added v0.0.102 and removed v0.0.101 labels Aug 3, 2026
@prekshivyas prekshivyas self-assigned this Aug 3, 2026
@HOYALIM

HOYALIM commented Aug 3, 2026

Copy link
Copy Markdown
Contributor Author

@cv @NVIDIA/nemoclaw-maintainer Could you please help with the protected E2E disposition for exact head 19f17ff?

  • The ordinary reported checks are green.
  • There are no active non-outdated review threads or exact-head human change requests.
  • E2E / PR Gate failed only after timing out for roughly six hours while waiting for the trusted verdict from coordination run 90748626027.

I cannot authorize or repair that trusted-run path from the fork. I will keep this head unchanged so checks are not reset again. Please either authorize/retrigger the repository-supported E2E path for this exact head, identify any remaining code or evidence blocker I can address, or mark the PR superseded if its outcome is no longer wanted.

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

Blocking finding confirmed at exact head 19f17ff: the change promises side-effect-free lifecycle-lock timeouts, but stale main-lock and reaper reclamation only check the deadline before awaiting reclaimStaleMcpLifecycleLockGeneration. If the asynchronous rename or deletion crosses the deadline, a pre-existing lock generation is still removed after the timeout boundary. That deterministically violates the stated fail-closed purpose and can admit a conflicting lifecycle mutation. Please make reclamation deadline-aware across the mutation boundary: re-check after the atomic claim and restore the claimed generation without overwriting any replacement when the deadline has expired, then reject with the timeout. Add deterministic main-lock and reaper tests that advance the injected monotonic clock during reclamation and prove the original generation remains. The existing advisor finding documents the same location, so I am not duplicating an inline comment.

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

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

Actionable comments posted: 1

🧹 Nitpick comments (1)
test/mcp-lifecycle-lock.test.ts (1)

498-498: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Append (#7858) to both test titles. The enclosing describe title does not provide the required issue suffix.

🤖 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 `@test/mcp-lifecycle-lock.test.ts` at line 498, Append "(`#7858`)" to the title
of the test beginning with "restores a stale main lock when reclamation crosses
the deadline", and update the other test title in the same test file similarly
so both titles include the required issue suffix.

Sources: Coding guidelines, Learnings

🤖 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 `@src/lib/state/mcp-lifecycle-lock-storage.ts`:
- Around line 100-109: Update restoreClaimedMcpLifecycleLockGeneration to
restore quarantined directories as well as regular files, replacing the
hard-link-only approach with a path-type-compatible restoration strategy and
preserving cleanup/error handling. Ensure the canonical lock path is restored
when deadline assertion fails, and add a timeout test covering a corrupt
directory.

---

Nitpick comments:
In `@test/mcp-lifecycle-lock.test.ts`:
- Line 498: Append "(`#7858`)" to the title of the test beginning with "restores a
stale main lock when reclamation crosses the deadline", and update the other
test title in the same test file similarly so both titles include the required
issue suffix.
🪄 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: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 96c2168c-1811-49bf-a748-286d2404d5f4

📥 Commits

Reviewing files that changed from the base of the PR and between 19f17ff and de98a7d.

📒 Files selected for processing (3)
  • src/lib/state/mcp-lifecycle-lock-acquisition.ts
  • src/lib/state/mcp-lifecycle-lock-storage.ts
  • test/mcp-lifecycle-lock.test.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/lib/state/mcp-lifecycle-lock-acquisition.ts

Comment thread src/lib/state/mcp-lifecycle-lock-storage.ts

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

Re-reviewed the current revision after the requested deadline fix. Both stale-main-lock and stale-reaper reclamation now perform a post-claim deadline assertion; if the deadline was crossed, the claimed generation is restored to its canonical path before the timeout propagates. Regression tests force the clock past the deadline immediately after rename and confirm the callback is not entered and the original owner token is restored. The exact-head advisor reports no blocking findings. The remaining growth-guardrail failure concerns two if statements in the new test setup and is nonblocking test-structure cleanup. The prior blocking correctness finding is resolved, and I found no new blocking defect.

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

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

Re-reviewed the latest revision. It preserves the resolved post-claim deadline behavior and now marks directory observations non-reclaimable, so a corrupt directory at either lock path is waited on and reported by timeout instead of being renamed into a form the hard-link restoration protocol cannot restore. Other file, symlink, and parsed-owner generations retain the existing reclaim behavior. The new regression confirms the directory remains intact; the small test-structure rewrite also satisfies the conditional guardrail without weakening assertions. No new blocking correctness, security, compatibility, or regression defect found.

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

Approve — re-reviewed exact head e495e8d. The only change since the covered merge head adds issue references to five existing test titles; it does not alter product logic, fixtures, assertions, or the resolved post-claim deadline and directory-reclamation behavior. No new blocking correctness, security, compatibility, test, or regression defect was introduced.

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

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

Approve — re-reviewed exact head ce22702 after its mainline merge. The sole PR-specific conflict resolution correctly awaits stale-generation reclamation inside the try block, so the finally clause cannot release the reaper generation while async claim, deadline validation, or restoration is still in flight. This preserves the previously reviewed post-claim deadline and fail-closed restoration guarantees. Both exact-head advisor lanes and the growth guardrail pass. No blocking correctness, security, compatibility, or regression defect found.

@cjagwani

cjagwani commented Aug 4, 2026

Copy link
Copy Markdown
Collaborator

Exact-head infrastructure disposition for ce22702: both advisor lanes and the visible required checks are green, but E2E / PR Gate Coordination has remained in progress with title Waiting for PR CI since 02:16 UTC. The controller waited nearly six hours and then timed out at 08:14 UTC without a selected E2E verdict. This is a stuck coordination state rather than a reported product-test failure. Please use the supported coordination retrigger/recovery path for this exact head; I am not creating a branch commit or treating the timeout as passing evidence.

Signed-off-by: Charan Jagwani <cjagwani@nvidia.com>
Signed-off-by: Charan Jagwani <cjagwani@nvidia.com>

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

Security review — exact head d12c4523980d7958fdacf72a9397c502b059f6ee against base 7f429e3588d545398411dd9caae92938eaac1853: PASS with no findings.

  1. Secrets and credentials — PASS. No secret, credential, logging, or environment behavior changes.
  2. Input validation and injection resistance — PASS. Lock metadata remains schema-validated and identity-bound. Timeout and deadline checks use the existing bounded monotonic-time inputs and do not introduce command or path interpolation.
  3. Authentication and authorization — PASS. Ownership remains tied to the exact lifecycle-lock generation and process identity; no caller gains authority over another operation's lock.
  4. Dependencies and supply chain — PASS. No dependency, lockfile, image, or external source change.
  5. Error handling and information exposure — PASS. Timeout paths restore a claimed stale generation only when doing so cannot overwrite a replacement; ambiguous or corrupt state remains fail-closed and no sensitive detail is emitted.
  6. Cryptography and data protection — PASS / not applicable. No cryptographic behavior changes. Atomic hard-link and directory-replacement rules continue to protect persisted lock state.
  7. Configuration and infrastructure — PASS. No policy, privilege, port, network, header, or supported configuration change.
  8. Security testing — PASS. Exact focused suites pass 88 with 2 skipped across acquisition, identity, lifecycle, and messaging-compatible endpoint coverage, including deadline crossings, replacement generations, corrupt state, cleanup ownership, and deterministic clock behavior.
  9. System security — PASS. The change prevents post-timeout side effects and cannot remove or overwrite a replacement generation. The new base's host-local vLLM serving infrastructure is unrelated to lifecycle-lock ownership, release, and cleanup boundaries.

The signed merge refresh preserves the effective eight-file patch byte-for-byte (raw SHA-256 c7e34040c138eac19ba8f81f15ddb3c606fe4a16b98c62e8b052399fec35aa9d; stable patch ID 21a1c4b9d143b22040e61119067a954864b71659). Fresh CI, protected E2E, and independent post-push approval remain mandatory; no prior-base result is accepted.

Signed-off-by: Charan Jagwani <cjagwani@nvidia.com>

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

Security review — exact head 6998bfb5d694d0f0139dac69d941114143510c7a against base 6f2cab8aa67bf75337efa7d55330a3bea61c27ee: PASS with no findings.

  1. Secrets and credentials — PASS. No secret, credential, logging, or environment behavior changes.
  2. Input validation and injection resistance — PASS. Lock metadata remains schema-validated and identity-bound. Timeout and deadline checks use the existing bounded monotonic-time inputs and do not introduce command or path interpolation.
  3. Authentication and authorization — PASS. Ownership remains tied to the exact lifecycle-lock generation and process identity; no caller gains authority over another operation's lock.
  4. Dependencies and supply chain — PASS. No dependency, lockfile, image, or external source change.
  5. Error handling and information exposure — PASS. Timeout paths restore a claimed stale generation only when doing so cannot overwrite a replacement; ambiguous or corrupt state remains fail-closed and no sensitive detail is emitted.
  6. Cryptography and data protection — PASS / not applicable. No cryptographic behavior changes. Atomic hard-link and directory-replacement rules continue to protect persisted lock state.
  7. Configuration and infrastructure — PASS. No policy, privilege, port, network, header, or supported configuration change.
  8. Security testing — PASS. Exact focused suites pass 88 with 2 skipped across acquisition, identity, lifecycle, and messaging-compatible endpoint coverage, including deadline crossings, replacement generations, corrupt state, cleanup ownership, and deterministic clock behavior.
  9. System security — PASS. The change prevents post-timeout side effects and cannot remove or overwrite a replacement generation. The new base's host-local vLLM serving infrastructure and Hermes health-streak reset are unrelated to lifecycle-lock ownership, release, and cleanup boundaries.

The signed merge refresh preserves the effective eight-file patch byte-for-byte (raw SHA-256 c7e34040c138eac19ba8f81f15ddb3c606fe4a16b98c62e8b052399fec35aa9d; stable patch ID 21a1c4b9d143b22040e61119067a954864b71659). Fresh CI, protected E2E, and independent post-push approval remain mandatory; no prior-base result is accepted.

@cjagwani

cjagwani commented Aug 5, 2026

Copy link
Copy Markdown
Collaborator

Refreshed onto current main without conflict.

  • Exact head/base: 6998bfb5d694d0f0139dac69d941114143510c7a / 6f2cab8aa67bf75337efa7d55330a3bea61c27ee
  • Effective eight-file patch unchanged: raw SHA-256 c7e34040c138eac19ba8f81f15ddb3c606fe4a16b98c62e8b052399fec35aa9d; stable patch ID 21a1c4b9d143b22040e61119067a954864b71659
  • Exact-head security review: fix(state): make lifecycle lock timeouts side-effect free #7859 (review)
  • Documentation-writer review: PASS, no edits; exact lock suites passed 88 tests with 2 platform skips
  • Attribution: all 45 commits are GitHub Verified

Fresh ordinary CI is running. Protected E2E remains unapproved until the exact risk plan is available and verified. An independent approval of this post-push head is still required; no prior-base result or review is being carried forward.

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

Security review — exact head a14f5667122cc3f22770759b55a5d45a66d74e0e against base 287e4747215dd2407441e3add7a4f4cb46ad13c6: PASS with no findings.

  1. Secrets and credentials — PASS. No secret, credential, logging, or environment behavior changes.
  2. Input validation and injection resistance — PASS. Lock metadata remains schema-validated and identity-bound. Timeout and deadline checks use existing bounded monotonic-time inputs and introduce no command or path interpolation.
  3. Authentication and authorization — PASS. Ownership remains tied to the exact lifecycle-lock generation and process identity; no caller gains authority over another operation's lock.
  4. Dependencies and supply chain — PASS. No dependency, lockfile, image, or external source change.
  5. Error handling and information exposure — PASS. Timeout paths restore a claimed stale generation only when that cannot overwrite a replacement; ambiguous or corrupt state remains fail-closed and no sensitive detail is emitted.
  6. Cryptography and data protection — PASS / not applicable. No cryptographic behavior changes. Atomic hard-link and directory-replacement rules continue to protect persisted lock state.
  7. Configuration and infrastructure — PASS. No policy, privilege, port, network, header, or supported configuration change.
  8. Security testing — PASS. The exact focused suites previously passed 88 with 2 platform skips across acquisition, identity, lifecycle, and messaging-compatible endpoint coverage, including deadline crossings, replacement generations, corrupt state, cleanup ownership, and deterministic clock behavior. Fresh GitHub Actions remains authoritative for this exact head.
  9. System security — PASS. The change prevents post-timeout side effects and cannot remove or overwrite a replacement generation.

The signed merge refresh had no conflict resolution and preserves the effective eight-file patch byte-for-byte (raw SHA-256 c7e34040c138eac19ba8f81f15ddb3c606fe4a16b98c62e8b052399fec35aa9d; stable patch ID 21a1c4b9d143b22040e61119067a954864b71659). Base PR #8370 changes internal shared contributor/reviewer guidance and Advisor tooling only; it does not alter lifecycle-lock ownership, release, or cleanup boundaries. Fresh CI, protected E2E, documentation receipt, and independent post-push approval remain mandatory; no prior-head or prior-base result is accepted.

@cjagwani cjagwani added v0.0.104 Release target and removed v0.0.103 labels Aug 5, 2026

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

Security review — exact head 95967eadee3fa8a13b6fc87376ada97d7b4b354b against base c176af5f08595ed748b4eeac8988c554e180183e: PASS with no findings.

  1. Secrets and credentials — PASS. No secret, credential, logging, or environment behavior changes.
  2. Input validation and injection resistance — PASS. Lock metadata remains schema-validated and identity-bound. Timeout and deadline checks use existing bounded monotonic-time inputs and introduce no command or path interpolation.
  3. Authentication and authorization — PASS. Ownership remains tied to the exact lifecycle-lock generation and process identity; no caller gains authority over another operation's lock.
  4. Dependencies and supply chain — PASS. No dependency, lockfile, image, or external source change.
  5. Error handling and information exposure — PASS. Timeout paths restore a claimed stale generation only when that cannot overwrite a replacement; ambiguous or corrupt state remains fail-closed and no sensitive detail is emitted.
  6. Cryptography and data protection — PASS / not applicable. No cryptographic behavior changes. Atomic hard-link and directory-replacement rules continue to protect persisted lock state.
  7. Configuration and infrastructure — PASS. No policy, privilege, port, network, header, or supported configuration change.
  8. Security testing — PASS. The exact focused suites previously passed 88 with 2 platform skips across acquisition, identity, lifecycle, and messaging-compatible endpoint coverage. Fresh GitHub Actions remains authoritative for this head.
  9. System security — PASS. The change prevents post-timeout side effects and cannot remove or overwrite a replacement generation.

The signed merge was conflict-free and preserves the effective eight-file patch byte-for-byte (raw SHA-256 c7e34040c138eac19ba8f81f15ddb3c606fe4a16b98c62e8b052399fec35aa9d; stable patch ID 21a1c4b9d143b22040e61119067a954864b71659). Base PR #8371 extracts the existing vLLM Hugging Face download operation behind its preserved API; it does not alter lifecycle-lock ownership, release, persistence, or cleanup. Fresh CI, protected E2E, documentation receipt, and independent post-push approval remain mandatory.

Signed-off-by: Charan Jagwani <cjagwani@nvidia.com>

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

Verdict

Security review — exact head cd31fa8dd2584db6dcfa24246949c26839f58c5d against base 3b208d79e5d3bda4183704145ee5c28d79876ae1: PASS with no findings. The effective patch is safe from the reviewed security perspective, subject to every repository merge gate.

Findings Table

No findings.

Detailed Analysis

  1. Secrets and Credentials — PASS. No secret, credential, logging, or environment behavior changes.

  2. Input Validation and Data Sanitization — PASS. Lock metadata remains schema-validated and identity-bound. Timeout and deadline checks use existing bounded monotonic-time inputs and introduce no command or path interpolation.

  3. Authentication and Authorization — PASS. Ownership remains tied to the exact lifecycle-lock generation and process identity; no caller gains authority over another operation's lock.

  4. Dependencies and Third-Party Libraries — PASS. No dependency, lockfile, image, or external source change.

  5. Error Handling and Logging — PASS. Timeout paths restore a claimed stale generation only when that cannot overwrite a replacement; ambiguous or corrupt state remains fail-closed and no sensitive detail is emitted.

  6. Cryptography and Data Protection — PASS / not applicable. No cryptographic behavior changes. Atomic hard-link and directory-replacement rules continue to protect persisted lock state.

  7. Configuration and Security Headers — PASS. No policy, privilege, port, network, header, or supported configuration change.

  8. Security Testing — PASS. The exact focused suites previously passed 88 with 2 platform skips across acquisition, identity, lifecycle, and messaging-compatible endpoint coverage. Fresh GitHub Actions remains authoritative for this head.

  9. System Security — PASS. The change prevents post-timeout side effects and cannot remove or overwrite a replacement generation.

Files Reviewed

  • src/lib/state/mcp-lifecycle-lock-acquisition.test.ts
  • src/lib/state/mcp-lifecycle-lock-acquisition.ts
  • src/lib/state/mcp-lifecycle-lock-identity.test.ts
  • src/lib/state/mcp-lifecycle-lock-identity.ts
  • src/lib/state/mcp-lifecycle-lock-storage.ts
  • test/e2e/support/messaging-compatible-endpoint-helpers.test.ts
  • test/helpers/mcp-lifecycle-lock-properties.ts
  • test/mcp-lifecycle-lock.test.ts

Provenance and Required Gates

The signed refresh merge is conflict-free and preserves the effective 8-file patch byte-for-byte (raw SHA-256 c7e34040c138eac19ba8f81f15ddb3c606fe4a16b98c62e8b052399fec35aa9d; stable patch ID 21a1c4b9d143b22040e61119067a954864b71659). Base PR #8372 changes the canonical security rubric and PR Review Advisor machinery only; it does not alter any effective PR file or runtime trust boundary. This review independently applies the new rubric.

Fresh CI, protected E2E, documentation receipt, unresolved-review resolution, and independent exact-head approval remain mandatory. This security review waives none of those gates.

Signed-off-by: Charan Jagwani <cjagwani@nvidia.com>

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

Verdict

Security review — exact head 29303579efe8ef32cc4e91f4fdd75de753fc87e1 against base c6713c9dd17a9682654713ccb6829b8714f1b307: PASS with no findings. The effective patch is safe from the reviewed security perspective, subject to every repository merge gate.

Findings Table

No findings.

Detailed Analysis

  1. Secrets and Credentials — PASS. No secret, credential, logging, or environment behavior changes.

  2. Input Validation and Data Sanitization — PASS. Lock metadata remains schema-validated and identity-bound. Timeout and deadline checks use existing bounded monotonic-time inputs and introduce no command or path interpolation.

  3. Authentication and Authorization — PASS. Ownership remains tied to the exact lifecycle-lock generation and process identity; no caller gains authority over another operation's lock.

  4. Dependencies and Third-Party Libraries — PASS. No dependency, lockfile, image, or external source change.

  5. Error Handling and Logging — PASS. Timeout paths restore a claimed stale generation only when that cannot overwrite a replacement; ambiguous or corrupt state remains fail-closed and no sensitive detail is emitted.

  6. Cryptography and Data Protection — PASS / not applicable. No cryptographic behavior changes. Atomic hard-link and directory-replacement rules continue to protect persisted lock state.

  7. Configuration and Security Headers — PASS. No policy, privilege, port, network, header, or supported configuration change.

  8. Security Testing — PASS. The exact focused suites previously passed 88 with 2 platform skips across acquisition, identity, lifecycle, and messaging-compatible endpoint coverage. Fresh GitHub Actions remains authoritative for this head.

  9. System Security — PASS. The change prevents post-timeout side effects and cannot remove or overwrite a replacement generation.

Files Reviewed

  • src/lib/state/mcp-lifecycle-lock-acquisition.test.ts
  • src/lib/state/mcp-lifecycle-lock-acquisition.ts
  • src/lib/state/mcp-lifecycle-lock-identity.test.ts
  • src/lib/state/mcp-lifecycle-lock-identity.ts
  • src/lib/state/mcp-lifecycle-lock-storage.ts
  • test/e2e/support/messaging-compatible-endpoint-helpers.test.ts
  • test/helpers/mcp-lifecycle-lock-properties.ts
  • test/mcp-lifecycle-lock.test.ts

Provenance and Required Gates

The signed refresh merge is conflict-free and preserves the effective 8-file patch byte-for-byte (raw SHA-256 c7e34040c138eac19ba8f81f15ddb3c606fe4a16b98c62e8b052399fec35aa9d; stable patch ID 21a1c4b9d143b22040e61119067a954864b71659). Base PR #8383 adds only the v0.0.103 release-note page and does not alter any effective PR file or reviewed runtime trust boundary. Base PR #8372 changes the canonical security rubric and PR Review Advisor machinery only; it does not alter any effective PR file or runtime trust boundary. This review independently applies the new rubric.

Fresh CI, protected E2E, documentation receipt, unresolved-review resolution, and independent exact-head approval remain mandatory. This security review waives none of those gates.

Signed-off-by: Charan Jagwani <cjagwani@nvidia.com>

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

Verdict

Security revalidation — exact head c7645de85ece551492eabb1e79f21036dbd1355e against current base 1608281462923ff8282151c7be1a109ee262b4e9: PASS with no findings, subject to every repository merge gate.

Findings Table

No findings.

Detailed Analysis

  1. Secrets and Credentials — PASS. The effective PR patch is unchanged from the prior exact review. The base refresh adds no overlapping secret, credential, environment, or sensitive-logging path.

  2. Input Validation and Data Sanitization — PASS. The reviewed validation and command/path construction are unchanged. The new base delta does not alter an effective PR file.

  3. Authentication and Authorization — PASS. No identity, ownership, permission, or authorization boundary changed in the PR patch or its integration with the refreshed base.

  4. Dependencies and Third-Party Libraries — PASS. The PR's reviewed dependency and artifact identities are unchanged. Base PR #8387 adds verified llama.cpp GGUF acquisition in eight disjoint files and does not change this PR's dependency surface.

  5. Error Handling and Logging — PASS. The reviewed fail-closed behavior and diagnostics are unchanged; the base refresh introduces no overlapping error or logging path.

  6. Cryptography and Data Protection — PASS. The PR's reviewed cryptographic and protected-data behavior is unchanged. No new cross-patch data flow exists.

  7. Configuration and Security Headers — PASS. The effective PR patch preserves its reviewed configuration, network, privilege, capability, port, and header boundaries.

  8. Security Testing — PASS. Raw patch SHA-256 remains c7e34040c138eac19ba8f81f15ddb3c606fe4a16b98c62e8b052399fec35aa9d and stable patch ID remains 21a1c4b9d143b22040e61119067a954864b71659. Documentation writer revalidation passed at this exact head with no docs change needed. Prior targeted test evidence remains applicable; fresh exact-head GitHub Actions is authoritative.

  9. System Security — PASS. The signed refresh is conflict-free, preserves the reviewed patch byte-for-byte, and introduces no new runtime trust-boundary interaction with the disjoint base delta.

Provenance and Required Gates

This exact-head revalidation supplements the full prior nine-category review at #7859 (review). It applies the current rubric from .agents tree 7320c9e331ddbcd9ff83e0fce9387a004e3bd1aa.

Fresh required CI, protected E2E, the exact documentation receipt, unresolved-review resolution, GitHub commit verification, and an independent exact-head approval remain mandatory. This review waives none of those gates.

cv and others added 4 commits August 5, 2026 13:17
Signed-off-by: Carlos Villela <cvillela@nvidia.com>
Signed-off-by: Carlos Villela <cvillela@nvidia.com>

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

Verdict

Security review — exact head d9f3229d5b12133f8ded9b60feb63c8af13f7ce0 against current base b148bc13ee53b7a1f612d07e42275ec732e71877: PASS with no findings, subject to every repository merge gate.

Findings Table

No findings.

Detailed Analysis

  1. Secrets and Credentials — PASS. The effective PR patch is unchanged and adds no secret, credential source, environment exposure, or sensitive logging. The refreshed base introduces no overlapping credential path.

  2. Input Validation and Data Sanitization — PASS. Reviewed validation, command construction, and path handling remain unchanged. The portable-profile base delta has no exact file overlap with this PR.

  3. Authentication and Authorization — PASS. No identity, ownership, permission, or authorization boundary is widened by the PR patch or its integration with the refreshed base.

  4. Dependencies and Third-Party Libraries — PASS. The PR's reviewed dependency and artifact identities are unchanged. Base PRs #8333 and #8376 add disjoint E2E artifact restoration and portable experimental onboarding behavior.

  5. Error Handling and Logging — PASS. Reviewed fail-closed behavior and diagnostics remain unchanged; the signed integrations add no overlapping error or logging path.

  6. Cryptography and Data Protection — PASS. Reviewed cryptographic and protected-data behavior remains unchanged, with no new cross-patch data flow.

  7. Configuration and Security Headers — PASS. The effective PR patch preserves its reviewed configuration, network, privilege, capability, port, and header boundaries. The hidden portable profile does not bypass this PR's authority checks.

  8. Security Testing — PASS. Raw patch SHA-256 remains c7e34040c138eac19ba8f81f15ddb3c606fe4a16b98c62e8b052399fec35aa9d and stable patch ID remains 21a1c4b9d143b22040e61119067a954864b71659. The prior exact targeted lifecycle-lock evidence remains applicable. Exact-head documentation writer revalidation passed; fresh GitHub Actions is authoritative.

  9. System Security — PASS. Both signed refreshes are conflict-free, preserve the effective patch byte-for-byte, and introduce no new runtime trust-boundary interaction. For #7853 specifically, the portable profile supplies onboarding defaults but neither stages messaging credentials nor bypasses registry-driven credential-drift validation.

Provenance and Required Gates

The exact head preserves contributor history through signed merge commits and applies the current rubric from .agents tree 7320c9e331ddbcd9ff83e0fce9387a004e3bd1aa. This supplements the full prior nine-category review at #7859 (review).

Fresh required CI, protected E2E, the exact documentation receipt, unresolved-review resolution, GitHub commit verification, and an independent exact-head approval remain mandatory. This review waives none of those gates.

cv added 5 commits August 5, 2026 14:03
Signed-off-by: Carlos Villela <cvillela@nvidia.com>
Signed-off-by: Carlos Villela <cvillela@nvidia.com>
Signed-off-by: Carlos Villela <cvillela@nvidia.com>
Signed-off-by: Carlos Villela <cvillela@nvidia.com>
Signed-off-by: Carlos Villela <cvillela@nvidia.com>
@jyaunches
jyaunches merged commit ae42137 into NVIDIA:main Aug 6, 2026
17 of 19 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: architecture Architecture, design debt, major refactors, or maintainability bug-fix PR fixes a bug or regression v0.0.104 Release target

Projects

None yet

Development

Successfully merging this pull request may close these issues.

MCP lifecycle lock can mutate state after acquisition timeout

8 participants