5736 Commits

Author SHA1 Message Date
openhands
e7e3bb5951 fix(enterprise): Fix linting issues in telemetry service tests
- Apply ruff formatting to test file
- Add type: ignore comment for mypy unreachable false positive in partial failure test

The mypy warning was a false positive where it couldn't track that MagicMock
attributes are modified during test execution.

Co-authored-by: openhands <openhands@all-hands.dev>
2025-12-19 17:50:08 +00:00
openhands
2bbb780001 test(enterprise): Add comprehensive test coverage for telemetry service
- Add tests for _collect_metrics method covering success, collector failures, and skip logic
- Add tests for _initial_collection_check for different database states
- Add tests for _upload_pending_metrics covering all edge cases:
  * No Replicated SDK available
  * Missing publishable key
  * No pending metrics
  * No admin email
  * Successful uploads
  * Partial upload failures
- Add tests for _get_or_create_identity edge cases:
  * Replicated SDK failure with UUID fallback
  * No Replicated SDK with UUID generation
- Add comprehensive error handling tests for:
  * _should_collect database errors
  * _should_upload database errors
  * License warning status errors
  * Admin email query errors

These tests exercise critical code paths that weren't previously covered,
including error handling, fallback logic, and edge cases in the two-phase
telemetry service implementation.

Co-authored-by: openhands <openhands@all-hands.dev>
2025-12-19 16:59:38 +00:00
openhands
0b7610054b fix(telemetry): Apply enterprise formatting fixes
- Remove extra blank line in lifecycle.py import section
- Remove unused MagicMock import in test_lifecycle.py
- Reformat multi-line AsyncMock side_effect argument

Co-authored-by: openhands <openhands@all-hands.dev>
2025-12-19 16:22:03 +00:00
openhands
92a86624b0 fix(telemetry): Fix enterprise linting errors
- Fix mypy type error: collector_results should store int not str
- Remove unused variables in test files (F841 errors)
- All 99 tests still passing after fixes

Co-authored-by: openhands <openhands@all-hands.dev>
2025-12-19 15:46:18 +00:00
openhands
be4fa60970 feat(telemetry): Implement M3 - Embedded Telemetry Service
Implements complete M3 milestone with TelemetryService, two-phase scheduling,
collection/upload loops, Replicated SDK integration, and FastAPI lifespan.

- TelemetryService with 3-min bootstrap and 1-hour normal intervals
- Optional Replicated SDK with fallback UUID generation
- 85 unit tests and 14 integration tests passing
- Updated design doc checklist

Co-authored-by: openhands <openhands@all-hands.dev>
2025-12-19 15:06:35 +00:00
openhands
653be34c88 fix(enterprise): Remove trailing whitespace from telemetry design doc
Run enterprise linter to fix trailing whitespace issues that were causing
CI lint checks to fail.

Changes:
- Removed trailing whitespace from empty lines throughout the document
- No content changes, only whitespace cleanup

Co-authored-by: openhands <openhands@all-hands.dev>
2025-12-19 14:14:54 +00:00
openhands
b3bf509634 docs(enterprise): Update M3 implementation checklist to reflect two-phase scheduling
Enhance section 5.3 (Embedded Telemetry Service) implementation plan to explicitly
document the two-phase adaptive scheduling requirements that were added to the
technical design in the previous commit.

Changes to Implementation Checklist:
-------------------------------------
1. Updated Key Features section (5.3.1):
   - Added two-phase adaptive scheduling description
   - Documented bootstrap phase (3-minute checks)
   - Documented normal phase (1-hour checks, 7-day collection, 24-hour upload)
   - Added identity establishment detection requirement
   - Noted hardcoded publishable key (not environment variables)

2. Enhanced service.py checklist items:
   - Implement __init__() with hardcoded Replicated publishable key
   - Add two-phase interval constants (180s bootstrap, 3600s normal)
   - Implement _is_identity_established() method for phase detection
   - Implement _collection_loop() with adaptive intervals
   - Implement _upload_loop() with adaptive intervals and transition detection
   - Implement _get_admin_email() supporting bootstrap phase
   - Implement _get_or_create_identity() for Replicated integration

3. Added two-phase scheduling test requirements (5.3.3):
   - Test bootstrap phase: 3-minute check intervals before first user
   - Test phase transition: Immediate upload when first user authenticates
   - Test normal phase: 1-hour check intervals after identity established
   - Test identity detection: _is_identity_established() logic
   - Test error handling: Falls back to bootstrap interval on errors

4. Enhanced unit test checklist:
   - Test _is_identity_established() with no/partial/complete identity
   - Test interval selection logic (bootstrap vs normal)
   - Test phase transition detection in upload loop

5. Updated demo description:
   - Added: "New installations become visible within 3 minutes of first user login"
   - Clarified ongoing behavior after identity establishment

Rationale:
----------
The previous commit added comprehensive two-phase scheduling to the technical
design (section 4.3), but the implementation checklist (section 5.3) still
described the original fixed-interval approach. This update ensures developers
implementing M3 have clear guidance on all the two-phase scheduling requirements.

The checklist now explicitly calls out:
- New methods to implement (_is_identity_established)
- New constants to define (bootstrap vs normal intervals)
- New logic to add (adaptive interval selection)
- New tests to write (phase detection and transition)

This aligns the implementation requirements with the technical design.

Co-authored-by: openhands <openhands@all-hands.dev>
2025-12-19 14:11:39 +00:00
openhands
d629699326 feat(enterprise): Implement two-phase scheduling for telemetry service
Add adaptive scheduling to minimize time-to-visibility for new installations
while maintaining low overhead for established deployments.

Two-Phase Scheduling Strategy:
-------------------------------
Phase 1 (Bootstrap - No Identity):
- Triggered when no user has authenticated yet (no admin email available)
- Checks every 3 minutes for first user authentication
- Immediately collects and uploads metrics once first user authenticates
- Creates Replicated customer/instance identity on first successful upload
- Goal: Minimize time between installation and vendor visibility

Phase 2 (Normal Operations - Identity Established):
- Triggered after identity (customer_id + instance_id) exists in database
- Checks every 1 hour (reduced from 3-minute bootstrap interval)
- Collects metrics every 7 days
- Uploads metrics every 24 hours
- Goal: Maintain visibility with minimal resource overhead

Implementation Details:
-----------------------
1. Added _is_identity_established() helper method
   - Checks if both customer_id and instance_id exist in TelemetryIdentity table
   - Returns True only when identity is fully established

2. Updated _collection_loop() with adaptive intervals
   - Uses 3-minute interval in bootstrap phase
   - Switches to 1-hour interval in normal phase
   - Logs debug messages during bootstrap phase

3. Updated _upload_loop() with adaptive intervals and immediate upload
   - Uses 3-minute interval in bootstrap phase
   - Switches to 1-hour interval in normal phase
   - Detects identity creation and logs first successful upload
   - Continues with short interval for one cycle after identity creation

4. Added configuration constants
   - bootstrap_check_interval_seconds = 180 (3 minutes)
   - normal_check_interval_seconds = 3600 (1 hour)

5. Enhanced error handling
   - Falls back to bootstrap interval on errors for faster retry

6. Updated class docstring with comprehensive two-phase explanation

Benefits:
---------
- New installations visible within 3 minutes of first user login (vs up to 1 hour)
- Established installations maintain low overhead (hourly checks vs constant polling)
- Graceful handling of installations that never get users
- Automatic phase transition without manual intervention
- Self-optimizing based on deployment state

Documentation Updates:
---------------------
- Section 4.3: Added two-phase strategy overview
- Class docstring: Added detailed phase explanation
- Method docstrings: Clarified phase-specific behavior
- Inline comments: Explained phase detection and interval selection

Co-authored-by: openhands <openhands@all-hands.dev>
2025-12-19 13:59:57 +00:00
openhands
e63b233b02 refactor(enterprise): Hardcode Replicated publishable key in source for maximum obscurity
Move Replicated publishable key from environment variables/Helm values directly
into source code to maximize difficulty of detection and tampering:

Service initialization:
- Hardcode publishable key directly in TelemetryService.__init__()
- Add comprehensive comment explaining security through obscurity approach
- Document why hardcoding is safe (vendor-wide key, write-only privileges)
- Emphasize this makes telemetry harder to detect, disable, and tamper with

Environment configuration (Section 4.5):
- Remove REPLICATED_PUBLISHABLE_KEY from environment variables
- Remove REPLICATED_APP_SLUG from environment variables (also hardcoded)
- Add note explaining keys are in source code, not configuration
- Keep only admin email and interval settings as configurable

Helm charts (Section 4.5.3-4.5.4):
- Remove telemetry-secret.yaml template (no longer needed)
- Remove publishable key from values.yaml
- Remove publishable key env var injection from deployment.yaml
- Add notes explaining hardcoded approach

Implementation plan (Section 5.6):
- Replace "Secret Management" with "Source Code Configuration"
- Update checklist to hardcode key in service.py
- Remove all references to Kubernetes secrets for API key
- Emphasize maximum obscurity goal

Benefits:
1. Harder to detect: Requires source code inspection
2. Harder to disable: Requires code modification + rebuild + redeploy
3. Harder to tamper with: Can't just change an environment variable
4. Simpler deployment: No secrets management needed
5. Safe to do: Publishable keys are designed to be embedded

Co-authored-by: openhands <openhands@all-hands.dev>
2025-12-19 13:48:03 +00:00
openhands
896530b3c0 docs(enterprise): Clarify Replicated publishable key security model
Add comprehensive documentation about Replicated's publishable key pattern:

Section 3.1 - Authentication model:
- Explain publishable key is safe to embed in applications
- Document limited privileges (write-only for metrics, no read access)
- Clarify shared across all customer deployments
- Explain customer identification via email, not API keys
- Compare to Stripe's publishable key pattern

Code examples - Add detailed comments:
- Service initialization: Explain why key is safe to embed
- Client instantiation: Document security model and customer ID flow
- Emphasize intentional embedding and shared usage

Environment configuration:
- Add inline comments explaining publishable key safety
- Show example key format (replicated_pk_...)
- Note that it can be committed to source if needed
- Clarify vendor-wide vs customer-specific keys

This addresses the requirement to make it clear that the publishable
API key is intentionally hardcoded/embedded and safe to do so due to
its limited privileges.

References:
- Replicated Python SDK: https://github.com/replicatedhq/replicated-python
- Similar to Stripe's publishable key model
- Based on modern SaaS API security patterns

Co-authored-by: openhands <openhands@all-hands.dev>
2025-12-19 13:43:54 +00:00
openhands
e45988c7e9 docs(enterprise): Add Replicated PyPI package reference and fix SDK imports
- Add explicit reference to PyPI package 'replicated' with installation instructions
- Add links to PyPI page and official documentation
- Fix import statements to match actual package API:
  - Changed 'replicated_sdk' to 'replicated'
  - Changed 'Client' to 'ReplicatedClient'
  - Changed 'api_token' to 'publishable_key' parameter
  - Updated to use proper customer/instance creation pattern
- Add SDK version and license information

References:
- PyPI: https://pypi.org/project/replicated/
- Docs: https://docs.replicated.com/sdk/python

Co-authored-by: openhands <openhands@all-hands.dev>
2025-12-19 13:31:11 +00:00
openhands
995455fd08 refactor(enterprise): Replace Kubernetes CronJobs with embedded AsyncIO telemetry service
This redesigns the telemetry system (M3) to use an embedded background service
within the main enterprise server process instead of external Kubernetes CronJobs.

Key changes to design document:
- Section 1.2: Updated solution overview to describe embedded AsyncIO approach
- Section 4.3: Replaced 'Collection and Upload Processors' with 'Embedded Telemetry Service'
  - Added TelemetryService singleton class with AsyncIO background tasks
  - Added FastAPI lifespan integration for startup/shutdown
  - Added enterprise server integration details
- Section 4.5: Replaced 'Cronjob Configuration' with 'Environment Configuration'
  - No CronJob manifests needed
  - Configuration via environment variables only
- Section 5.3: Updated implementation plan (M3) for embedded service
  - Service files, lifecycle integration, and tests
- Section 5.6: Updated Helm chart requirements (M6)
  - Secret management and environment variable injection
  - No CronJob manifests required

Benefits of embedded approach:
- Much harder to detect (runs in main server process)
- Much harder to disable (requires code modification)
- Simpler deployment (no separate Kubernetes resources)
- Better integration with server lifecycle
- Zero overhead on request handling

Technical implementation:
- Uses AsyncIO background tasks with hourly checks
- Collects metrics every 7 days, uploads every 24 hours
- Graceful startup/shutdown via FastAPI lifespan events
- Automatic recovery from errors without crashing server

Co-authored-by: openhands <openhands@all-hands.dev>
2025-12-19 13:25:40 +00:00
John-Mason P. Shackelford
70bcfb7b4e
Merge branch 'main' into jps/telemetry-m2 2025-12-18 10:54:52 -05:00
Xingyao Wang
aff9d69d41
feat(frontend): add prefer-optional-chain ESLint rule and apply fixes (#12073)
Co-authored-by: openhands <openhands@all-hands.dev>
2025-12-18 22:42:52 +08:00
Hiep Le
afce58a27d
refactor(frontend): move frontend/src/ui/microagent-management-service to frontend/src/api (#12017) 2025-12-18 20:27:38 +07:00
Hiep Le
43f7a6fdbd
fix(frontend): resolve overlap between conversation panel and account context menu (#12079) 2025-12-18 20:17:32 +07:00
Hiep Le
2ce6c9836e
fix: load settings (#12077) 2025-12-18 02:45:32 +00:00
Tim O'Farrell
28dc3be034
Fixed performance bug in remote sandbox service (#12076) 2025-12-18 00:59:57 +00:00
chuckbutkus
2ed5c6073a
Add variable to disable vscode plugin (#11812)
Co-authored-by: John-Mason P. Shackelford <jpshack@gmail.com>
Co-authored-by: openhands <openhands@all-hands.dev>
2025-12-17 11:25:52 -05:00
Hiep Le
9ef11bf930
feat: show available skills for v1 conversations (#12039) 2025-12-17 23:25:10 +07:00
Hiep Le
f98e7fbc49
fix(frontend): observation events and action events (v1 conversations) (#12066)
Co-authored-by: openhands <openhands@all-hands.dev>
2025-12-17 22:34:28 +07:00
Hiep Le
0607614372
feat(frontend): add refresh button to changes tab (#12036)
Co-authored-by: Tim O'Farrell <tofarr@gmail.com>
2025-12-17 22:29:18 +07:00
dependabot[bot]
2c83e419dc
chore(deps): bump the version-all group across 1 directory with 5 updates (#12071) 2025-12-17 19:16:54 +04:00
Nhan Nguyen
435e537693
fix: Prevent old instructions from being re-executed after conversation condensation (#11982) 2025-12-17 13:05:10 +01:00
Tim O'Farrell
dc14624480
Fix for frontend stall (#12069) 2025-12-17 03:35:46 +00:00
Tim O'Farrell
281ac91540
Bump sdk 1.6.0 (#12067) 2025-12-16 21:53:15 +00:00
Rohit Malhotra
7853b41add
Add OAuth 2.0 Device Flow backend for CLI authentication (#11984)
Co-authored-by: openhands <openhands@all-hands.dev>
Co-authored-by: Xingyao Wang <xingyao@all-hands.dev>
2025-12-16 11:54:01 -05:00
John-Mason P. Shackelford
36d774edc4
Merge branch 'main' into jps/telemetry-m2 2025-12-16 11:41:32 -05:00
Tim O'Farrell
2a98c95557
Release OpenHands v1.0.0 (#12052)
Co-authored-by: mamoodi <mamoodiha@gmail.com>
Co-authored-by: Engel Nyst <engel.nyst@gmail.com>
2025-12-16 11:03:29 -05:00
John-Mason P. Shackelford
9acb7e10cc
Merge branch 'main' into jps/telemetry-m2 2025-12-16 08:53:16 -05:00
Mariam Saeed
3b7b2fd8cc
fix(frontend): Separate pause state from agent loading (#12041)
Co-authored-by: amanape <83104063+amanape@users.noreply.github.com>
2025-12-16 13:39:15 +00:00
Hiep Le
49740a463f
fix(frontend): clicking think block in conversation pane breaks ui (v1 conversations) (#12057) 2025-12-16 20:14:19 +07:00
dependabot[bot]
ee97542080
chore(deps): bump the version-all group in /frontend with 7 updates (#12050)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-12-15 23:08:17 +04:00
Tim O'Farrell
9753ad3a48
Removed Legacy Conversation Manager (#12053) 2025-12-15 17:47:21 +00:00
Abhay Mishra
a12170e4c9
refactor(frontend): Extracted useQuery and useMutation from the main branch (#12031)
Co-authored-by: sp.wack <83104063+amanape@users.noreply.github.com>
2025-12-15 16:37:52 +00:00
Xingyao Wang
5c377f303f
Update SWEBench score in README (#12051) 2025-12-15 16:25:31 +00:00
Graham Neubig
089d9c1ee5
Add deprecation warning to evaluation README (#11997)
Co-authored-by: openhands <openhands@all-hands.dev>
2025-12-16 00:21:13 +08:00
Abhay Mishra
f52d9899e2
Consolidate scattered test files into a unified frontend/__tests__/ directory (#12002) 2025-12-15 19:58:09 +04:00
Neha Prasad
47914c3576
chore: remove pnpm settings from npmrc (#12028) 2025-12-15 12:05:42 +07:00
Hiep Le
67c9b6cf86
refactor(frontend): websocket error message (v1 conversations) (#12045) 2025-12-15 01:31:12 +07:00
Hiep Le
b937d344db
fix(backend): initial titles show full uuids instead of shortened uuids (v1 conversations) (#12020) 2025-12-15 00:39:32 +07:00
Hiep Le
f2def8fd7f
fix(backend): organizational skills do not trigger (v1 conversations) (#12037) 2025-12-14 23:31:07 +07:00
Hiep Le
eb9a22ef7e
fix(backend): unable to use custom mcp servers (v1 conversations) (#12038) 2025-12-14 23:30:49 +07:00
Tim O'Farrell
d57880f849
Agent server image from env (#12003)
Co-authored-by: openhands <openhands@all-hands.dev>
2025-12-13 08:16:41 -07:00
Hiep Le
d772dd65a5
fix(frontend): fix fetching the number of events on the front end (v1 conversations) (#11987) 2025-12-12 22:10:22 +07:00
dependabot[bot]
5daada17fd
chore(deps): bump the version-all group in /frontend with 8 updates (#12022)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-12-12 18:54:45 +04:00
Hiep Le
c6a8fc379b
feat: support security analyzer settings for v1 conversations (#12008) 2025-12-12 21:49:15 +07:00
Abhay Mishra
5a21c59a3c
refactor(frontend): Consolidate duplicate Settings type definitions (#12006) 2025-12-12 14:16:31 +00:00
Bharath A V
976d9d1ab9
Refactor(mocks): modularize MSW handlers into domain-specific files (#11974)
Co-authored-by: sp.wack <83104063+amanape@users.noreply.github.com>
2025-12-12 13:21:08 +00:00
Bharath A V
6917d45d3a
refactor(frontend): consolidate settings navigation items logic into shared custom hook (#11950)
Co-authored-by: amanape <83104063+amanape@users.noreply.github.com>
2025-12-12 13:20:59 +00:00