Skip to content

Fix re-recording after export losing data (missing NEW:MISSION)#47

Merged
fank merged 3 commits intomainfrom
fix/re-recording-missing-new-mission
Feb 13, 2026
Merged

Fix re-recording after export losing data (missing NEW:MISSION)#47
fank merged 3 commits intomainfrom
fix/re-recording-missing-new-mission

Conversation

@fank
Copy link
Member

@fank fank commented Feb 12, 2026

Summary

  • Fix bug where restarting recording within the same mission after a previous export fails with "no mission to end: mission was never started" — the extension never received a :NEW:MISSION: command for the new recording session
  • Set dbValid = false after export so startRecording knows to re-register the mission with the extension before starting the capture loop
  • Fix false positive error logging when Arma's callExtension sets errorCode=301 (performance warning, not a failure)

Root Cause

When an admin clicks "Start/Resume Recording" after a previous recording was exported (within the same running mission), the OCAP_record CBA event calls startRecordingcaptureLoop directly. This bypasses initDB, so :NEW:MISSION: is never sent to the extension. The extension has no active mission session, and all recorded data is lost when :SAVE:MISSION: is called.

Changes

File Change
addons/recorder/fnc_exportData.sqf Set dbValid = false after save
addons/database/fnc_initDB.sqf Guard :MISSION:OK: handler against duplicate setup with initialSetupDone
addons/database/fnc_newMission.sqf New — re-sends :NEW:MISSION: using cached world/mission context
addons/database/XEH_prep.sqf Add PREP(newMission)
addons/recorder/fnc_startRecording.sqf Check dbValid before capture loop; if false, call newMission and wait for confirmation
addons/extension/fnc_sendData.sqf Separate Arma errorCode (warning) from extension returnCode (error)

Test plan

  • Start a mission with OCAP enabled and auto-start
  • Let it record ~30 seconds, then export via admin diary
  • Verify extension log shows Mission recording saved and Mission uploaded
  • Click "Start/Resume Recording" in admin diary
  • Verify extension log shows New mission logged (re-registration)
  • Let it record ~30 seconds, export again
  • Verify extension log shows Mission recording savedno "no mission to end" error
  • Verify both recordings appear in OCAP web frontend

@gemini-code-assist
Copy link

Summary of Changes

Hello @fank, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request addresses a critical bug that prevented successful re-recording of mission data after an export within the same running mission. Previously, the system failed to re-initialize the extension with a new mission session, leading to data loss. The changes introduce a mechanism to explicitly re-register the mission with the extension, update state management, and refine error logging to accurately reflect extension warnings versus critical failures, thereby improving the reliability and robustness of the recording system.

Highlights

  • Recording Bug Fix: Resolved an issue where restarting recording after an export within the same mission would fail due to a missing ':NEW:MISSION:' command to the extension, leading to data loss.
  • State Management: Ensured the 'dbValid' flag is correctly set to 'false' after data export, prompting the system to re-register the mission with the extension before starting a new recording session.
  • Error Logging Improvement: Corrected false positive error logging by distinguishing Arma's performance warnings (specifically 'errorCode=301') from actual critical extension failures, providing clearer diagnostic information.
Changelog
  • addons/database/XEH_prep.sqf
    • Added 'PREP(newMission)'.
  • addons/database/fnc_initDB.sqf
    • Guarded ':MISSION:OK:' handler against duplicate setup with 'initialSetupDone'.
  • addons/database/fnc_newMission.sqf
    • Added a new function to re-send ':NEW:MISSION:' using cached world/mission context.
  • addons/extension/fnc_sendData.sqf
    • Separated Arma 'errorCode' (warning) from extension 'returnCode' (error).
  • addons/recorder/fnc_exportData.sqf
    • Set 'dbValid = false' after save.
  • addons/recorder/fnc_startRecording.sqf
    • Checked 'dbValid' before the capture loop; if false, called 'newMission' and waited for confirmation.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request effectively addresses a bug where re-recording after an export would fail due to a missing :NEW:MISSION: command. The changes are well-structured, involving invalidating the database state on export, detecting this state on re-record, and introducing a new function to re-register the mission. The improved error handling in fnc_sendData.sqf is also a good addition. I have one suggestion to improve the robustness of the new waiting logic in fnc_startRecording.sqf by adding a timeout.

Add a 30-second timeout with error logging and player notification
when waiting for the extension to confirm the new mission. Prevents
recording from silently stalling if the extension fails to respond.
@FyWolf
Copy link

FyWolf commented Feb 13, 2026

Testing plan done.
Result: sucessful
LOG:

time=2026-02-13T00:39:18Z level=INFO msg="Addon log" message="Initialized HandleDisconnect EH" usingLocalDB=false currentMission=tempMissionMP currentMissionID=0 statusMonitorActive=true time=2026-02-13T00:39:18Z level=INFO msg="Addon log" message="Initialized PlayerConnected EH" usingLocalDB=false currentMission=tempMissionMP currentMissionID=0 statusMonitorActive=true time=2026-02-13T00:39:18Z level=INFO msg="Addon log" message="Initialized OnUserAdminStateChanged EH" usingLocalDB=false currentMission=tempMissionMP currentMissionID=0 statusMonitorActive=true time=2026-02-13T00:39:18Z level=INFO msg="Addon log" message="Initialized EntityKilled EH" usingLocalDB=false currentMission=tempMissionMP currentMissionID=0 statusMonitorActive=true time=2026-02-13T00:39:18Z level=INFO msg="Addon log" message="Initialized EntityRespawned EH" usingLocalDB=false currentMission=tempMissionMP currentMissionID=0 statusMonitorActive=true time=2026-02-13T00:39:18Z level=INFO msg="Addon log" message="Initialized MPEnded EH" usingLocalDB=false currentMission=tempMissionMP currentMissionID=0 statusMonitorActive=true time=2026-02-13T00:39:18Z level=INFO msg="Addon log" message="Initialized Ended EH" usingLocalDB=false currentMission=tempMissionMP currentMissionID=0 statusMonitorActive=true time=2026-02-13T00:39:18Z level=INFO msg="Addon log" message="Initialized customEvent listener" usingLocalDB=false currentMission=tempMissionMP currentMissionID=0 statusMonitorActive=true time=2026-02-13T00:39:18Z level=INFO msg="Addon log" message="Initialized counterInit listener" usingLocalDB=false currentMission=tempMissionMP currentMissionID=0 statusMonitorActive=true time=2026-02-13T00:39:18Z level=INFO msg="Addon log" message="Initialized counterEvent listener" usingLocalDB=false currentMission=tempMissionMP currentMissionID=0 statusMonitorActive=true time=2026-02-13T00:39:18Z level=INFO msg="Addon log" message="Initialized record listener" usingLocalDB=false currentMission=tempMissionMP currentMissionID=0 statusMonitorActive=true time=2026-02-13T00:39:18Z level=INFO msg="Addon log" message="Initialized pause listener" usingLocalDB=false currentMission=tempMissionMP currentMissionID=0 statusMonitorActive=true time=2026-02-13T00:39:18Z level=INFO msg="Addon log" message="Initialized exportData listener" usingLocalDB=false currentMission=tempMissionMP currentMissionID=0 statusMonitorActive=true time=2026-02-13T00:39:18Z level=INFO msg="Addon version" version=3.0.0 usingLocalDB=false currentMission=tempMissionMP currentMissionID=0 statusMonitorActive=true time=2026-02-13T00:39:18Z level=INFO msg="Memory storage mode initialized" usingLocalDB=false currentMission=tempMissionMP currentMissionID=0 statusMonitorActive=true time=2026-02-13T00:39:18Z level=INFO msg="New mission logged" function=:NEW:MISSION: usingLocalDB=false currentMission=tempMissionMP currentMissionID=0 statusMonitorActive=true time=2026-02-13T00:39:22Z level=INFO msg="Addon log" message=x\ocap\addons\recorder\fnc_captureLoop.sqf usingLocalDB=false currentMission=tempMissionMP currentMissionID=0 statusMonitorActive=true time=2026-02-13T00:40:12Z level=INFO msg="Received :SAVE:MISSION: command, ending mission recording" usingLocalDB=false currentMission=tempMissionMP currentMissionID=0 statusMonitorActive=true time=2026-02-13T00:40:12Z level=INFO msg="Mission recording saved to storage backend" usingLocalDB=false currentMission=tempMissionMP currentMissionID=0 statusMonitorActive=true time=2026-02-13T00:40:12Z level=INFO msg="Mission uploaded to OCAP web" path=recordings/tempMissionMP_20260213_014012.json.gz usingLocalDB=false currentMission=tempMissionMP currentMissionID=0 statusMonitorActive=true time=2026-02-13T00:40:12Z level=INFO msg="Addon log" message="Saved recording of mission" usingLocalDB=false currentMission=tempMissionMP currentMissionID=0 statusMonitorActive=true time=2026-02-13T00:41:00Z level=INFO msg="New mission logged" function=:NEW:MISSION: usingLocalDB=false currentMission=tempMissionMP currentMissionID=0 statusMonitorActive=true time=2026-02-13T00:41:00Z level=INFO msg="Addon log" message=x\ocap\addons\recorder\fnc_captureLoop.sqf usingLocalDB=false currentMission=tempMissionMP currentMissionID=0 statusMonitorActive=true time=2026-02-13T00:41:31Z level=INFO msg="Received :SAVE:MISSION: command, ending mission recording" usingLocalDB=false currentMission=tempMissionMP currentMissionID=0 statusMonitorActive=true time=2026-02-13T00:41:31Z level=INFO msg="Mission recording saved to storage backend" usingLocalDB=false currentMission=tempMissionMP currentMissionID=0 statusMonitorActive=true time=2026-02-13T00:41:31Z level=INFO msg="Mission uploaded to OCAP web" path=recordings/tempMissionMP_20260213_014131.json.gz usingLocalDB=false currentMission=tempMissionMP currentMissionID=0 statusMonitorActive=true time=2026-02-13T00:41:31Z level=INFO msg="Addon log" message="Saved recording of mission" usingLocalDB=false currentMission=tempMissionMP currentMissionID=0 statusMonitorActive=true

The two mission do get uploaded as intended.
image

@fank fank merged commit 41dd493 into main Feb 13, 2026
1 check passed
@fank fank deleted the fix/re-recording-missing-new-mission branch February 13, 2026 08:38
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