Skip to content

Fix NoneType decorator crash when tracing system is unavailable - #168

Merged
onenoly1010 merged 2 commits into
dependabot/npm_and_yarn/postcss-8.5.18from
copilot/fix-copilot-issue
Jul 30, 2026
Merged

Fix NoneType decorator crash when tracing system is unavailable#168
onenoly1010 merged 2 commits into
dependabot/npm_and_yarn/postcss-8.5.18from
copilot/fix-copilot-issue

Conversation

Copilot AI commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

When tracing_system fails to import, the fallback lambdas returned None, causing a TypeError at module load time because @trace_fastapi_operation("health_check") expects the call to return a decorator, not None.

Change

server/main.py — fallback lambdas now return an identity decorator instead of None:

# Before — returns None, crashes when used as @decorator_factory(...)
trace_fastapi_operation = lambda *args, **kwargs: None

# After — returns a no-op pass-through decorator
trace_fastapi_operation = lambda *args, **kwargs: (lambda f: f)

Applied to all four tracing fallbacks: trace_consciousness_stream, trace_fastapi_operation, trace_payment_processing, trace_payment_visualization_flow.

Copilot AI changed the title [WIP] Fix issue with Copilot functionality Fix NoneType decorator crash when tracing system is unavailable Jul 29, 2026
Copilot AI requested a review from onenoly1010 July 29, 2026 15:42
@onenoly1010
onenoly1010 force-pushed the copilot/fix-copilot-issue branch from 3de77ae to 1113c5f Compare July 30, 2026 16:22
@onenoly1010
onenoly1010 requested a review from Copilot July 30, 2026 16:35
Co-authored-by: onenoly1010 <193537773+onenoly1010@users.noreply.github.com>
@onenoly1010
onenoly1010 force-pushed the copilot/fix-copilot-issue branch from 1113c5f to d6c8230 Compare July 30, 2026 16:35
@onenoly1010
onenoly1010 marked this pull request as ready for review July 30, 2026 16:37

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.

🟡 Not ready to approve

The new fallbacks return decorators for all tracing helpers, but at least one (trace_consciousness_stream) is used as a context manager (with ...:), which will still fail when tracing is unavailable.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

This review doesn't count toward merge requirements. Sign up for the private preview to control whether Copilot approvals count.

Pull request overview

This PR aims to prevent module-load crashes when tracing_system can’t be imported by ensuring tracing fallbacks are safe to use (especially when used as decorator factories).

Changes:

  • Updated tracing fallback callables in server/main.py to avoid returning None when tracing_system import fails.
  • Intended to make @trace_fastapi_operation("...") safe even when tracing is unavailable.
File summaries
File Description
server/main.py Adjusts tracing fallbacks used when tracing_system import fails.
Review details
  • Files reviewed: 1/1 changed files
  • Comments generated: 1
  • Review effort level: Low

We're testing this review assessment. Please use 👍 or 👎 to tell us if it's correct.

Comment thread server/main.py Outdated
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Copilot AI requested a review from onenoly1010 July 30, 2026 16:40
@onenoly1010
onenoly1010 merged commit 02d07f3 into main Jul 30, 2026
7 of 9 checks passed
@onenoly1010
onenoly1010 deleted the copilot/fix-copilot-issue branch July 30, 2026 16:42
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.

3 participants