Skip to content

[AAASM-4790] 🐛 (adapters): Fail closed on missing langchain check + warn on adapter register failure - #274

Merged
Chisanan232 merged 4 commits into
masterfrom
v0.0.1/AAASM-4790/adapter_enforce_consistency
Jul 17, 2026
Merged

[AAASM-4790] 🐛 (adapters): Fail closed on missing langchain check + warn on adapter register failure#274
Chisanan232 merged 4 commits into
masterfrom
v0.0.1/AAASM-4790/adapter_enforce_consistency

Conversation

@Chisanan232

@Chisanan232 Chisanan232 commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

Description

Closes two enforce-consistency gaps left after the recent adapter fail-closed work:

  1. AssemblyCallbackHandler.on_tool_start (LangChain adapter) allowed unconditionally
    when the wired interceptor exposed no check_tool_start, silently skipping
    pre-execution governance under enforce. It now mirrors the other adapters'
    _missing_interceptor_decision fallback: deny (raise ToolExecutionBlockedError)
    under enforce, fail open under observe / disabled.
  2. _register_adapters (core/assembly.py) swallowed any register_hooks exception
    with a bare continue, leaving a co-installed framework running fully ungoverned
    with no trace. It now emits an unconditional stderr warning naming the framework
    that failed to attach, mirroring _warn_agent_unregistered. Init still proceeds
    (the continue is unchanged) — other adapters may register fine.

agent_assembly/adapters/openai_agents/patch.py is intentionally untouched (owned by
AAASM-4782). The haystack duplication noted during investigation is INFO-level and
out of scope for this ticket.

Type of Change

  • ✨ New feature
  • 🔧 Bug fix
  • ♻️ Refactoring
  • 🍀 Performance improvement
  • 📚 Documentation update
  • 🚀 Release

Breaking Changes

  • No
  • Yes (please describe below)

Related Issues

Fixes AAASM-4790

Testing

  • Unit tests added/updated
  • Integration tests added/updated
  • Manual testing performed
  • No tests required (explain why)

Added regression tests:

  • test/unit/adapters/langchain/test_callback_handler_sync.py: on_tool_start
    blocks under enforce and allows under observe/disabled when the interceptor has
    no check_tool_start.
  • test/unit/test_assembly.py: _register_adapters emits a stderr warning naming
    the broken framework when register_hooks raises, and still registers the
    remaining healthy adapters.

Ran only the impacted test files (per ticket scope), not the full suite:

.venv/bin/python -m pytest test/unit/adapters/langchain/ test/unit/test_assembly.py test/unit/core/test_init_registration.py -q
# 132 passed

ruff check, ruff format --check, and mypy agent_assembly / mypy test/unit/test_assembly.py
are clean on the touched files (pre-existing unrelated agent_assembly._core /
grpc stub errors are unchanged baseline noise, not introduced by this PR).

Checklist

  • Code follows project style guidelines
  • Self-review completed
  • Comments added for complex logic
  • Documentation updated if needed
  • All tests passing

on_tool_start allowed unconditionally when the wired interceptor exposed
no check_tool_start, silently skipping pre-execution governance under
enforce. Mirrors the other adapters' _missing_interceptor_decision
fallback: deny under enforce, fail open under observe/disabled.

Refs AAASM-4790
Covers AAASM-4790: on_tool_start blocks under enforce and allows under
observe/disabled when the interceptor has no check_tool_start.
_register_adapters swallowed register_hooks exceptions with a bare
continue, leaving a co-installed framework running fully ungoverned
with no trace. Emits an unconditional stderr warning naming the
framework, mirroring _warn_agent_unregistered; init still proceeds.

Refs AAASM-4790
Covers AAASM-4790: _register_adapters warns on stderr naming the
broken framework and still registers the remaining healthy adapters.
@sonarqubecloud

Copy link
Copy Markdown

@codecov

codecov Bot commented Jul 17, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@Chisanan232

Copy link
Copy Markdown
Contributor Author

Claude Code — automated review

CI: green. Scope: matches the ticket. Side effects: none — green full-suite CI (incl. build/lint/impacted tests) validates no existing-function breakage. Front-End: no FE/dashboard code touched → no Playwright validation applies. Verdict: ✅ ready to approve & merge.
Fix: langchain missing-check_tool_start fails closed under enforce; adapter register_hooks failures now warn on stderr. 132 tests pass.

@Chisanan232
Chisanan232 merged commit 9ac20c9 into master Jul 17, 2026
26 checks passed
@Chisanan232
Chisanan232 deleted the v0.0.1/AAASM-4790/adapter_enforce_consistency branch July 17, 2026 12:56
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.

1 participant