Commit Graph

14 Commits

Author SHA1 Message Date
CodeWhale Agent d7de0a8865 Merge PR #2971: expose matched approval rule metadata
Verified on scratch/v0.8.59-clean-train-20260612: build and hooks/core tests green.
2026-06-12 09:59:53 -07:00
Hunter B cf910b7da2 feat(goal): persist thread goals through app server 2026-06-12 06:28:47 -07:00
Hunter B 10e41b1153 feat(runtime): expose matched approval rule metadata
Harvests the explainability slice from PR #2971 without changing the public HookEvent constructor shape. Runtime API approval.required frames now carry matched_rule metadata when an execpolicy rule caused the prompt.

Co-authored-by: greyfreedom <11493871+greyfreedom@users.noreply.github.com>
2026-06-12 01:46:41 -07:00
greyfreedom 6da40e59b4 feat(execpolicy): expose matched approval rule metadata 2026-06-10 11:21:44 +08:00
greyfreedom 17dbed13c7 feat(execpolicy): wire permissions.toml ask-rules into runtime
Harvested from PR #2885 by @greyfreedom. Wires ask-rules into the
app-server and core ExecPolicyEngine (previously inert). Removes the
original PR's NeedsApproval arm that incorrectly allow-listed the
working directory as a network host.

Co-Authored-By: greyfreedom <11493871+greyfreedom@users.noreply.github.com>
2026-06-07 10:49:36 -07:00
huqiantao ef4dc5ca61 fix: error handling bugs - log instead of silently swallowing errors
1. Fix swallowed persist_config errors (app-server/lib.rs:882,896)
   - Log errors when config persistence fails after set/unset
   - Users previously got success response even when disk write failed

2. Fix swallowed job store load error (core/lib.rs:751)
   - Add warning log when job store fails to load at startup
   - Previously silently started with empty job list on corruption

3. Fix silent config parse failures (config/lib.rs:1590)
   - Log warning when project config TOML is malformed
   - Previously returned None indistinguishable from 'no config file'

4. Fix MCP connect_all errors swallowed (mcp.rs:2151,2189)
   - Log warnings for each server that fails to connect
   - Previously returned incomplete resource list with no indication

5. Fix error context stripped in engine status (core/engine.rs:2223)
   - Use {err:#} format to include full error chain
   - Was inconsistent with line 2234 which already used {err:#}

6. Fix tool audit log failures silently dropped (tool_execution.rs:122-136)
   - Log each failure: serialization, directory creation, file open, write
   - Previously silently dropped all errors for security audit trail

7. Fix Err(_) arms discarding error info (runtime_log.rs:179, runtime_threads.rs:828)
   - Log stderr redirect failures on Windows
   - Log poisoned mutex in pending_approvals

8. Fix env var parsing errors silently ignored (config/lib.rs:2519-2530)
   - Warn when DEEPSEEK_TELEMETRY, DEEPSEEK_YOLO, DEEPSEEK_HTTP_HEADERS
     have invalid values instead of silently treating as unset

9. Fix MCP config reload errors swallowed (mcp.rs:2011)
   - Log config reload errors instead of complete silence

10. Fix .expect() on sub-agent runtime (core/engine.rs:1715)
    - Gracefully fall back to basic tool set when API client missing
    - Previously panicked if subagents enabled but no client configured

11. Fix .expect() on goal objective (core/engine.rs:2543)
    - Use safe if-let pattern instead of check+expect
    - Prevents panic if refactoring changes control flow
2026-06-07 19:04:47 +08:00
HUQIANTAO 9c336123ea test(core): add comprehensive unit tests for JobManager and helpers (#2440)
* test(core): add comprehensive unit tests for JobManager and helpers

Add 35 unit tests covering:
- JobManager lifecycle (enqueue, set_running, update_progress, complete, fail, cancel, pause, resume)
- Exponential backoff computation and saturation
- History truncation beyond MAX_JOB_HISTORY_ENTRIES
- Persisted detail encode/parse round-trip
- Job status string conversion round-trips
- Helper functions (truncate_preview, json_optional_string, parse_retry_metadata, parse_history_entry)
- Status mapping between runtime and persisted types
- Initial history preview generation

* style: fix cargo fmt formatting

* test(core): fix job manager test hygiene

---------

Co-authored-by: Hu Qiantao <huqiantao@HudeMacBook-Air.local>
Co-authored-by: Hunter B <hmbown@gmail.com>
2026-05-31 11:10:37 -07:00
HUQIANTAO aea924adf2 docs(core): add doc comments to all public types (#2460)
* docs(core): add doc comments to all public types

Add doc comments to all public types in the core crate:
- InitialHistory enum and variants
- NewThread struct and fields
- JobStatus enum and variants
- JobRetryMetadata struct and fields
- JobHistoryEntry struct and fields
- JobRecord struct and fields
- JobManager struct
- ThreadManager struct
- Runtime struct

* docs(core): add doc comments to all public types

---------

Co-authored-by: Hu Qiantao <huqiantao@HudeMacBook-Air.local>
2026-05-31 10:17:45 -07:00
Hunter Bown 8f095b882f feat(execpolicy): add typed ask rule foundation (#2404)
* feat(execpolicy): add typed ask rule foundation

* fix(execpolicy): tighten typed ask diagnostics

---------

Co-authored-by: greyfreedom <greyfreedom@163.com>
2026-05-31 01:37:15 -07:00
hqt 7993f97f88 feat(state): add parent_entry_id on the message table for fork support 2026-05-30 19:23:07 -07:00
Hunter Bown c6d73d98de refactor(crates): rename workspace members to codewhale-*
Rename the 14 workspace member crates from `deepseek-*` (and
`deepseek-tui-*`) to `codewhale-*`. Internal-only — binary names
(`deepseek` and `deepseek-tui`) are intentionally untouched in this
phase; they move in the next phase along with the deprecation shims.

Affects:
- 14 `[package] name = "..."` declarations.
- All inter-crate `[dependencies]` entries that referenced the old
  package names.
- All `use deepseek_*::...` statements rewritten to `use codewhale_*`.
- Cargo.lock regenerated.

CI workflows and release scripts that pass `-p deepseek-*` still
reference the old names; those move with the binary rename phase so
that pair lands together.

Local gates green: `cargo check --workspace --all-targets --locked`,
`cargo fmt --all -- --check`, `cargo clippy --workspace --all-targets
--all-features --locked -- -D warnings`, `cargo test --workspace
--all-features --locked` (3226+ pass, 0 fail).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-23 10:21:33 -05:00
Hunter Bown 5ce1314684 feat(runtime): bridge desktop approvals and skills 2026-05-07 13:53:01 -05:00
Hunter Bown 063d5d7d99 fix: prevent panic-prone edge cases
Summary:
- Use Reverse for job timestamp sorting to avoid negation overflow edge cases.
- Make secret redaction UTF-8 safe while preserving the previous short-secret threshold.
- Update remaining setup and doctor guidance to use the supported deepseek dispatcher name.

Test plan:
- cargo test -p deepseek-config list_values_redacts --locked
- cargo test -p deepseek-core --locked
- cargo test -p deepseek-tui doctor_endpoint_tests --locked
- cargo fmt --all -- --check
- git diff --check

Supersedes #957.
2026-05-07 03:37:50 -05:00
Hunter Bown 37186c3d95 Workspace migration: split into modular crates, parity CI, release updates
- Convert root to Cargo workspace with crates/ layout
- Add deepseek-* crates mirroring Codex architecture
- Add parity CI workflow with snapshot/protocol/state tests
- Update release workflow to build both deepseek and deepseek-tui binaries
- Bump version to 0.3.28
2026-03-02 17:52:46 -06:00