Commit Graph

519 Commits

Author SHA1 Message Date
程智超0668000959 8a246c2282 fix(agent): handle os.Getwd error in NewContextBuilder without behavior regression 2026-06-08 16:52:00 +08:00
程智超0668000959 1ab442b12c refactor: replace log.Printf/fmt.Printf with structured logger
Replace raw log.Printf and fmt.Printf calls in pkg/state, pkg/agent, and pkg/tools with structured logger calls (WarnCF/InfoCF). This ensures warnings and info messages are routed through the configured logging infrastructure instead of raw stderr/stdout.
2026-06-08 09:18:02 +08:00
Mauro b10f9cdf18 Merge pull request #2985 from chengzhichao-xydt/codex/context-show-summarize-threshold
fix(context): show both summarize and compress thresholds in /context
2026-06-05 19:24:54 +02:00
程智超0668000959 6c882ec5e7 fix(agent): log warning when LoadAndDelete type assertion fails
Add a warning log when the type assertion from sync.Map.LoadAndDelete fails in UnsubscribeEvents, per review suggestion. This makes a mismatched type observable for debugging.
2026-06-06 00:32:49 +08:00
程智超0668000959 7a7e205cc8 fix(context): expose history tokens and remove leaked state files
Address remaining review feedback: 1) Add HistoryTokens field to ContextUsage/ContextStats, showing history-only token count in /context and frontend UI alongside SummarizeAtTokens so users can see the actual summarization trigger comparison. 2) Remove .codebuddy/github-contribute/ state files accidentally included in the PR.
2026-06-06 00:28:32 +08:00
程智超0668000959 f0f809db35 fix(agent): add ok check for LoadAndDelete type assertion
sync.Map.LoadAndDelete returns any; unprotected type assertion could panic if an unexpected type were stored. Add ok check to safely handle mismatched types.
2026-06-05 10:12:14 +08:00
程智超0668000959 296a8ae287 fix(context): address review - clarify threshold alignment, i18n strings, add test coverage 2026-06-05 09:27:45 +08:00
程智超0668000959 5f826f4448 fix(context): show both summarize and compress thresholds in /context
The /context command previously showed only the hard budget compression
threshold (contextWindow - maxTokens), which confused users who expected
to see the soft summarization trigger from summarize_token_percent.

This commit adds SummarizeAtTokens alongside the existing CompressAtTokens
so that both thresholds are visible:

- Compress at: contextWindow - maxTokens (hard budget, triggers proactive
  compression when exceeded)
- Summarize at: contextWindow * summarizeTokenPercent / 100 (soft trigger,
  matches maybeSummarize's threshold)

The fix updates the /context command output, the Web UI popover, and the
pico channel WebSocket payload.

Fixes #2968
2026-06-04 11:03:16 +08:00
程智超0668000959 99a7179e76 fix(agent): retry transient LLM HTTP errors using provider error classifier
Previously, only timeout and network errors (matched via string
patterns) were retried. HTTP 500 server errors from
OpenRouter/OpenAI-compatible providers would fail the agent turn
immediately when no model fallback candidate was available.

This commit replaces the separate timeout/network retry branches
with a unified transientLLMRetryReason() helper that:
1. Uses providers.ClassifyError() to detect server_error (HTTP >=500),
   timeout, network, and rate_limit errors
2. Falls back to the existing string-based detection for errors
   not classified by the provider

A regression test (TestPipeline_CallLLM_HTTP5xxRetry) verifies that
HTTP 500 errors are retried and recover successfully.

This is a clean rebase of the approach originally proposed in #2768
by afjcjsbx.
2026-06-02 19:58:09 +08:00
Mauro ba8065923b Merge pull request #2856 from bogdanovich/feat/message-media-outbound
feat(message): support media attachments and Telegram rich delivery
2026-05-31 11:38:38 +02:00
lc6464 9825b4782f fix(seahorse,session): preserve created_at across history bootstrap 2026-05-26 14:05:20 +08:00
afjcjsbx 9bb44b0a80 fix lint 2026-05-23 09:42:56 +02:00
afjcjsbx 6a97b1b087 Merge remote-tracking branch 'upstream/main' into fix/seahorse-fresh-tail-budget
# Conflicts:
#	pkg/agent/pipeline_llm.go
#	pkg/agent/pipeline_setup.go
#	pkg/agent/turn_state.go
2026-05-23 09:33:33 +02:00
lc6464 3a454593ca feat(openai_compat): map DeepSeek thinking fields 2026-05-23 10:51:24 +08:00
Anton Bogdanovich ceebda35ee fix(message): gate local media attachments 2026-05-22 16:36:44 -07:00
Anton Bogdanovich 5a4e42d1b6 feat(message): support media attachments in outbound tool 2026-05-22 16:25:50 -07:00
LiusCraft 33e5503e26 fix(session): normalize CreatedAt in SessionManager AddFullMessage/SetHistory 2026-05-22 13:42:35 +08:00
LiusCraft fd08ebd3db fix(test): read back history after SetHistory in steering test for CreatedAt normalization 2026-05-22 13:15:56 +08:00
LiusCraft 34e73f6b1a fix(test): read back history after SetHistory to account for CreatedAt normalization 2026-05-22 13:15:56 +08:00
LiusCraft 81bbef62b1 feat(session): add per-message created_at timestamps
- Persistence layer (jsonl.go addMsg/SetHistory) normalizes CreatedAt
  when missing so the invariant is guaranteed at the storage boundary
- API layer (session.go) exposes created_at on all transcript message
  types with session.updated fallback for legacy messages
- Frontend uses per-message timestamps when available
- messagesContentEqual ignores CreatedAt for tail-matching after
  JSONL roundtrip

Fixes #2787
2026-05-22 13:15:56 +08:00
lxowalle 2992eccbf0 feat: add request-scoped context policies (#2914)
* feat: add request-scoped context policies

Add named turn profiles under agents.defaults so callers can opt into
per-request context and tool policies without changing default chat behavior.

Profiles can disable history, system context, skill prompts, or tools, and can
limit skills/tools with allow lists. Wire profile selection through Pico message
payloads, agent turn execution, Web chat selection, and Web visual config.

Reject invalid turn profiles before saving config through Web APIs and document
the new request context policy behavior.

* fix: address turn profile review blockers

* feat: simplify request context policy config

* fix: suppress tool prompt when turn tools are disabled

* fix: enforce turn profile tool restrictions
2026-05-22 10:06:40 +08:00
lxowalle e7e21df354 fix(agent): honor explicit thinking off (#2898)
* fix(agent): honor explicit thinking off

* fix(agent): address thinking off lint failures

* Clarify unset thinking level display

* fix ci
2026-05-21 11:07:39 +08:00
afjcjsbx f0dcba8c5a fix(seahorse): preserve active tool-call turn when trimming fresh tail 2026-05-20 09:16:09 +02:00
LC b7db059544 feat(chat,seahorse): persist and display model_name across history (#2897)
* feat(chat,seahorse): persist and display model_name across history

* test(seahorse): fix lint regressions in repair coverage

* fix(pico): preserve model_name in live updates

* fix(pico): preserve model_name through live stream wrappers
2026-05-20 13:42:21 +08:00
lxowalle 639b32703a feat: support streaming (#2892)
* Support streaming

* fix: stream pico reasoning updates

Route Pico reasoning through the active streamer and hide empty thought placeholders.

* fix: harden configured streaming delivery

* fix ci

* fix split issue
2026-05-19 16:38:47 +08:00
afjcjsbx fe7ded5c13 fix(agent): preserve active turn during context retry rebuild 2026-05-19 09:18:39 +02:00
afjcjsbx 1502636bf0 fix(seahorse): enforce budget on fresh tail and rebuild paths 2026-05-18 21:11:21 +02:00
lc6464 6ae7dc38b9 fix(openai_compat): align MiMo reasoning replay with DeepSeek 2026-05-14 20:59:01 +08:00
lxowalle b3a7b7ad64 feat: agent self evolution (#2847)
* feat: add agent self-evolution

* fix ci

* delete unused doc

* fix lint

* fix evolution review issues
2026-05-11 16:13:27 +08:00
Mauro 6e6293e596 Merge pull request #2158 from afjcjsbx/feat/agent-discovery-prompt
feat(agent): Multi-agent discovery prompt
2026-05-09 13:56:19 +02:00
Mauro f571a142bf Merge pull request #2823 from bogdanovich/fix/parent-session-tool-feedback-cleanup
fix(agent): dismiss tool feedback when outbound is skipped
2026-05-09 11:09:10 +02:00
afjcjsbx 2ae25b1038 fix(agent): treat empty AGENT.md tools as allow none 2026-05-09 10:35:13 +02:00
Anton Bogdanovich e1ed47b0ff fix(agent): remove unused scheduled helper 2026-05-09 00:53:23 -07:00
Anton Bogdanovich 8362203631 fix(agent): transcribe queued voice follow-ups 2026-05-08 13:50:14 -07:00
afjcjsbx 148583e7bb fix(agent): hide discovery when spawn is unavailable 2026-05-08 22:23:50 +02:00
Anton Bogdanovich a3edbcd05e test(agent): satisfy lint for tool feedback cleanup 2026-05-08 10:33:16 -07:00
afjcjsbx c6a09a35e2 fix(agent): suppress MCP discovery when no servers are selectable 2026-05-08 13:48:47 +02:00
afjcjsbx ffa184d183 fix(agent): resolve primary provider from frontmatter model 2026-05-08 13:43:21 +02:00
Anton Bogdanovich 610e9e3fe8 fix(agent): dismiss session tool feedback on skipped outbound 2026-05-07 23:10:56 -07:00
afjcjsbx b8f4257cee fix(agent): filter discovery by spawn permissions 2026-05-07 18:26:09 +02:00
afjcjsbx 96fd887cad fix(agent): match MCP server allowlists case-insensitively 2026-05-07 18:17:37 +02:00
afjcjsbx dd8e247550 fix(agent): align MCP prompt registration with tool allowlist 2026-05-07 14:01:43 +02:00
afjcjsbx 27bd816b1c fix(agent): validate AGENT tool declarations from registry 2026-05-07 13:49:23 +02:00
afjcjsbx f1f6e1131b removed unused code 2026-05-07 13:20:39 +02:00
afjcjsbx 6f6270b39d Merge upstream/main into feat/agent-discovery-prompt 2026-05-07 13:16:30 +02:00
美電球 658961b728 Merge pull request #2531 from is-Xiaoen/feat/delegate-tool
feat(tools): add delegate tool for cross-agent task handoff
2026-05-07 11:25:41 +08:00
Mauro 788cda5c7a Merge pull request #2762 from afjcjsbx/feat/stop-command
feat(agent): stop command
2026-05-06 18:19:14 +02:00
afjcjsbx a7e52e8a25 fix(agent): drain scoped follow-up queue when pending stop skips turn startup 2026-05-05 19:24:15 +02:00
xp d601b75268 fix(agent): send SVG attachments as files 2026-05-05 19:36:09 +08:00
Mauro ba4abff4a4 Merge pull request #2670 from david1gp/fix/tool-feedback-pretty-print
feat(agent): add pretty_print and disable_escape_html options for tool feedback
2026-05-04 21:47:32 +02:00