Skip to content

fix(subagents): release resident-file lease on terminal state (follow-up to #660)#694

Closed
merchloubna70-dot wants to merge 3 commits into
Hmbown:mainfrom
merchloubna70-dot:fix/resident-lease-cleanup-660
Closed

fix(subagents): release resident-file lease on terminal state (follow-up to #660)#694
merchloubna70-dot wants to merge 3 commits into
Hmbown:mainfrom
merchloubna70-dot:fix/resident-lease-cleanup-660

Conversation

@merchloubna70-dot

Copy link
Copy Markdown

Fixes lease-never-released bug found by @Hmbown in review of #660.

  • Extracts lease table into resident_lease_table() helper (process-scoped OnceLock)
  • Adds public release_resident_lease(file_path) for the sub-agent manager to call on terminal state transitions
  • Cargo check: 0 errors, 1 pre-existing dead_code warning (release_resident_lease is public API, wiring into manager lifecycle is a follow-up)

See #660 review comment.

macworkers and others added 3 commits May 4, 2026 12:39
All system prompts were English-only, causing DeepSeek V4 to reason
and respond in English even when users wrote in Chinese or other
languages.

Add a Language Mirror section to base.md and base.txt that instructs
the model to detect the user's primary language and use it for both
reasoning (thinking tokens) and the final reply.
base.txt is not referenced via include_str! in prompts.rs.
Only base.md is loaded (BASE_PROMPT). Remove the redundant change
to base.txt as noted by Gemini Code Assist review.
@gemini-code-assist

Copy link
Copy Markdown
Contributor

Warning

You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again!

Hmbown added a commit that referenced this pull request May 5, 2026
#660)

Resident-file leases were stamped as "pending" at spawn time because the
agent id is only assigned by the manager later. The release function
introduced in 2ee926924 matches by agent id, so it could never find
those entries and leases would persist for the lifetime of the process.

After spawn returns the real agent id, replace any "pending" entry with
it so the existing release-on-terminal-state path actually fires.

Resolves the documented v0.8.12 caveat noted in the CHANGELOG. Closes
the loop with PR #694, which proposed a release-by-file-path API but
did not address the placeholder problem itself.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@Hmbown

Hmbown commented May 5, 2026

Copy link
Copy Markdown
Owner

Thanks for the follow-up! Closing without merge — the original lease-release work in #660 already releases by agent_id at all three terminal-state transitions (cancel / fail / complete), so a release-by-file_path API isn't quite what was needed. The actual remaining bug was that the lease was stamped as "pending" at spawn time (because the agent id is only assigned by the manager later), so release_resident_leases_for(agent_id) could never find the entries. Fixed in 3fedb980c by replacing the placeholder with the real id immediately after spawn returns. Good instinct that the original fix was incomplete.

@Hmbown Hmbown closed this May 5, 2026
MMMarcinho pushed a commit to MMMarcinho/DeepSeek-TUI that referenced this pull request May 6, 2026
Hmbown#660)

Resident-file leases were stamped as "pending" at spawn time because the
agent id is only assigned by the manager later. The release function
introduced in 2ee926924 matches by agent id, so it could never find
those entries and leases would persist for the lifetime of the process.

After spawn returns the real agent id, replace any "pending" entry with
it so the existing release-on-terminal-state path actually fires.

Resolves the documented v0.8.12 caveat noted in the CHANGELOG. Closes
the loop with PR Hmbown#694, which proposed a release-by-file-path API but
did not address the placeholder problem itself.

Co-Authored-By: Claude Opus 4.7 (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