GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — fix(opencode): use file times for truncation cleanup by opencode-agent[bot] · Pull Request #40987 · anomalyco/opencode

Conversation

@opencode-agent

@opencode-agent opencode-agent Bot commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

Summary

  • use truncation file modification time for retention cleanup
  • stop deriving file age from wrapping tool IDs
  • cover cleanup across the identifier wrap boundary

Testing

  • bun test test/tool/truncation.test.ts --timeout 30000 --only-failures (19 passed in implementation worktree)
  • Prettier check
  • git diff --check

Requested by: @thdxr (Dax Raad via Slack)

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@thdxr
fix(opencode): use file times for truncation cleanup
efd6eaa
@opencode-agent opencode-agent Bot assigned thdxr Aug 7, 2026
@github-actions github-actions Bot added the contributor label Aug 7, 2026
@thdxr
thdxr enabled auto-merge (squash) August 7, 2026 03:46
@thdxr
thdxr merged commit d468201 into dev Aug 7, 2026
11 checks passed

Uh oh!

There was an error while loading. Please reload this page.

@thdxr
thdxr deleted the truncation-cleanup branch August 7, 2026 03:58
HQ123-BOOP pushed a commit to HQ123-BOOP/LibreCode that referenced this pull request Aug 7, 2026
@opencode-agent @thdxr @HQ123-BOOP
fix(opencode): use file times for truncation cleanup (anomalyco#40987)
83e20e9
Co-authored-by: Dax <[email protected]>
@teknium1 teknium1 mentioned this pull request Aug 14, 2026
feat(tools): expire persisted tool results after 7 days via file mtime (port opencode#40987) NousResearch/hermes-agent#85719
Closed
Qiiks added a commit to Qiiks/opencode that referenced this pull request Aug 15, 2026
@Qiiks
Merge upstream dev (through v1.18.18, anomalyco#42630) into personal/…
bfbb908
…hydration-fix

Sync 86 upstream commits (Aug 6-14) including:
- ID-wrap/chronological message ordering fixes (anomalyco#40987-anomalyco#41006) — upstream
  independently fixed the same bug class as our 07889a1/21964da41;
  adopted upstream versions (parentID === user.id for prompt exit, same
  findIndex boundaries for revert/session, isAfter helper in latest())
- v1.18.18 release (4 releases: v1.18.15-18)
- v1 database compatibility preservation (anomalyco#42444)
- ignore unknown config fields (anomalyco#41312)
- session retry cap with jitter (anomalyco#41939)
- compaction instructions for smaller models (anomalyco#42045)
- DeepSeek V4 Flash sampling defaults (anomalyco#41620)
- Copilot PDF input support detection (anomalyco#41522)
- web search for opencode-go (anomalyco#42630)
- compaction plugin hooks (experimental.session.compacting, messages.transform)
- New models: GLM 5.3, Gemini 3.7 Flash, Grok 4.6, Zen updates

Fork-only changes preserved:
- Synthetic web search backend (synthetic flag in webSearchEnabled)
- Config npm propagation to inherited models
- Tool-result media extraction for models without attachment capability
- packageManager pin to bun 1.4.-canary.1 (Rust runtime)

Conflicts resolved: message-v2, prompt, revert, session, server-session
(adopted upstream), compaction (adopted upstream), registry + websearch
test (merged both synthetic + opencode-go).
moonug pushed a commit to moonug/opencode that referenced this pull request Aug 19, 2026
@opencode-agent @thdxr Konstantin Sazonov
fix(opencode): use file times for truncation cleanup (anomalyco#40987)
62acda4
Co-authored-by: Dax <[email protected]>
lihaokun pushed a commit to lihaokun/opencode that referenced this pull request Sep 3, 2026
@yixiao5428
chore: sync upstream dev (#24)
cd10000
Merge upstream/dev at 10765ff into the fork, preserving the local
incomplete-stream recovery, context-overflow bounding, message ID rollover
chronology, reasoning fragment coalescing, periodic doom-loop detection and
resumable task-error contracts.

Upstream: 433 commits (41 feat, 165 fix), 882 files, +101191/-12002. 23
conflicts resolved; decisions recorded in
docs/devlog/2026-08-30-upstream-dev-sync.md.

Conflicts where both sides had independently implemented the same fix:

- message-v2 latest(): kept the fork's compareChronology; dropped upstream's
  equivalent isAfter helper (anomalyco#40990).
- prompt loop: combined upstream's direct-parent check with the fork's
  chronology comparison into lastAssistantBelongsToLatestTurn.
- revert boundaries: kept the fork's persisted messageTimeCreated and
  partTimeCreated, which still resolve after the boundary message or part is
  deleted, over upstream's array-index approach (anomalyco#40991).
- subagent errors: folded upstream's resumable "task_id" text (anomalyco#43657, anomalyco#43821)
  into the fork's size-bounded, escaped markup envelope.
- truncate cleanup: both sides moved to file mtime (anomalyco#40987); kept upstream's
  explicit rollover-ID test alongside the fork's.

Upstream behaviour inherited that touches fork contracts:

- anomalyco#43892 continues the loop on an unknown finish reason instead of exiting.
  Reachable without an incomplete-stream error when a provider returns a
  vendor-specific finish_reason; pinned by a regression in
  test/session/prompt.test.ts. The loop has no bound for this case.
- Compaction preserves up to 15k recent tokens, was 8k, which makes the fork's
  pre-transport willOverflow estimate fire more often.
- Retry gained jitter, a five-attempt cap and a much broader retryable-message
  match. The fork's incomplete-stream messages deliberately do not match it, so
  bounded recovery keeps exclusive control of that path.

Legacy revert boundaries are no longer hydrated in list APIs, to avoid an N+1
query. SessionRevert.cleanup re-fetches the single row when the persisted time
is absent.
androidand pushed a commit to androidand/opencode-skein that referenced this pull request Sep 19, 2026
@opencode-agent @thdxr
fix(opencode): use file times for truncation cleanup (anomalyco#40987)
3bb635a
Co-authored-by: Dax <[email protected]>
rldona pushed a commit to plazoleta-dev/FlupCode that referenced this pull request Sep 24, 2026
@opencode-agent @thdxr
fix(opencode): use file times for truncation cleanup (anomalyco#40987)
6653f98
Co-authored-by: Dax <[email protected]>
Ichinose-Kazuki pushed a commit to Ichinose-Kazuki/opencode that referenced this pull request Oct 7, 2026
@opencode-agent @thdxr
fix(opencode): use file times for truncation cleanup (anomalyco#40987)
6093fd5
Co-authored-by: Dax <[email protected]>
Spark-Liang pushed a commit to Spark-Liang/opencode that referenced this pull request Oct 9, 2026
@opencode-agent @thdxr @Spark-Liang
fix(opencode): use file times for truncation cleanup (anomalyco#40987)
1d1d7f8
Co-authored-by: Dax <[email protected]>
raitoxlol pushed a commit to raitoxlol/hermes-agent that referenced this pull request Nov 23, 2026
@teknium1
feat(tools): expire persisted tool results after 7 days via file mtime
851e5e4
Port from anomalyco/opencode#40987: use file times for truncation cleanup.

Persisted oversized tool results (/tmp/hermes-results, or the backend's
temp dir on Termux/Docker/Modal) accumulated forever - nothing ever
deleted them. OpenCode hit the same shape in their truncation-output
store and switched cleanup to file mtime; this ports the mechanism:

- cleanup_stale_results(): best-effort mtime-based sweep scoped to
  *.txt in the storage dir, run through env.execute() so it works on
  every backend. mtime (not any ID-embedded timestamp) is the age signal.
- Throttled to one sweep per storage dir per 6h per process, triggered
  opportunistically after a successful persist - zero new hot-path cost.
- Failures swallowed: retention is hygiene, never a tool-result failure.

E2E-verified with a real subprocess env: 10-day-old .txt deleted,
3-day-old kept, non-.txt untouched, throttle suppresses repeat sweeps;
sabotage run confirms the E2E fails without the wiring.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

Uh oh!

There was an error while loading. Please reload this page.

Assignees

@thdxr thdxr

Labels

contributor

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

1 participant

@thdxr
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.