Commit Graph

1150 Commits

Author SHA1 Message Date
Timothy Jaeryang Baek
de3317e26b refac 2026-03-17 17:58:01 -05:00
Timothy Jaeryang Baek
c0385f60ba refac 2026-03-17 16:52:14 -05:00
Ethan T.
a229f9ea42 fix: replace bare except with except Exception (#22473)
Replace bare except clauses with except Exception to follow Python best practices and avoid catching unexpected system exceptions like KeyboardInterrupt and SystemExit.
2026-03-15 17:48:23 -05:00
Timothy Jaeryang Baek
d85b52bfc2 refac 2026-03-12 20:37:41 -05:00
Timothy Jaeryang Baek
afa0609ece feat: support whitelist filtering in AuditLoggingMiddleware (#22515)
Add AUDIT_INCLUDED_PATHS env var for whitelist-based audit filtering.
When set, only matching paths are audited and AUDIT_EXCLUDED_PATHS is
ignored. Auth endpoints (signin/signout/signup) are always logged
regardless of filtering mode.
2026-03-11 15:41:42 -05:00
Timothy Jaeryang Baek
e34ed72e1e refac 2026-03-11 15:33:24 -05:00
Shamil
3a6b5ebb5f refac: modernize type hints and imports in access_control module (#22594) 2026-03-11 15:28:39 -05:00
Lorenzo Maffioli
035b981e11 feat(otel): introduce an environment variable to control the export interval of otel metrics (#22529) 2026-03-11 15:27:06 -05:00
Timothy Jaeryang Baek
8da29566a1 refac: safer tool server handling 2026-03-11 15:22:51 -05:00
Timothy Jaeryang Baek
97cc94756e chore: bump 2026-03-08 19:00:50 -05:00
Timothy Jaeryang Baek
1364df0913 refac 2026-03-08 18:26:36 -05:00
Timothy Jaeryang Baek
352391fa76 chore: format 2026-03-08 18:14:09 -05:00
Timothy Jaeryang Baek
9d8f590fc5 feat: support pipe filters for per-message content truncation in task templates
Add |middletruncate:n, |start:n, and |end:n pipe filters to the
{{MESSAGES}} template variable, enabling per-message character
truncation for task models (title, tags, follow-up, etc.).

Example: {{MESSAGES:END:2|middletruncate:500}}

This optimizes task model prompt size for conversations with very
long messages (e.g. pasted documents), reducing latency for local
models and API costs.

Closes #21499
2026-03-08 17:43:23 -05:00
Ethan T.
a97f5adf95 fix: URL-encode OAuth error message in redirect URL (#22415)
- URL-encodes the OAuth error message when constructing the redirect URL in the OIDC callback handler
- Without encoding, error messages containing spaces, ampersands, or other special characters produce malformed URLs that the frontend cannot parse correctly
- The custom OAuth client callback handler already correctly uses urllib.parse.quote_plus() for the same purpose; this fix brings the OIDC handler in line with that pattern

Co-authored-by: gambletan <tan@gambletan.com>
2026-03-08 16:47:47 -05:00
Fu-Jie
138c4cbfcf fix: filter out internal tool methods starting with underscore (#22408) 2026-03-08 16:46:56 -05:00
Alvin Tang
3e513be963 fix: prevent TypeError in Teams webhook when user data is missing (#22444)
json.loads(event_data.get("user", {})) crashes with TypeError when
the "user" key is absent because the default value {} is a dict, not
a JSON string. json.loads expects str/bytes, not dict.

Also handle the case where "user" is already a dict (not serialized
JSON) to make the webhook more robust.

Co-authored-by: gambletan <ethanchang32@gmail.com>
2026-03-08 16:45:21 -05:00
Ethan T.
61bbb99d9e fix: replace bare except with Exception in oauth.py (#22420)
* fix: replace bare except with except Exception in main.py

* fix: replace bare except with Exception in oauth.py

In Python 3, bare 'except:' is discouraged as it catches all
SystemExit and KeyboardInterrupt exceptions. Changed to 'except Exception:'
to only catch actual exceptions.
2026-03-08 16:36:53 -05:00
Timothy Jaeryang Baek
710b5270a1 refac 2026-03-07 20:43:45 -06:00
Timothy Jaeryang Baek
2bff50f736 refac 2026-03-07 20:42:21 -06:00
Timothy Jaeryang Baek
f047b6b3ae refac 2026-03-07 20:30:42 -06:00
Timothy Jaeryang Baek
368912ca62 refac 2026-03-07 20:28:17 -06:00
Timothy Jaeryang Baek
3ceaa107ab chore: format 2026-03-07 20:14:32 -06:00
Timothy Jaeryang Baek
144d8b1bb7 refac 2026-03-07 20:12:35 -06:00
Timothy Jaeryang Baek
989938856f refac 2026-03-07 20:05:18 -06:00
Timothy Jaeryang Baek
80b5896b70 refac 2026-03-07 19:38:20 -06:00
Timothy Jaeryang Baek
967b1137dc refac 2026-03-07 19:31:51 -06:00
Timothy Jaeryang Baek
ce0ca894fe enh: code interpreter pyodide fs 2026-03-07 19:23:18 -06:00
Timothy Jaeryang Baek
459a60a242 refac 2026-03-07 19:17:24 -06:00
Timothy Jaeryang Baek
d7efdcce2b refac 2026-03-07 19:02:03 -06:00
Timothy Jaeryang Baek
35bc831077 refac 2026-03-07 18:18:02 -06:00
pedro-inf-custodio
5d4505c685 fix: add support for scope in OAuth refresh token request (#22359)
* fix: add support for scope in OAuth refresh token request

* add oauth refresh token include scope

* Fix variable import

* Fix env variables import

* Added debug logs WIP

* Remove debug logs
2026-03-07 19:13:28 -05:00
Timothy Jaeryang Baek
bc5d519c4f refac 2026-03-07 17:29:24 -06:00
Timothy Jaeryang Baek
7cdff6b1e2 refac 2026-03-07 17:24:17 -06:00
Timothy Jaeryang Baek
b04de83c20 refac 2026-03-07 17:18:46 -06:00
Classic298
dfa2511199 fix: persist token usage data for non-streaming chat responses (#22166)
The non-streaming response handler was saving assistant messages without
their usage/token data. While the streaming handler correctly extracted
and saved usage information, the non-streaming path discarded it entirely.

This caused assistant messages from non-streaming completions to have
NULL usage in the chat_message table, making them invisible to the
analytics token aggregation queries and contributing to the '0 tokens'
display in Admin Panel Analytics.

Extract and normalize the usage data from the API response and include
it in the database upsert, matching the pattern already used by the
streaming handler.
2026-03-07 17:17:36 -06:00
Timothy Jaeryang Baek
d4faa5a5ea refac 2026-03-07 17:13:19 -06:00
Timothy Jaeryang Baek
e6b00a8905 refac 2026-03-07 17:03:23 -06:00
Timothy Jaeryang Baek
03c6caac1f refac 2026-03-07 17:02:02 -06:00
Timothy Jaeryang Baek
29160741a3 refac 2026-03-07 16:59:06 -06:00
Timothy Jaeryang Baek
6d9996e599 refac 2026-03-06 20:12:37 -06:00
Classic298
d93cb3658d perf(models): batch-fetch function valves to eliminate N+1 queries (#22301)
* perf(models): batch-fetch function valves to eliminate N+1 queries

get_action_priority() called Functions.get_function_valves_by_id()
individually for every action on every model — an N+1 query pattern
that issued one DB round-trip per (action x model) pair.

Add Functions.get_function_valves_by_ids() that fetches all valves in
a single WHERE IN query, then look up each action's valves from the
pre-fetched dict inside get_action_priority().

No functional change — same priority resolution, same sort order.

* Update models.py

* Update models.py
2026-03-06 15:56:01 -06:00
Timothy Jaeryang Baek
4ab831b259 refac 2026-03-06 15:42:13 -06:00
Shamil
9cf6108527 feat: add otel system metrics instrumentation (#22265) 2026-03-06 14:24:24 -06:00
Erhhung Yuan
fa1ebfa4fd fix: use same metric description as OTel (#22192) (#22293)
Signed-off-by: Erhhung Yuan <erhhung@gmail.com>
2026-03-06 13:58:25 -06:00
Timothy Jaeryang Baek
828656b35f feat: auto-refresh FileNav on write_file, replace_file_content, and run_command
Backend emits terminal events for write_file, replace_file_content,
and run_command. Frontend showFileNavDir subscriber uses startsWith
path matching to smartly refresh only when the event is relevant:
- write_file/replace_file_content: refresh if path is in current view
- run_command: always refresh (uses root '/' which matches everything)
- Also adds copy-to-clipboard button and code preview full-height fix
2026-03-05 14:41:18 -06:00
Timothy Jaeryang Baek
10daa64d5b chore: format 2026-03-02 17:26:18 -06:00
Timothy Jaeryang Baek
e0d4c3ec92 refac 2026-03-02 17:26:01 -06:00
Classic298
65fbbf5e35 fix: grant file access for knowledge attached to shared workspace models (#22151) 2026-03-02 18:08:49 -05:00
Timothy Jaeryang Baek
3de14a53c2 chore: format 2026-03-02 17:04:52 -06:00
Classic298
d040953c76 fix: omit None-valued query params in execute_tool_server (#22144) 2026-03-02 16:51:15 -06:00