fix(agents): classify non-interactive provider errors in managed DCode patch#7422
Conversation
…e patch (NVIDIA#7415) Add error classification to the NON_INTERACTIVE_PATCH so that known upstream provider errors (ResourceExhausted, rate-limit, timeout, connection) are logged with a structured category and retryable flag instead of surfacing as unclassified RemoteException. Unknown errors log only a correlation ID with no exception details. Co-Authored-By: Claude <noreply@anthropic.com> Signed-off-by: kagura-agent <kagura.agent.ai@gmail.com>
📝 WalkthroughWalkthroughThe managed non-interactive path now classifies persisted provider-capacity errors for the active thread, emits sanitized diagnostics with a correlation ID, and returns exit code 1. Tests cover classification, thread isolation, unknown failures, patch wiring, and sensitive-data redaction. ChangesManaged non-interactive error reporting
Estimated code review effort: 3 (Moderate) | ~25 minutes Sequence Diagram(s)sequenceDiagram
participant NonInteractiveRunner
participant ErrorReporter
participant SessionsDatabase
participant Console
NonInteractiveRunner->>ErrorReporter: report failure for thread_id
ErrorReporter->>SessionsDatabase: read recent __error__ writes
SessionsDatabase-->>ErrorReporter: persisted error text
ErrorReporter->>ErrorReporter: classify capacity exhaustion or unknown
ErrorReporter->>Console: print bounded message with correlation_id
ErrorReporter-->>NonInteractiveRunner: return 1
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
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 `@agents/langchain-deepagents-code/patch-managed-deepagents-code.py`:
- Around line 756-760: Update _NEMOCLAW_KNOWN_PROVIDER_ERRORS and its
classification flow to require trusted provider exception types/modules or
validated provider response fields before assigning upstream categories. Do not
classify generic messages such as MCP connection failures, gateway timeouts, or
unrelated 429 responses; leave them unknown, and add negative-path coverage
proving MCP, policy, and gateway errors remain distinguishable.
In `@test/non-interactive-error-classification.test.ts`:
- Around line 4-12: Update the imports in
non-interactive-error-classification.test.ts to include the CLI source module
under test, while preserving the existing fixture-helper, Node, and Vitest
imports.
- Around line 26-28: Replace the source-text marker assertions in
test/non-interactive-error-classification.test.ts:26-28 with an observable
run_non_interactive contract test. In
test/non-interactive-error-classification.test.ts:55-82, stub
_nemoclaw_original_run_non_interactive to raise controlled provider and unknown
exceptions, invoke run_non_interactive, capture its log record, and assert the
category, retryability, sanitized message, and identity-preserving rethrow;
cover both affected sites as part of this runtime-focused test update.
🪄 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: 782c8b65-53fe-4de9-ab4c-38011f11b8a0
📒 Files selected for processing (2)
agents/langchain-deepagents-code/patch-managed-deepagents-code.pytest/non-interactive-error-classification.test.ts
PR Review Advisor — InformationalAdvisor assessment: Informational / high confidence Model lanes
Nemotron output stays in workflow artifacts and does not change the assessment above. E2E guidanceAdvisory only. E2E / PR Gate selects and runs jobs independently. Recommended E2E: None 1 optional E2E recommendation
1 warning · 0 suggestionsWarningsWarnings do not block.
|
… errors Address PR Review Advisor PRA-1 blocker: the non-interactive error classifier now walks __cause__/__context__ exception chains so that a generic RemoteException wrapping a ResourceExhausted cause is correctly classified. When chain walking yields no match, fall back to reading the most recent __error__ entries from the managed LangGraph checkpoint DB at /sandbox/.deepagents/.state/sessions.db, where DCode persists the original provider failure text that LangGraph strips during remote exception serialization. Also address PRA-2: replace hex(id(exc)) with a UUID correlation ID that has defined diagnostic scope across process boundaries. New tests: - Chained exception classification (__cause__ and __context__) - Persisted checkpoint DB fallback (with temporary SQLite fixture) - UUID correlation ID presence (no object-address leak) - Classification result non-disclosure (sensitive content not in tuple) Signed-off-by: kagura-agent <kagura.agent.ai@gmail.com>
|
Pushed fix addressing PR Review Advisor findings: PRA-1 (blocker): The classifier now walks the full PRA-2 (warning): Replaced PRA-3 (warning): Added a test verifying that classification results contain only fixed category fields — sensitive exception content (tokens, model names, message bodies) does not appear in the returned tuple. New tests cover: chained exception classification, persisted checkpoint DB fallback (with temporary SQLite fixture), UUID correlation ID presence, and classification result non-disclosure. |
|
✨ Thanks for the fix. This adds structured error classification for known upstream provider errors in the managed DCode non-interactive path. Maintainers will review the classification logic and retryable flag design. Related open issues: |
Signed-off-by: Julie Yaunches <jyaunches@nvidia.com>
|
Reviewed exact-head Advisor PRA-1; no code change. |
Signed-off-by: Senthil Ravichandran <senthilr@nvidia.com>
senthilr-nv
left a comment
There was a problem hiding this comment.
Approved for PR #7422 at exact head 0fed023 against base fac91e6. Product scope is established by #7415. I found no blocking review issues. Merge remains conditional on all required CI, E2E / PR Gate Coordination, and E2E / PR Gate passing for this exact SHA pair. Any head or base change requires renewed review and evidence.
<!-- markdownlint-disable MD041 --> ## Summary Adds the canonical pre-tag `## v0.0.95` release entry to `docs/changelog/2026-07-24.mdx`, before the existing v0.0.94 entry. The entry summarizes approved user-visible changes merged since v0.0.94 and excludes internal-only prerequisites. ## Changes - Adds the v0.0.95 summary and detailed bullets for gateway lifecycle, recovery, state transfer, inference compatibility, sandbox security, Discord policy, and E2E evidence. - Links each user-facing theme to the most specific published documentation. - Records the release entry in the shared native changelog used by the OpenClaw, Hermes, and Deep Agents guides. Source summary: - [#7246](#7246), [#7228](#7228), [#7267](#7267), [#7489](#7489), [#7509](#7509), [#7351](#7351), and [#7290](#7290) -> `docs/changelog/2026-07-24.mdx`: Gateway authority, forward teardown and retry, managed recovery, Hermes restart recovery, scoped uninstall, and orphan-aware backup behavior. - [#7344](#7344) and [#7416](#7416) -> `docs/changelog/2026-07-24.mdx`: Atomic SQLite restore and host download verification. - [#7476](#7476), [#7347](#7347), [#7281](#7281), [#7485](#7485), [#7491](#7491), and [#7422](#7422) -> `docs/changelog/2026-07-24.mdx`: Windows Ollama reuse, CDI fallback, bounded OpenRouter connection setup, Nemotron-3 request compatibility, and managed Deep Agents retry and provider-error behavior. - [#6884](#6884), [#7481](#7481), [#6878](#6878), [#7467](#7467), [#7502](#7502), [#7503](#7503), [#7504](#7504), and [#7486](#7486) -> `docs/changelog/2026-07-24.mdx`: Trusted base-image overrides, local rebuild images, runtime validation, config preservation, reviewed package updates, and fewer final-image payload layers. - [#7303](#7303) -> `docs/changelog/2026-07-24.mdx`: Scoped Discord application-command management. - [#7488](#7488), [#7465](#7465), [#7497](#7497), [#7464](#7464), [#7501](#7501), [#7494](#7494), and [#7493](#7493) -> `docs/changelog/2026-07-24.mdx`: Selected-test risk signals, retry cleanup, full root-image validation, direct-main Hermes setup, executed PR-gate evidence, nightly history, and runner wait reporting. - [#7447](#7447) is an internal pinned-runtime prerequisite and is intentionally excluded from canonical supported-integration documentation. - [#7370](#7370) adds maintainer-only advisory reconciliation tooling and does not change supported user behavior. - [#7495](#7495) updates existing documentation and does not add a new v0.0.95 behavior claim. ## Type of Change - [ ] Code change (feature, bug fix, or refactor) - [ ] Code change with doc updates - [x] Doc only (prose changes, no code sample modifications) - [ ] Doc only (includes code sample changes) ## Quality Gates - [ ] Tests added or updated for changed behavior - [x] Existing tests cover changed behavior — justification: `test/changelog-docs.test.ts` validates the dated changelog structure, heading uniqueness, and published links. - [ ] Tests not applicable — justification: - [x] Docs updated for user-facing behavior changes - [ ] Docs not applicable — justification: - [ ] 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: - [ ] Non-success, skipped, or missing CI check accepted by maintainer — check name, approval link, and follow-up issue: ## Documentation Writer Review - [x] Documentation writer subagent reviewed the completed changes - Result: `docs-updated` - Evidence: `docs/changelog/2026-07-24.mdx`; writing rules, documentation style, factual release meaning, and published links reviewed at exact head `58b02f2bf`. - Agent: Codex documentation writer reviewer <!-- docs-review-head-sha: 58b02f2 --> <!-- docs-review-agents-blob-sha: 9c9b36d --> ## DGX Station Hardware Evidence - [ ] Tested on DGX Station - Tested commit: - Station profile/scenario: - Result: - Supporting evidence: ## Verification - [x] PR description includes a `Signed-off-by:` line and every commit appears as `Verified` in GitHub - [x] Normal `pre-commit`, `commit-msg`, and `pre-push` hooks passed, or `npm run check:diff` passed when hooks were skipped or unavailable - [x] Targeted behavior tests pass for the current change set, or tests are marked not applicable above — command/result or justification: `npx vitest run test/changelog-docs.test.ts` passed 6 tests. - [ ] Applicable broad gate passed — `npm test` for broad runtime/test-harness changes; `npm run check` for repo-wide validation/coverage changes — command/result: - [x] Quality Gates section completed with required justifications or waivers - [x] No secrets, API keys, or credentials committed - [ ] `npm run docs` builds without warnings (doc changes only) — the build passed with 0 errors and 2 Fern warnings. - [x] Doc pages follow the [style guide](https://github.com/NVIDIA/NemoClaw/blob/main/docs/CONTRIBUTING.md) (doc changes only) - [ ] New doc pages include SPDX header and frontmatter (new pages only) --- Signed-off-by: Senthil Ravichandran <senthilr@nvidia.com> <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Documentation** * Added a new v0.0.95 changelog entry above v0.0.94. * Documented improved externally supervised gateway lifecycle ownership. * Improved snapshot restore reliability and SQLite state handling. * Tightened CLI `backup-all` behavior and host artifact verification. * Updated Windows onboarding guidance (including Ollama service reuse and CDI directory fallback). * Noted inference compatibility fixes, deeper agent failure classification, stricter base-image validation, updated Discord bot command permissions, and refined E2E release automation evidence handling. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Signed-off-by: Senthil Ravichandran <senthilr@nvidia.com>
Summary
Managed Deep Agents Code non-interactive failures now replace raw exception output at DCode's internal error boundary with bounded, structured diagnostics. The observed provider-capacity failure is retryable for the failing thread, while MCP, gateway, policy, and unknown failures remain sanitized.
Related Issue
Closes #7415
Product Scope
Product-scope verdict: this change stays within the existing managed DCode integration. Maintainer-authored issue #7415 defines the failure, supported behavior, security boundary, and acceptance criteria. This verdict is independent of GitHub's
mergeStateStatus.Changes
__error__values from the failing thread in the managedwritestable.APIError('ResourceExhausted: Worker local total request limit reached (...)')provider-capacity signature.error_class,category,retryable, and thread correlation fields without exception, request, model, tool, or checkpoint content.Type of Change
Quality Gates
6da4f49223cafound no findings, but independent human sensitive-path review remains required.Security Review
This is an automated Codex Desktop review of
upstream/main...6da4f49223ca, not human or sensitive-path review. The PR patch is unchanged from the prior review.Findings: none.
Files reviewed:
agents/langchain-deepagents-code/patch-managed-deepagents-code.pytest/helpers/langchain-deepagents-code-patch-fixture.tstest/langchain-deepagents-code-progressive-tool-disclosure.test.tstest/non-interactive-error-classification.test.tsDocumentation Writer Review
no-docs-neededWRITING.md; no blocking or advisory writing issue was found. This was an automated Codex Desktop review, not human review.DGX Station Hardware Evidence
scripts/prepare-dgx-station-host.shis unchanged in the PR diff.Verification
Signed-off-by:line and every commit appears asVerifiedin GitHubpre-commit,commit-msg, andpre-pushhooks passed, ornpm run check:diffpassed when hooks were skipped or unavailablenpx vitest run --project integration test/non-interactive-error-classification.test.ts test/langchain-deepagents-code-progressive-tool-disclosure.test.ts test/langchain-deepagents-code-direct-module-patch.test.ts test/langchain-deepagents-code-fetch-proxy.test.ts test/langchain-deepagents-code-provider-label.test.ts test/langchain-deepagents-code-retry-boundary.test.ts: 6 files passed, 85 tests passed, 1 skipped.npm run docsbuilds without warnings (doc changes only)Signed-off-by: Julie Yaunches jyaunches@nvidia.com
Signed-off-by: kagura-agent kagura.agent.ai@gmail.com