Skip to content

[DBA-136] Highlight new build in chat#75

Open
SimonKaran13 wants to merge 4 commits intomainfrom
simon.karan/DBA-136-highlight-new-build-in-chat
Open

[DBA-136] Highlight new build in chat#75
SimonKaran13 wants to merge 4 commits intomainfrom
simon.karan/DBA-136-highlight-new-build-in-chat

Conversation

@SimonKaran13
Copy link
Member

@SimonKaran13 SimonKaran13 commented Mar 24, 2026

Summary

When a new build completes while the user has a chat open, they are not notified and may continue chatting against stale context. This adds a non-blocking notification banner in the chat UI that detects new builds and offers a one-click reload.

Changes

Build sentinel file

Both the CLI and UI build paths now write a .build_complete sentinel file after a successful build, providing a reliable signal that a build has finished.

Files
  • src/databao_cli/commands/build.py
  • src/databao_cli/ui/services/dce_operations.py

Build fingerprint detection

A new get_build_fingerprint() function reads the sentinel file's mtime to determine the last completed build. The fingerprint is captured in session state at agent init.

Files
  • src/databao_cli/ui/project_utils.py
  • src/databao_cli/ui/app.py

New-build notification fragment

A Streamlit fragment polls the sentinel every 5 seconds. When a newer build is detected, it shows a toast notification and renders an amber warning banner above the chat input with a Reload button.

Files
  • src/databao_cli/ui/components/chat.py

Unit tests

Tests for build fingerprint detection covering missing domain, missing sentinel, stable reads, and change detection.

Files
  • tests/test_build_fingerprint.py

Test Plan

  • Start the app, open a chat
  • Run databao build in a separate terminal
  • Verify the amber banner appears within ~5 seconds after the build completes
  • Verify clicking Reload reinitializes the app and the banner disappears
  • Run make test — all tests pass
  • Run make check — lint and type checks pass

When a build completes (CLI or UI), a .build_complete sentinel file is
written.  The chat page polls this file every 5 seconds and, when a
newer build is detected, shows a toast and an amber warning banner
above the chat input with a one-click Reload action.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@SimonKaran13 SimonKaran13 marked this pull request as ready for review March 25, 2026 09:45
@SimonKaran13 SimonKaran13 requested review from a team and Copilot March 25, 2026 09:45
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds a build-completion “fingerprint” and UI polling so an open chat can detect when a new context build finishes and prompt the user to reload (avoiding stale context).

Changes:

  • Write a .build_complete sentinel file after successful builds (CLI + UI build paths).
  • Introduce get_build_fingerprint() (sentinel mtime) and store the initial fingerprint in Streamlit session state at agent init.
  • Add a Streamlit fragment in chat UI to poll for a newer fingerprint and display a toast + inline reload banner; add unit tests for fingerprint behavior.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
src/databao_cli/ui/services/dce_operations.py Writes a build-complete sentinel after UI build operations.
src/databao_cli/commands/build.py Writes the sentinel after CLI builds complete.
src/databao_cli/ui/project_utils.py Adds get_build_fingerprint() based on sentinel mtime.
src/databao_cli/ui/app.py Captures fingerprint at agent init; initializes related session state keys.
src/databao_cli/ui/components/chat.py Adds polling fragment and reload banner/cta in chat UI.
tests/test_build_fingerprint.py Tests fingerprint detection and change behavior.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

- Use os.utime instead of time.sleep to advance sentinel mtime in test
- When build_fingerprint is 0.0 (no build at init), silently adopt the
  first completed build so subsequent builds are still detected

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 6 out of 6 changed files in this pull request and generated 6 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

- Move BUILD_SENTINEL + write_build_sentinel to project/layout.py so
  CLI build command doesn't depend on UI service module
- Use invalidate_agent() in reload handler instead of duplicating reset
- Clear new_build_available on agent init to prevent stale banner after
  sidebar reload

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 7 out of 7 changed files in this pull request and generated no new comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
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.

2 participants